Alldo Group Posted November 11, 2013 Share Posted November 11, 2013 Hi! How do I use this array to filter out products from a certain product category only? $productArray = Product::getProducts($this->_currLID, 0, NULL, 'id_product', 'ASC'); Thanks in advance! Link to comment Share on other sites More sharing options...
AndriusS Posted November 11, 2013 Share Posted November 11, 2013 (edited) Hey. Well, the getProducts() method has a parameter that lets you choose the category: public static function getProducts($id_lang, $start, $limit, $order_by, $order_way, $id_category = false, $only_active = false, Context $context = null) You can see the $id_category. P.S. This is PS 1.5.6.0. You should check your own Product class to see if yours has this. Edited November 11, 2013 by AndriusS (see edit history) 1 Link to comment Share on other sites More sharing options...
Alldo Group Posted November 11, 2013 Author Share Posted November 11, 2013 Thanks AndriusS! Can't seem to find the public static function in the script. I'm running a 1.4.x. The only reference i've got in the script is: $productArray = Product::getProducts($this->_currLID, 0, NULL, 'id_product', 'ASC'); Isn't it possible to change the line above? Do I need to find the "public static function" and then make the changes there? The script is from a module that makes a feed for Google Merchant. Thanks! Link to comment Share on other sites More sharing options...
AndriusS Posted November 11, 2013 Share Posted November 11, 2013 Well, you need to find the function in the Product class because that's where it is called from. As I'm looking here, which might be the correct place to look for older code, it seems to have the getProducts method that I have mentioned (at 779 line). So you should just be able to change $productArray = Product::getProducts($this->_currLID, 0, NULL, 'id_product', 'ASC'); to $productArray = Product::getProducts($this->_currLID, 0, NULL, 'id_product', 'ASC', $THIS_IS_THE_CAT_IM_LOOKING_FOR); 1 Link to comment Share on other sites More sharing options...
Alldo Group Posted November 11, 2013 Author Share Posted November 11, 2013 (edited) Works like a charm, you're brilliant! Edited November 11, 2013 by Alldo Group (see edit history) 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