Jump to content

$productArray = Product::getProducts from a certain catogory

Alldo Group

Recommended Posts



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 You should check your own Product class to see if yours has this.

Edited by AndriusS (see edit history)
  • Like 1
Link to comment
Share on other sites

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.




Link to comment
Share on other sites

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');


$productArray = Product::getProducts($this->_currLID, 0, NULL, 'id_product', 'ASC', $THIS_IS_THE_CAT_IM_LOOKING_FOR);
  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...