If you want to change the status of products automatically, the following module functions are available:
Function | Arguments | Information |
---|---|---|
getProductState | 'product', $pid | Returns status of product as array |
setProductState | 'product', $pid, $state | $state must be on or off |
getAllHiddenProducts | 'product' | Returns all hidden products as array |
The argument "product" is not a variable, but a fixed string. To leave open further integrations into the module for us, for example an integration of domains, the keyword "product" is passed.
To use the functions, first the one instance of the class must be created, here a code example:
Code Block | ||||
---|---|---|---|---|
| ||||
<?php
require_once ('/path/to/modules/addons/hideproducts/autoload.php');
$pid = 1234;
try {
$hideproducts = new dpl_hideproducts ();
$getProductState = $hideproducts->getProductState ('product', $pid);
var_dump ($getProductState);
} catch (Exception $e) {
echo $e->getMessage();
} |
The module throws an exception if the license is invalid.
By default the module uses Maxmind to determine the country of the IP. It is possible that you add your own lookup providers and then select them in the module configuration.
In this example, we name our new IP lookup provider "iplocation".
- Create a new directory for your lookup provider: /addons/adminloginnotify/providers/iplocation
- Create a new php file: /addons/adminloginnotify/providers/iplocation/iplocation.php
In the newly created file, you need to insert following function which get called by the module:
Code Block function iplocation_run ($ip) { return $country->isoCode; }
The function receives the IP of the admin as a function argument and your function must return the ISO code from the country, e.g. US, UK, etc.
After creating your own IP lookup provider, you can select the new service in the module settings via a dropdown:
...