Jump to content
Sign in to follow this  
Nsfr750

[SOLVED] Problem with homefeatured on PS 1.3.7

Recommended Posts

I've modded the homefeatured.tpl to show pice before discount and percentage of discount
but I not know hot to disply price without tax

the final price is withouth tax

<!-- MODULE Home Featured Products -->

{l s='Featured products' mod='homefeatured'}
   {if isset($products) AND $products}

           {assign var='liHeight' value=342}
           {assign var='nbItemsPerLine' value=4}
           {assign var='nbLi' value=$products|@count}
           {assign var='nbLines' value=$nbLi/$nbItemsPerLine|ceil}
           {assign var='ulHeight' value=$nbLines*$liHeight}

           {foreach from=$products item=product name=homeFeaturedProducts}

{$product.name|truncate:27:'...'|escape:'htmlall':'UTF-8'}

{$product.description_short|strip_tags|truncate:130:'...'}
getImageLink($product.link_rewrite, $product.id_image, 'home')}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$product.name|escape:html:'UTF-8'}" />

                     {if $product.on_sale} 
                       {if $product.reduction_percent}
{displayWtPrice p=$product.price_without_reduction}                    
(-{$product.reduction_percent}%)
                       {elseif $product.reduction_price}
{displayWtPrice p=$product.price_without_reduction}                    
(-{$product.reduction_price}€)
                       {/if}                         
                     {elseif ($product.reduction_price != 0 || $product.reduction_percent != 0) && ($product.reduction_from == $product.reduction_to OR ($smarty.now|date_format:'%Y-%m-%d' <= $product.reduction_to && $smarty.now|date_format:'%Y-%m-%d' >= $product.reduction_from))} 
                       {if $product.reduction_percent}
{displayWtPrice p=$product.price_without_reduction}                    
(-{$product.reduction_percent}%)
                       {elseif $product.reduction_price}
{displayWtPrice p=$product.price_without_reduction}                    
(-{$product.reduction_price}€)
                       {/if}  
                     {/if} 

{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}
{l s='View' mod='homefeatured'}
                     {if ($product.quantity > 0 OR $product.allow_oosp) AND $product.customizable != 2}
{l s='Add to cart' mod='homefeatured'}
                     {else}

{l s='Add to cart' mod='homefeatured'}
                     {/if}


           {/foreach}


   {else}

{l s='No featured products' mod='homefeatured'}
   {/if}

<!-- /MODULE Home Featured Products -->



how to modify my code to show the correct price (without tax) ?

thanks,

Share this post


Link to post
Share on other sites

Solved, see code


           {if $product.on_sale} 
             {assign var='oldprice' value=$product.price_without_reduction/1.2} <--- 1.2 is VAT 20%
             {if $product.reduction_percent}
{displayWtPrice p=$oldprice}                    
(-{$product.reduction_percent}%)
             {elseif $product.reduction_price}
{displayWtPrice p=$oldprice}                    
(-{$product.reduction_price}€)
             {/if}             
           {elseif ($product.reduction_price != 0 || $product.reduction_percent != 0) && ($product.reduction_from == $product.reduction_to OR ($smarty.now|date_format:'%Y-%m-%d' <= $product.reduction_to && $smarty.now|date_format:'%Y-%m-%d' >= $product.reduction_from))} 
             {if $product.reduction_percent}
{displayWtPrice p=$oldprice}                    
(-{$product.reduction_percent}%)
             {elseif $product.reduction_price}
{displayWtPrice p=$oldprice}                    
(-{$product.reduction_price}€)
             {/if}   
           {/if} 

{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}
{l s='View' mod='homefeatured'}
           {if ($product.quantity > 0 OR $product.allow_oosp) AND $product.customizable != 2}
{l s='Add to cart' mod='homefeatured'}
           {else}

{l s='Add to cart' mod='homefeatured'}
           {/if}


Share this post


Link to post
Share on other sites
How about displaying the n% discount next to the price?

 

work only on version 1.3.7.0

 

see following code:

 

<!-- MODULE Home Featured Products -->
<div id="featured-products_block_center" class="block products_block">
<h4>{l s='Featured products' mod='homefeatured'}</h4>
{if isset($products) AND $products}
 <div class="block_content">
  {assign var='liHeight' value=342}
  {assign var='nbItemsPerLine' value=4}
  {assign var='nbLi' value=$products|@count}
  {assign var='nbLines' value=$nbLi/$nbItemsPerLine|ceil}
  {assign var='ulHeight' value=$nbLines*$liHeight}
  <ul style="height:{$ulHeight}px;">
  {foreach from=$products item=product name=homeFeaturedProducts}
   <li class="ajax_block_product {if $smarty.foreach.homeFeaturedProducts.first}first_item{elseif $smarty.foreach.homeFeaturedProducts.last}last_item{else}item{/if} {if $smarty.foreach.homeFeaturedProducts.iteration%$nbItemsPerLine == 0}last_item_of_line{elseif $smarty.foreach.homeFeaturedProducts.iteration%$nbItemsPerLine == 1}clear{/if} {if $smarty.foreach.homeFeaturedProducts.iteration > ($smarty.foreach.homeFeaturedProducts.total - ($smarty.foreach.homeFeaturedProducts.total % $nbItemsPerLine))}last_line{/if}">
 <h5><a href="{$product.link}" title="{$product.name|truncate:32:'...'|escape:'htmlall':'UTF-8'}">{$product.name|truncate:27:'...'|escape:'htmlall':'UTF-8'}</a></h5>
 <p class="product_desc"><a href="{$product.link}" title="{l s='More' mod='homefeatured'}">{$product.description_short|strip_tags|truncate:130:'...'}</a></p>
 <a href="{$product.link}" title="{$product.name|escape:html:'UTF-8'}" class="product_image"><img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home')}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$product.name|escape:html:'UTF-8'}" /></a>
 <div>
				  {if $product.on_sale}
  {if $product.reduction_percent}
   <div class="price-discount">{displayWtPrice p=$product.price_without_reduction}</div>				   
   <div class="reduction">(-{$product.reduction_percent}%)</div>
  {elseif $product.reduction_price}
   <div class="price-discount">{displayWtPrice p=$product.price_without_reduction}</div>				   
   <div class="reduction">(-{$product.reduction_price}€)
  </div>{/if}	  
   {elseif ($product.reduction_price != 0 || $product.reduction_percent != 0) && ($product.reduction_from == $product.reduction_to OR ($smarty.now|date_format:'%Y-%m-%d' <= $product.reduction_to && $smarty.now|date_format:'%Y-%m-%d' >= $product.reduction_from))}
  {if $product.reduction_percent}
   <div class="price-discount">{displayWtPrice p=$product.price_without_reduction}</div>				   
   <div class="reduction">(-{$product.reduction_percent}%)</div>
  {elseif $product.reduction_price}
   <div class="price-discount">{displayWtPrice p=$product.price_without_reduction}</div>				   
   <div class="reduction">(-{$product.reduction_price}€)
  </div>{/if}  
   {/if}
				  <p class="price_container"><span class="price">{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}</span></p>
   <a class="button" href="{$product.link}" title="{l s='View' mod='homefeatured'}">{l s='View' mod='homefeatured'}</a>
   {if ($product.quantity > 0 OR $product.allow_oosp) AND $product.customizable != 2}
  <a class="exclusive ajax_add_to_cart_button" rel="ajax_id_product_{$product.id_product}" href="{$base_dir}cart.php?qty=1&id_product={$product.id_product}&token={$static_token}&add" title="{l s='Add to cart' mod='homefeatured'}">{l s='Add to cart' mod='homefeatured'}</a>
   {else}
  <span class="exclusive"><p>{l s='Add to cart' mod='homefeatured'}</p></span>
   {/if}
 </div>
   </li>
  {/foreach}
  </ul>
 </div>
{else}
 <p>{l s='No featured products' mod='homefeatured'}</p>
{/if}
</div>
<!-- /MODULE Home Featured Products -->

Share this post


Link to post
Share on other sites

Hi Nsfr750,

 

Can you please provide me the code for version 1.4.7.0?

 

Regards,

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

×
×
  • Create New...

Important Information

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