medred Posted September 26, 2013 Share Posted September 26, 2013 Hello everyone. The shop contains only products with attributes and the “display add to cart button when product has attributes” from the back office removes the button completely from the product list when the value is set to “no”. We wish to keep the button and lead to the product page. So I changed line:60 from product-list.tpl file {if isset($static_token)}<a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add&id_product={$product.id_product|intval}&token={$static_token}", false)}" title="{l s='Add to cart'}"><span></span>{l s='Add to cart'}</a>{else}<a class="button ajax_add_to_cart_button exclusive" rel="ajax_id_product_{$product.id_product|intval}" href="{$link->getPageLink('cart',false, NULL, "add&id_product={$product.id_product|intval}", false)} title="{l s='Add to cart'}"><span></span>{l s='Add to cart'}</a>{/if} to {if isset($static_token)}<a class="button" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{l s='Detail'}">{l s='Details'}</a>{/if} It works well but is it the right way to do it? Thanks 1 Link to comment Share on other sites More sharing options...
Jiten rash (away) Posted September 26, 2013 Share Posted September 26, 2013 i read everything all i understood is u wanna hide add to cart button for products without attributes right? Link to comment Share on other sites More sharing options...
medred Posted September 26, 2013 Author Share Posted September 26, 2013 Well we just need the add to cart button on product list page to work as url to the product page. Link to comment Share on other sites More sharing options...
vekia Posted September 26, 2013 Share Posted September 26, 2013 well, everything depends on what you exactly expect, your code looks well and in my opinion everything is okay 1 Link to comment Share on other sites More sharing options...
medred Posted September 26, 2013 Author Share Posted September 26, 2013 By the way same question is here but for older prestashop version. http://www.prestashop.com/forums/topic/275043-solved-how-to-use-view-more-instead-of-add-to-cart/ Thank you Vekia. Link to comment Share on other sites More sharing options...
vekia Posted September 26, 2013 Share Posted September 26, 2013 i think that we can mark this topic as solved right now, if you will have any questions related to your modification - feel free to continue discussion here is there any chance to test your website? im so curious Link to comment Share on other sites More sharing options...
wantahand Posted November 22, 2013 Share Posted November 22, 2013 Hi, Thank you for all your assistance through the matters, this is my first post and saw That Mr Veika is helping people a lot, I was wondering if you could help me as well My questions are: -As I have a website which is not in need of online sales I would like to change the add to cart botton to Contact us and when click on it drives you to contact form page and not cart. -When I disabled 'available to order' or when changed to catalogue mode, the button doesnt show but the 'add to cart' still written even if it is not a link anymore. Could you please advice the best solution to have a button ' Contact Us' only instead of add to cart, and View product when clicking on cart icon in product list as it is linking to cart as well Thank you for your prompt reply and assistance. Link to comment Share on other sites More sharing options...
vekia Posted November 24, 2013 Share Posted November 24, 2013 -As I have a website which is not in need of online sales I would like to change the add to cart botton to Contact us and when click on it drives you to contact form page and not cart. you can simply edit template files (each file where the add to cart button appears) and then instead of add to cart button you can use button to contact page -When I disabled 'available to order' or when changed to catalogue mode, the button doesnt show but the 'add to cart' still written even if it is not a link anymore. you use default theme? im asking, because in non-default theme with catalog mode on this button should disappear. Link to comment Share on other sites More sharing options...
EMPIS Posted February 20, 2014 Share Posted February 20, 2014 I wanted in my shop to products without attributes have the add to cart button, and for product with attributes to have the "detalis" button, so I just simply added: {if ($product.id_product_attribute >= 1 || (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 isset($static_token)} <a class="button" href="{$product.link|escape:'htmlall':'UTF-8'}" title="{l s='Detail'}">{l s='Details'}</a>{/if} {/if} i dont now if this is correct but this is working for now as i can see, so maybe it will be useful for someone. Link to comment Share on other sites More sharing options...
vekia Posted February 21, 2014 Share Posted February 21, 2014 your code will work OK, well done i can confirm that it works because i tested it on 1.5.6.2 release inside product-list.tpl file Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now