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 an instance of the class must be created. Example:
<?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.