Jump to content

Edit History

Manu-41

Manu-41

5 hours ago, doekia said:
{capture name="sql"}
  SELECT c2.id_category
  FROM `{$smarty.const._DB_PREFIX_}category` c
  INNER JOIN `{$smarty.const._DB_PREFIX_}category` c2 ON c2.id_parent = c.id_parent
  WHERE c.id_category = {$product->id_category_default|intval}
  ORDER BY c2.nleft
{/capture}
<ul>
{foreach Db::getInstance()->executeS($smarty.capture.sql) as $category_siblings}
   {if $category_siblings.id_category != $product->id_category_default}
  <li> .... </li>
   {/if}
{/foreach}
</ul>

Testé et fonctionelle

Ca avance, les ID de catégories s'affichent bien. Comment afficher le mon de ces catégories avec l'id?

	{capture name="sql"}
  SELECT c2.id_category
  FROM `{$smarty.const._DB_PREFIX_}category` c
  INNER JOIN `{$smarty.const._DB_PREFIX_}category` c2 ON c2.id_parent = c.id_parent
  WHERE c.id_category = {$product->id_category_default|intval}
  ORDER BY c2.nleft
{/capture}
<ul>
{foreach Db::getInstance()->executeS($smarty.capture.sql) as $category_siblings}
   {if $category_siblings.id_category != $product->id_category_default}
  <li> <a href="{$link->getCategoryLink($category_siblings.id_category)}">???</a> </li>
   {/if}
{/foreach}
</ul>

 

Manu-41

Manu-41

4 hours ago, doekia said:
{capture name="sql"}
  SELECT c2.id_category
  FROM `{$smarty.const._DB_PREFIX_}category` c
  INNER JOIN `{$smarty.const._DB_PREFIX_}category` c2 ON c2.id_parent = c.id_parent
  WHERE c.id_category = {$product->id_category_default|intval}
  ORDER BY c2.nleft
{/capture}
<ul>
{foreach Db::getInstance()->executeS($smarty.capture.sql) as $category_siblings}
   {if $category_siblings.id_category != $product->id_category_default}
  <li> .... </li>
   {/if}
{/foreach}
</ul>

Testé et fonctionelle

Ca avance, les ID de catégories s'affichent bien. Comment afficher le mon de ces catégories avec l'id?

	{capture name="sql"}
  SELECT c2.id_category
  FROM `{$smarty.const._DB_PREFIX_}category` c
  INNER JOIN `{$smarty.const._DB_PREFIX_}category` c2 ON c2.id_parent = c.id_parent
  WHERE c.id_category = {$product->id_category_default|intval}
  ORDER BY c2.nleft
{/capture}
<ul>
{foreach Db::getInstance()->executeS($smarty.capture.sql) as $category_siblings}
   {if $category_siblings.id_category != $product->id_category_default}
  <li class="hidden"> {$category_siblings.id_category} </li>
   {/if}
{/foreach}
</ul>

 

×
×
  • Create New...