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

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

×

Important Information

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