Jump to content

Couldn't update product-list.tpl file


Recommended Posts

Hello everyone,

 

I'm fairly new to prestashop so I'm sorry if this question sounds a bit silly.

 

I've been trying to update my product-list.tpl file for the past two hours, but it just doesn't work. The thing is I wanted to add a "SOLD" ribbon to the items that are out of stock. I actually saw another post teaching me how to achieve that here, and I tried that one out hoping it would work. But the thing is after I finished updating my product-list.tpl file and uploaded to my server, everything remains unchanged.

 

At first I thought it was because I did not follow the instructions. But later I changed some existing features in the file just trying to know if it's really updated. The answer is no! I'm so frustrated now and I dont know why it doesn't come to effect after I upload it to the same folder.

 

Also, I did make sure that I was updating the product-list.tpl file inside of the theme I picked for my prestashop. And I'm using prestashop1.5.6.2.

 

Can anybody please help me?? I would really appreciate it if you guys could help me out!! Thank you very much!

 

Billie

Link to comment
Share on other sites

Hello everyone,

 

I'm fairly new to prestashop so I'm sorry if this question sounds a bit silly.

 

I've been trying to update my product-list.tpl file for the past two hours, but it just doesn't work. The thing is I wanted to add a "SOLD" ribbon to the items that are out of stock. I actually saw another post teaching me how to achieve that here, and I tried that one out hoping it would work. But the thing is after I finished updating my product-list.tpl file and uploaded to my server, everything remains unchanged.

 

At first I thought it was because I did not follow the instructions. But later I changed some existing features in the file just trying to know if it's really updated. The answer is no! I'm so frustrated now and I dont know why it doesn't come to effect after I upload it to the same folder.

 

Also, I did make sure that I was updating the product-list.tpl file inside of the theme I picked for my prestashop. And I'm using prestashop1.5.6.2.

 

Can anybody please help me?? I would really appreciate it if you guys could help me out!! Thank you very much!

 

Billie

I want to strengthen this

Link to comment
Share on other sites

back office-->advanced parms-->performance

 

if smarty cache set to 'never compile template files' then changed .tpls will not be seen.  this is fastest ps setting but it can have the affect you described.

 

 

let us know if that is not the case

Link to comment
Share on other sites

back office-->advanced parms-->performance

 

if smarty cache set to 'never compile template files' then changed .tpls will not be seen.  this is fastest ps setting but it can have the affect you described.

 

 

let us know if that is not the case

Hi El,

 

Thank you so much for your reply!!! I checked my smarty setting but it is set to "Recompile templates if the files has been updated". So I don't think it's smarty cache problem. Any other suggestions? Please help me! :unsure:

 

Billie

 

Here's my product-list.tpl:

 

{*
* 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:
* 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 <[email protected]>
*  @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
*}
 
{if isset($products)}
    <!-- Products list -->
    <ul id="product_list" class="product_list block-grid four-up mobile-two-up">
        {foreach from=$products item=product name=products}
        <li class="ajax_block_product {if $smarty.foreach.products.first}first_item{elseif $smarty.foreach.products.last}last_item{/if} {if $smarty.foreach.products.index % 2}alternate_item{else}item{/if} clearfix">
                <a class="product_image" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.name|escape:'htmlall':'UTF-8'}">
   {if $product.new==1}<img src="https://lh4.googleusercontent.com/-jiVQw5-IIPQ/U4MAUS4JzlI/AAAAAAAAAK8/cpOo2V_PDtw/w98-h40-no/logo_s+s.jpg" style="position:absolute; top:-20px; right:0px;" />{/if}
 
 
 
 
                    {if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}
                        <span class="advert 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="advert discount">{l s='Reduced price!'}</span>//i tried to modify this to see if it works, but nothing changed after i upload this to the server
                    {/if}
 
 
 
                    {*{if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}
                        <span class="advert availability">
                            {if ($product.allow_oosp || $product.quantity > 0)}
                                {l s='Available'}
                            {elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}
                                {l s='Product available with different options'}
                            {else}
                                {l s='Out of stock'}
                            {/if}
                        </span>
                    {/if}*}
                    {if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
                        {if isset($product.online_only) && $product.online_only}
                            <span class="advert online_only">{l s='Online only!'}</span>
                        {/if}
                    {/if}
                    <img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'large_default')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} />
                </a>
 
                <h5 class="align_center">
                    {if $product.new == 1}<span class="new">{l s='new'}</span>{/if}
<a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.name|escape:'htmlall':'UTF-8'}">
{$product.name|escape:'htmlall':'UTF-8'|truncate:60:'...'}</a>
                </h5>
 
                <div class="product_price align_center">
                    {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
                        <span class="price">
                            {if !$priceDisplay}
                                {convertPrice price=$product.price}
                            {else}
                                {convertPrice price=$product.price_tax_exc}
                            {/if}
                        </span>
                        {if isset($product.reduction) && $product.reduction && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}
                            <span class="original_price">
                                {convertPrice price=$product.price_without_reduction}
                            </span>
                        {/if}
                    {/if}
                </div>
 
                <div class="align_justify italic product_description_short">
                    {$product.description_short|strip_tags:'UTF-8'|truncate:120:'...'}
                </div>
 
                <div class="add_block">
                    {if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity <= 1 && $product.customizable != 2 && !$PS_CATALOG_MODE}
                        {if ($product.allow_oosp || $product.quantity > 0)}
                            {if isset($static_token)}
                            <a class="button radius ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product.id_product|intval}&token={$static_token}", false)|escape:'html'}" title="{l s='Add to cart'}"><span></span>{l s='Add to cart'}</a>
                            {else}
                            <a class="button radius ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product.id_product|intval}", false)|escape:'html'}" title="{l s='Add to cart'}"><span></span>{l s='Add to cart'}</a>
                            {/if}
                        {else}
                        <span class="exclusive button radius disabled"><span></span>{l s='Add to cart'}</span><br />
                        {/if}
                    {/if}
                    <a class="button lnk_view button radius" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{l s='View'}">{l s='View'}</a>
                </div>
 
                {if isset($comparator_max_item) && $comparator_max_item}
                    <p class="compare">
                        <input type="checkbox" class="comparator" id="comparator_item_{$product.id_product}" value="comparator_item_{$product.id_product}" {if isset($compareProducts) && in_array($product.id_product, $compareProducts)}checked="checked"{/if} autocomplete="off"/>
                        <label for="comparator_item_{$product.id_product}">{l s='Select to compare'}</label>
                    </p>
                {/if}
            </li>
        {/foreach}
    </ul>
    <!-- /Products list -->
{/if}
Link to comment
Share on other sites

note that this option not always works well.

turn FORCE COMPILE and TURN OFF CACHE

then try again.

Hi Vekia,

 

Thank you for your help. I tried your suggestion but it doesnt work either. Would you please take a look at my code?

 

I saw your post here(http://www.prestashop.com/forums/topic/249939-solved-display-sold-ribbon-over-the-product-image-when-item-no-longer-available/) on how to add a "SOLD" ribbon on items that are sold out. But it doesnt work. I'm not sure if it's because I did not put the if statement at the right place or there's something wrong with my site. But one thing strange enough is that even though I delete the product_list.tpl file from my server the site still works as normal, which is rather strange! 

 

Here's the link to my site(http://www.meteor.com.hk/shop/en/), and here's the product_list.tpl file:

 

 {*

* 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:
* 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 <[email protected]>
*  @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
*}
 
{if isset($products)}
    <!-- Products list -->
    <ul id="product_list" class="product_list block-grid four-up mobile-two-up">
        {foreach from=$products item=product name=products}
        <li class="ajax_block_product {if $smarty.foreach.products.first}first_item{elseif $smarty.foreach.products.last}last_item{/if} {if $smarty.foreach.products.index % 2}alternate_item{else}item{/if} clearfix">
                <a class="product_image" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.name|escape:'htmlall':'UTF-8'}">
 
   {if $product.new==1}<img src="https://lh4.googleusercontent.com/-jiVQw5-IIPQ/U4MAUS4JzlI/AAAAAAAAAK8/cpOo2V_PDtw/w98-h40-no/logo_s+s.jpg" style="position:absolute; top:-20px; right:0px;" />{/if}
 
 
 
 
                    {if isset($product.on_sale) && $product.on_sale && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}
                        <span class="advert 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="advert discount">{l s='Reduced price!'}</span>
                    {/if}
                    {if isset($product.available_for_order) && $product.available_for_order && !isset($restricted_country_mode)}
                        <span class="advert availability">
                            {if ($product.allow_oosp || $product.quantity > 0)}
                                {l s='Available'}
                            {elseif (isset($product.quantity_all_versions) && $product.quantity_all_versions > 0)}
                                {l s='Product available with different options'}
                            {else}
                                {l s='Out of stock'}
                            {/if}
                        </span>
                    {/if}
                    {if (!$PS_CATALOG_MODE AND ((isset($product.show_price) && $product.show_price) || (isset($product.available_for_order) && $product.available_for_order)))}
                        {if isset($product.online_only) && $product.online_only}
                            <span class="advert online_only">{l s='Online only!'}</span>
                        {/if}
                    {/if}
                    <img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'large_default')}" alt="{$product.legend|escape:'htmlall':'UTF-8'}" {if isset($homeSize)} width="{$homeSize.width}" height="{$homeSize.height}"{/if} />
                </a>
 
                <h5 class="align_center">
                    {if $product.new == 1}<span class="new">{l s='new'}</span>{/if}
<a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.name|escape:'htmlall':'UTF-8'}">
{$product.name|escape:'htmlall':'UTF-8'|truncate:60:'...'}</a>
                </h5>
 
                <div class="product_price align_center">
                    {if isset($product.show_price) && $product.show_price && !isset($restricted_country_mode)}
                        <span class="price">
                            {if !$priceDisplay}
                                {convertPrice price=$product.price}
                            {else}
                                {convertPrice price=$product.price_tax_exc}
                            {/if}
                        </span>
                        {if isset($product.reduction) && $product.reduction && isset($product.show_price) && $product.show_price && !$PS_CATALOG_MODE}
                            <span class="original_price">
                                {convertPrice price=$product.price_without_reduction}
                            </span>
                        {/if}
                    {/if}
                </div>
 
                <div class="align_justify italic product_description_short">
                    {$product.description_short|strip_tags:'UTF-8'|truncate:120:'...'}
                </div>
 
                <div class="add_block">
                    {if ($product.id_product_attribute == 0 || (isset($add_prod_display) && ($add_prod_display == 1))) && $product.available_for_order && !isset($restricted_country_mode) && $product.minimal_quantity <= 1 && $product.customizable != 2 && !$PS_CATALOG_MODE}
                        {if ($product.allow_oosp || $product.quantity > 0)}
                            {if isset($static_token)}
                            <a class="button radius ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product.id_product|intval}&token={$static_token}", false)|escape:'html'}" title="{l s='Add to cart'}"><span></span>{l s='Add to cart'}</a>
                            {else}
                            <a class="button radius ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add=1&id_product={$product.id_product|intval}", false)|escape:'html'}" title="{l s='Add to cart'}"><span></span>{l s='Add to cart'}</a>
                            {/if}
                        {else}
                        <span class="exclusive button radius disabled"><span></span>{l s='Add to cart'}</span><br />
                        {/if}
                    {/if}
                    <a class="button lnk_view button radius" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{l s='View'}">{l s='View'}</a>
                </div>
 
                {if isset($comparator_max_item) && $comparator_max_item}
                    <p class="compare">
                        <input type="checkbox" class="comparator" id="comparator_item_{$product.id_product}" value="comparator_item_{$product.id_product}" {if isset($compareProducts) && in_array($product.id_product, $compareProducts)}checked="checked"{/if} autocomplete="off"/>
                        <label for="comparator_item_{$product.id_product}">{l s='Select to compare'}</label>
                    </p>
                {/if}
            </li>
        {/foreach}
    </ul>
    <!-- /Products list -->
{/if}

 

 

Thank you so much and I look forward to your reply!

 

Cheers

Billie

Link to comment
Share on other sites

  • 1 month later...

then make sure you are changing the correct file. themes/yourtheme/product-list.tpl file.

 

there is nothing wrong with smarty cache, if there was all hell would break out.  :)

 

please make sure to post the path to the file because that is the only logical reason...or put something incorrect in file and make the page blank to see if executing.  

Link to comment
Share on other sites

Thanks El Patron for your reply!

 

yes, am sure, file was correct: /themes/my_theme/product_list.tpl
 

Somehow, i really don't know how, my changes bacame visible. After repeatedly cleaning browsers cache, setting "always compile" and turning cache off, i think that clearing cache made a difference.

If I am right, it's pretty stupid that you have to hit "clear cache" in prestashop even after you set cache off. 
 

Thanks for your help!! I will not set this topic as solved, becouse original problem posted by billieluxu has not been solved. Also, sorry for any language mistakes :) 

Link to comment
Share on other sites

  • 7 months later...
×
×
  • Create New...