z72diego Posted April 15, 2017 Share Posted April 15, 2017 Hello everyone, I am more than novice in php, I understand parts of the code but most do not understand. I'm modifying a module that exports PrestaShop products to a PDF based on the selected category. Now, I want the "get" function to get all the active products, but not those that are enabled as "online_only". The part of the code that calls the products is this: public function getContent() { $context = Context::getContext(); $langmod = $context->langmod; $products = ''; $i = 0; foreach (Tools::getValue('categoryBox') as $osque) { $productget = Product::getProducts(Context::getContext()->language->id, 0, 0, 'id_product', 'ASC', $osque, $active = true); $products[$i]['products'] = $productget; $id_lang = Context::getContext()->language->id; $sql = ' SELECT `name` FROM `'._DB_PREFIX_.'category_lang` WHERE `id_category` = '.(int)$osque.' AND `id_lang` = '.(int)$id_lang; $name = Db::getInstance()->getValue($sql); $products[$i]['categorie'] = $name; $i++; } The boolean variable that checks this is: online_only = true online_only = false So i tried modifyng this line of code: $productget = Product::getProducts(Context::getContext()->language->id, 0, 0, 'id_product', 'ASC', $osque, $active = true, $online_only = false); But I get a blank page.. Any help? Thanks for your time Link to comment Share on other sites More sharing options...
z72diego Posted April 15, 2017 Author Share Posted April 15, 2017 (edited) I also tried: $productget = Product::getProducts(Context::getContext()->language->id, 0, 0, 'id_product', 'ASC', $osque, $active = true, $product_props ['online_only'] = false); Didn't work Edited April 15, 2017 by z72diego (see edit history) Link to comment Share on other sites More sharing options...
z72diego Posted April 17, 2017 Author Share Posted April 17, 2017 Any? Link to comment Share on other sites More sharing options...
z72diego Posted April 24, 2017 Author Share Posted April 24, 2017 Upp Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now