molino24 Posted October 16, 2010 Share Posted October 16, 2010 Hello everybody!I tried to search about this in the forum and I found a few topics about how to remove these (cart, prices, quantity) from product-list.tpl and product.tpl but the problem that these solutions are modify the whole categories and products. I just would like to do this at one category only (all products in this category) because these are not order-able products. And I have normal order-able products also in the same shop. This is why I need the both solution in one shop.I know that I must modify the product.tpl and product-list-tpl but I don't know how. Thanks in advance!Best regards,Zsombor Link to comment Share on other sites More sharing options...
rocky Posted October 16, 2010 Share Posted October 16, 2010 PrestaShop v1.4 lets you remove the price and add to cart buttons on a per-product basis (see the screenshot here). Until it is released, you will need to modify code. Change lines 17-25 of product-list.tpl from: {if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if} {if ($product.allow_oosp OR $product.quantity > 0)}{l s='Available'}{else}{l s='Out of stock'}{/if} {if ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2} {l s='Add to cart'} {else} {l s='Add to cart'} {/if} to: {if $smarty.get.id_category != 3} {if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if} {/if} {if ($product.allow_oosp OR $product.quantity > 0)}{l s='Available'}{else}{l s='Out of stock'}{/if} {if $smarty.get.id_category != 3 && ($product.allow_oosp OR $product.quantity > 0) && $product.customizable != 2} {l s='Add to cart'} {else} {l s='Add to cart'} {/if} Change both 3 to the ID of the category you don't want the price or add to cart button displayed. Link to comment Share on other sites More sharing options...
molino24 Posted October 16, 2010 Author Share Posted October 16, 2010 Dear Rocky!Thanks your help! I can solved it in the product list, but I still need this solution on the product page also. I tired, but I made just half solution yet. I can't delete the prices.If you have a few more minutes, please write how can I remove the marked area (attached photo) from one category.Thanks!!Best regards,Zsombor Link to comment Share on other sites More sharing options...
rocky Posted October 17, 2010 Share Posted October 17, 2010 Add the following before line 176 (the <!-- add to cart form--> line) of product.tpl: {if $product->id_category_default != 3} and the following after line 323 (the </form> line): {/if} This will hide the block if the default category of the product is 3. Change that ID as necessary. Link to comment Share on other sites More sharing options...
molino24 Posted October 17, 2010 Author Share Posted October 17, 2010 Hi,It's OK, all right now. Thanks your support! Link to comment Share on other sites More sharing options...
Jonidfld Posted December 10, 2010 Share Posted December 10, 2010 Add the following before line 176 (the <!-- add to cart form--> line) of product.tpl: {if $product->id_category_default != 3} ...i know rocky is on holidays, but in the meantime anyone able to help with changing this code so that it hides the stuff in between for more than one category?ie instead of just category 3, it hides it from category 3, 4, 5 for example.Thanks in advance for any help!!!Jon Link to comment Share on other sites More sharing options...
Jonidfld Posted December 10, 2010 Share Posted December 10, 2010 I've just got a temp fix on it boy using the code 2 or 3 times, there has to be a better way tho! Link to comment Share on other sites More sharing options...
rocky Posted December 18, 2010 Share Posted December 18, 2010 Try: {if $product->id_category_default != 3 AND $product->id_category_default != 4 AND $product->id_category_default != 5} Link to comment Share on other sites More sharing options...
Jonidfld Posted December 22, 2010 Share Posted December 22, 2010 Sorry for the dela.........thanks rocky that worked perfectly!!! Link to comment Share on other sites More sharing options...
kansas3d Posted March 20, 2013 Share Posted March 20, 2013 I tried to add {if $product->id_category_default != 3} in my product.tpl File of Prestashop 1.4.9 but it doesn't work. Can someone please help me to solve this? Here is my sector code I was adding it: <!-- Code start to remove Price for Product ID 3 --> {if $product->id_category_default != 3} {if ($product->show_price AND !isset($restricted_country_mode)) OR isset($groups) OR $product->reference OR (isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS)} <!-- add to cart form--> <form id="buy_block" {if $PS_CATALOG_MODE AND !isset($groups) AND $product->quantity > 0}class="hidden"{/if} action="{$link->getPageLink('cart.php')}" method="post"> <!-- hidden datas --> <p class="hidden"> <input type="hidden" name="token" value="{$static_token}" /> <input type="hidden" name="id_product" value="{$product->id|intval}" id="product_page_product_id" /> <input type="hidden" name="add" value="1" /> <input type="hidden" name="id_product_attribute" id="idCombination" value="" /> </p> <!-- prices --> {if $product->show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE} .... <!-- Out of stock hook --> <p id="oosHook"{if $product->quantity > 0} style="display: none;"{/if}> {$HOOK_PRODUCT_OOS} </p> <p class="warning_inline" id="last_quantities"{if ($product->quantity > $last_qties OR $product->quantity <= 0) OR $allow_oosp OR !$product->available_for_order OR $PS_CATALOG_MODE} style="display: none;"{/if} >{l s='Warning: Last items in stock!'}</p> {if $product->online_only} <p>{l s='Online only'}</p> {/if} <p{if (!$allow_oosp && $product->quantity <= 0) OR !$product->available_for_order OR (isset($restricted_country_mode) AND $restricted_country_mode) OR $PS_CATALOG_MODE} style="display: none;"{/if} id="add_to_cart" class="buttons_bottom_block"><input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" /></p> {if isset($HOOK_PRODUCT_ACTIONS) && $HOOK_PRODUCT_ACTIONS}{$HOOK_PRODUCT_ACTIONS}{/if} <div class="clear"></div> </form> {/if} {/if} <!-- Code end to remove Price for Product ID 3 --> Link to comment Share on other sites More sharing options...
Recommended Posts