Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>While I was solving problem in one of my clients project. I also want to show all images on product list page.</p> <p>I used code answered by @Ravi Kumar, and worked with assigned $images variable in template file like this </p> <pre><code>&lt;ul id="thumbs_list_frame"&gt; {if isset($images[$product.id_product])} {foreach from=$images[$product.id_product] item=image name=thumbnails} {assign var=imageIds value="`$product.id_product`-`$image.id_image`"} &lt;li id="thumbnail_{$image.id_image}"&gt; &lt;img id="thumb_{$image.id_image}" src="{$link-&gt;getImageLink($product.link_rewrite, $imageIds, 'large_default')}" alt="{$image.legend|htmlspecialchars}" alt="" title="{$product-&gt;name|escape:'htmlall':'UTF-8'}" width="{$largeSize.width}" height="{$largeSize.height}" /&gt; &lt;/li&gt; {/foreach} {/if} &lt;/ul&gt; </code></pre> <p>below I am writing my function written in categoryController.php file</p> <pre><code>/** * Assign list of products template vars */ public function assignProductList() { $hookExecuted = false; Hook::exec('actionProductListOverride', array( 'nbProducts' =&gt; &amp;$this-&gt;nbProducts, 'catProducts' =&gt; &amp;$this-&gt;cat_products, 'hookExecuted' =&gt; &amp;$hookExecuted, )); // The hook was not executed, standard working if (!$hookExecuted) { $this-&gt;context-&gt;smarty-&gt;assign('categoryNameComplement', ''); $this-&gt;nbProducts = $this-&gt;category-&gt;getProducts(null, null, null, $this-&gt;orderBy, $this-&gt;orderWay, true); $this-&gt;pagination((int)$this-&gt;nbProducts); // Pagination must be call after "getProducts" $this-&gt;cat_products = $this-&gt;category-&gt;getProducts($this-&gt;context-&gt;language-&gt;id, (int)$this-&gt;p, (int)$this-&gt;n, $this-&gt;orderBy, $this-&gt;orderWay); } // Hook executed, use the override else // Pagination must be call after "getProducts" $this-&gt;pagination($this-&gt;nbProducts); $productImages = array(); $newImages = array(); foreach ($this-&gt;cat_products as &amp;$product) { if ($product['id_product_attribute'] &amp;&amp; isset($product['product_attribute_minimal_quantity'])) $product['minimal_quantity'] = $product['product_attribute_minimal_quantity']; $new_product = new ProductCore($product['id_product']); $images = $new_product-&gt;getImages((int)self::$cookie-&gt;id_lang); foreach ($images AS $k =&gt; $image) { $productImages[(int)$image['id_image']] = $image; } $newImages[$product['id_product']] = $productImages; $productImages = null; $new_product = null; } if (count($newImages)) self::$smarty-&gt;assign('images', $newImages); $this-&gt;context-&gt;smarty-&gt;assign('nb_products', $this-&gt;nbProducts); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload