Jump to content

Display ( on sale) At home feature products


Recommended Posts

hi

im using 1.4.5 Prestashop. i need to display the word (on sale) at home feature product. from the back office the product is on sale . and i can see on sale when i m watching this product on category. its showing fine. but i also want that people are see on sale at the home feature products.

 

thanks

Link to comment
Share on other sites

One way would be to add that attribute on the homefeautured.tpl file which displays the products on the homepage. Am not sure of the exact way the on sale variable is initialised in prestashop but you should be able to view this in product.tpl file. That is if you really want to do it this way. Then the homefeatured.tpl is a module file so it will be in the modules directory. To overide it edit the tpl file in the themes/your-theme/modules directory.

 

I hope that sheds some light. Am not aware of available setting for that - unless somebody has extended the official module for home featured products.

Link to comment
Share on other sites

  • 2 weeks later...

Same here comzemadrid - can anyone help? I'm using 1.5.3

 

I looked at the code for the "on sale" section in product-list.tpl, but I'm no coder so I have no idea what to include exactly. Like a newb, I tried pasting the following code into the right spot on homefeatured.tpl but of course it didn't work:

 

<p class="price_container">
{if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}<span class="on_sale">{l s='On sale!'}</span>
{elseif isset($product.reduction) && $product.reduction && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}<span class="discount">{l s='Reduced price!'}</span>{/if}

 

Still, I'm sure it must be something close to that. Can anyone suggest anything?

Link to comment
Share on other sites

  • 2 months later...
  • 1 year later...

Try to use this snippet from product-list.tpl

{if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}<span class="on_sale">{l s='On sale!'}</span>
{elseif isset($product.reduction) && $product.reduction && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}<span class="discount">{l s='Reduced price!'}</span>{/if}

in /themes/your_theme/modules/homefeatured/homefeatured.tpl.

Link to comment
Share on other sites

Hi Thanks for your help.

 

I tried but no luck I am afraid.  

 

Here is the content of the actual file homefeatured.tpl just in case you think of anything else.

 

{* * 2007-2013 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA * @copyright 2007-2013 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} {l s='Featured products' mod='homefeatured'}
 
{if isset($products) AND $products} {assign var='liHeight' value=250} {assign var='nbItemsPerLine' value=4} {assign var='nbLi' value=$products|@count} {math equation="nbLi/nbItemsPerLine" nbLi=$nbLi nbItemsPerLine=$nbItemsPerLine assign=nbLines} {math equation="nbLines*liHeight" nbLines=$nbLines|ceil liHeight=$liHeight assign=ulHeight} 
 
 
 
{foreach from=$products item=product name=homeFeaturedProducts} {math equation="(total%perLine)" total=$smarty.foreach.homeFeaturedProducts.total perLine=$nbItemsPerLine assign=totModulo} {if $totModulo == 0}{assign var='totModulo' value=$nbItemsPerLine}{/if} 
 
{if isset($product.new) && $product.new == 1}{l s='New' mod='homefeatured'}{/if} {$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'}
 
{$product.description_short|strip_tags|truncate:65:'...'}
 
{l s='View' mod='homefeatured'} {if $product.show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}{if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if}
 
{else}
 
{/if} {if ($product.id_product_attribute == 0 OR (isset($add_prod_display) AND ($add_prod_display == 1))) AND $product.available_for_order AND !isset($restricted_country_mode) AND $product.minimal_quantity == 1 AND $product.customizable != 2 AND !$PS_CATALOG_MODE} {if ($product.quantity > 0 OR $product.allow_oosp)} {l s='Add to cart' mod='homefeatured'} {else} {l s='Add to cart' mod='homefeatured'} {/if} {else} 
 
{/if} 
 
 
 
{/foreach} 
 
 
 
{else} {l s='No featured products' mod='homefeatured'}
 
{/if} 
Link to comment
Share on other sites

×
×
  • Create New...