hyperlink - link to products belonging to more than one category in prestashop? -


ive got category structure this:

category 1

  • category 2

  • category 3

category 4

  • category 5

  • category 6

category 7

category 8

and wanna show products belong category 8 , category 3. category 8 not child of 3.

how can it? how (first of all) can build relative link?

you have several ways achieve this, in terms of performance depends on size of catalog.

here example written in sql fast , make sure selected products active:

$products_categories = db::getinstance()->executes(' select cp.id_product, pl.name product_name '._db_prefix_.'category_product cp left join '._db_prefix_.'category c on (c.id_category = cp.id_category) left join '._db_prefix_.'product p on (p.id_product = cp.id_product) left join '._db_prefix_.'product_lang pl on (pl.id_product = p.id_product) cp.id_category = 3 , p.active = 1 , c.active = 1 , pl.id_lang = 1 , cp.id_product in (select id_product '._db_prefix_.'category_product id_category = 8)'); 

Comments