Hi guys,
I have a little problem. I need get the products from array of categories. These was saved with a helper tree form.
Then, i did this:
public function getProducts()
{
$categories = unserialize(Configuration::get('EXAMPLE_CATEGORIES'));
$output = array();
foreach ($categories as $id_category) {
$category = new Category($id_category, $this->context->language->id);
$products = $category->getProducts($this->context->language->id, 0, 10000);
$output = array_merge($output, $products);
}
return $output;
}
This works but this return duplicate products, because some products exist in several different categories or parent/child. Have an idea or be better with an sql query?
Sorry for my English.
Please, help me!
Thanks.