Jump to content
FilipBlahout

Výpis kategoríí

Recommended Posts

Dobrý den,

 

vypisuji si kategorie v bloku kategorií podle:

  $id_customer = (int)$params['cookie']->id_customer;
  $id_group = $id_customer ? Customer::getDefaultGroupId($id_customer) : _PS_DEFAULT_CUSTOMER_GROUP_;
  $id_lang = (int)$params['cookie']->id_lang;
  $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
  SELECT c.*, cl.*
  FROM `'._DB_PREFIX_.'category` c
  LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = '.$id_lang.')
  LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = c.`id_category`)
  WHERE level_depth > 2 And level_depth < 4 AND id_parent = 425
  AND c.`active` = 1
  AND cg.`id_group` = '.$id_group.'
  ORDER BY `level_depth` ASC, c.`position` ASC');
  $category = new Category(1);
  $nb = intval(Configuration::get('HOME_categories_NBR'));

Nyní jsem nastavil multistore, na nový shop převedl vše, včetně stromu kategorií.

 

Blok kategorií však nyný zobrazuje veškeré kategorie 2x. Nedaří se mí kod ošetřit tak, aby to zobrazovalo vždy ty kategorie jen jednou, pro daný shop.

 

Budu rád za nasměřování.

 

Díky

Share this post


Link to post
Share on other sites

Vyřešeno:

  LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = '.(int)$this->context->language->id.Shop::addSqlRestrictionOnLang('cl').')
  LEFT JOIN `'._DB_PREFIX_.'category_shop` cs ON (cs.`id_category` = c.`id_category` AND cs.`id_shop` = '.(int)$this->context->shop->id.')
  LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = c.`id_category`) 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More