Jump to content

How to show discount icon products on Homepage


Recommended Posts

Hi everyone

 

1.

Can someone tell me "how to show discount icon products on Homepage", I done this on product-list but in homepage it is not work

 

prestashop: 1.5.6.1

 

code in use:


<!-- MODULE Specials / Discount Product home / center column -->
<div id="featured-SpecialsProducts_block_center" class="block products_block">
<h4>{l s='Promocje' mod='SpecialsCenter'}</h4>
{if isset($SpecialsCenter) AND $SpecialsCenter}
	<div class="block_content">
			{assign var='liHeight' value=250}
			{assign var='nbItemsPerLine' value=4}
			{assign var='nbLi' value=$SpecialsCenter|@count}
			{assign var='nbLines' value=$nbLi/$nbItemsPerLine|ceil}
			{assign var='ulHeight' value=$nbLines*$liHeight}
		<ul style="height:{$ulHeight}px;">
		{foreach from=$SpecialsCenter item=Specials name=homeSpecialsCenter}
		<li class="ajax_block_product {if $smarty.foreach.homeSpecialsCenter.first}first_item{elseif $smarty.foreach.homeSpecialsCenter.last}last_item{else}item{/if} {if $smarty.foreach.homeSpecialsCenter.iteration%$nbItemsPerLine == 0}last_item_of_line{elseif $smarty.foreach.homeSpecialsCenter.iteration%$nbItemsPerLine == 1}clear{/if} {if $smarty.foreach.homeSpecialsCenter.iteration > ($smarty.foreach.homeSpecialsCenter.total - ($smarty.foreach.homeSpecialsCenter.total % $nbItemsPerLine))}last_line{/if}">
		
<div class="denumire_produs"><div style='display: block; height: 60px; width:120px'>

			<h5><a href="{$Specials.link}" title="{$Specials.name|truncate:100:'...'|escape:'htmlall':'UTF-8'}">{$Specials.name|truncate:100:'...'|escape:'htmlall':'UTF-8'}</a></h5></div>



<!-- this code is add and dont work: icon discount on products homepage -->
<div style='width: 100px; height: 30px;'>
{if isset($product.reduction) && $product.reduction && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}
<span class="discount_badge">
{l s='discount!'}
</span>
{/if}
</div>
<!-- icon discount on products:  end -->



			
<center>
			<a href="{$Specials.link}" title="{$Specials.name|escape:html:'UTF-8'}" class="product_image"><img src="{$link->getImageLink($Specials.link_rewrite, $Specials.id_image, 'home_default')}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$Specials.name|escape:html:'UTF-8'}" /></a></center>
				
				<p class="price_container">

 <center><font style="font-size: 12px; color: black;"> <b>
				<span class="price-discount">{if !$priceDisplay}{displayWtPrice p=$Specials.price_without_reduction}{else}{displayWtPrice p=$priceWithoutReduction_tax_excl}{/if}</b></font></center></span>
    			{if $Specials.specific_prices}
        			{assign var='specific_prices' value=$Specials.specific_prices}
				<center><span <center> <font style="font-size: 14px; color: #990000;"><b>Pret redus</b><center></span></center><b>
        			{if $specific_prices.reduction_type == 'percentage' && ($specific_prices.from == $specific_prices.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $specific_prices.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $specific_prices.from))}
	        			<span class="reduction">(-{$specific_prices.reduction * 100|floatval}%)</span></b>
	            	{/if}
	            {/if}

				<span class="price">{if !$priceDisplay}{displayWtPrice p=$Specials.price}{else}{displayWtPrice p=$Specials.price_tax_exc}{/if}</span></p>
<font style="font-size: 12px; color: black;">
				<a class="button" href="{$Specials.link}" title="{l s='Vizualizare' mod='SpecialsCenter'}">{l s='Vizualizare' mod='SpecialsCenter'}</a>
						{if ($Specials.quantity > 0 OR $Specials.allow_oosp) AND $Specials.customizable != 2}
						<a class="exclusive ajax_add_to_cart_button" rel="ajax_id_product_{$Specials.id_product}" href="{$base_dir}cart.php?qty=1&id_product={$Specials.id_product}&token={$static_token}&add" title="{l s='Adauga in cos' mod='SpecialsCenter'}">{l s='Adauga in cos' mod='SpecialsCenter'}</a>
						{else}
						<span class="exclusive">{l s='Adauga in cos' mod='SpecialsCenter'}</span>
						{/if}
			</li>
			{/foreach}
		</ul>
		
{else}
		<p>{l s='No specials at this time' mod='SpecialsCenter'}</p>
{/if}
	</div>
</div>
<!-- /MODULE Home Featured Products -->

What im doing wrong ?

 

2. Second problem: how to make checkbox same like "on sale" but when he is selected, show different icon on product-list example: "eco"

Edited by haniwald (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...