Jump to content

Product list: show only products available_for_order


DARKF3D3

Recommended Posts

I try to do that i modified the foreach cicle in product-list.tpl file, from:

	{foreach from=$products item=product name=products}
		{math equation...
		...
		...
		...
		</li>
	{/foreach}

To:

	{foreach from=$products item=product name=products}
	{if isset($product.available_for_order) && $product.available_for_order}
		{math equation...
		...
		...
		...
		</li>
	{/if}
	{/foreach}

As you can see I added the {if ...} into the foreach cicle.

This partially works, in fact now products that from B.O. is not checked as "available for order" are not showed.

But the problem is that this create problem with products grid, infact the lines where's there was a product not available for order now are uncomplete.

For example if i have line with 4 products, when theres one not ordinable product, there's only 3 products per line.

Link to comment
Share on other sites

Hi!

This happens because it uses index to determine when to go next line, so I would use a custom variable instead, like assign var=currentiteration value=$smarty.foreach.products.index

Or the one it uses to assign the last element's class, which I currently forgot :D

Link to comment
Share on other sites

I'm thinking that maybe the best is to customizing directly the query involved il product list, because with my method on tpl file the product not showed are decreased from the total of products showed per page.

So if i chose to show max 20 product per page, this number decreases based on products not available for order, so i'll have page with different product quantity showed.

Link to comment
Share on other sites

×
×
  • Create New...