cjrent Posted August 5, 2013 Share Posted August 5, 2013 I've searched how to do this but only found information for product.tpl and am not sure how to incorporate it into product_list.tpl. If you look at the site: http://boojh.x10host...-alexander?&p=4 Scroll down and see the piece that is sold out...3rd row....the greyed out button seems to throw the layout a bit off and it kind of looks odd. Is there anyway to hide this so I can avoid the weird formatting? Thanks so much. Link to comment Share on other sites More sharing options...
vekia Posted August 5, 2013 Share Posted August 5, 2013 what prestashop version you're using? and default template? Link to comment Share on other sites More sharing options...
cjrent Posted August 5, 2013 Author Share Posted August 5, 2013 My apologies, I am using 1.5.4.1 And am using a copy of the default template. Thank you. Link to comment Share on other sites More sharing options...
vekia Posted August 5, 2013 Share Posted August 5, 2013 in the product-list.tpl you can find code like this: {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 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)}" 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=1&id_product={$product.id_product|intval}", false)}" title="{l s='Add to cart'}"><span></span>{l s='Add to cart'}</a> {/if} {else} <span class="exclusive"><span></span>{l s='Add to cart'}</span><br /> {/if} {/if} comment / remove it Link to comment Share on other sites More sharing options...
cjrent Posted August 5, 2013 Author Share Posted August 5, 2013 Thank you Vekia. Is there no way to hide it if the product quantity is 0 and leave it for items that are not sold out? Link to comment Share on other sites More sharing options...
tdr170 Posted August 5, 2013 Share Posted August 5, 2013 (edited) How do you have the option set for Allow order of out of stock if set to no the add to cart button will not function. Preferences, Products, bottom of page. Edited August 5, 2013 by tdr170 (see edit history) Link to comment Share on other sites More sharing options...
cjrent Posted August 5, 2013 Author Share Posted August 5, 2013 Hi tdr170, I have the following setup.... Under Preferences ->Products ->Products stock No for Allow ordering of out-of-stock products What that will do is disable the add to cart button onthe product page (which is great) and it will also disable the add to cart button on the product list What I would like to do, is in the product list, hid the add to cart button if a product quantity =0 The reason I would like to do this, is becuase my product list page is setup as a grid, and the add the add to cart button that shows when a product is sold out makes the format look odd. I am including a picture. If you see where I have circled in red. When a product is sold out the Grey add to cart button shows, but unfortunately it overlaps with the product below it. Ideally I'd like it to disappear for that product. If it cannot be done that is ok. I was hoping there would be something like if quantity = 0 then don't show the add to cart button else show it but to be honest, I am not quite sure how to go about doing that. If I am unclear, I do apologize. I can see in my mind what I want to achieve, but sometimes describing it in writing is harder. Thank you again, Violet Link to comment Share on other sites More sharing options...
tdr170 Posted August 5, 2013 Share Posted August 5, 2013 OK got ya, try this paste this code inside your product_list.css file, usually at the very bottom, should do the trick. #product_list li span.exclusive {display:none;} Link to comment Share on other sites More sharing options...
cjrent Posted August 5, 2013 Author Share Posted August 5, 2013 holy cow tdr170, that was AWESOME. worked like a charm. i cannot believe how great the folks on this forum are. thank you thank you thank you. Link to comment Share on other sites More sharing options...
vekia Posted August 5, 2013 Share Posted August 5, 2013 glad to hear that you found solution im going to mark this topic as [solved] best regards Link to comment Share on other sites More sharing options...
cjrent Posted August 5, 2013 Author Share Posted August 5, 2013 Yes, please do so, I couldn't do it myself. All the best! Link to comment Share on other sites More sharing options...
PascalVG Posted August 5, 2013 Share Posted August 5, 2013 The problem is actually an empty <p id></p> , probably added when adding the text out of stock or so. This gives problems, as all <p> tags have a padding bottom of 20px (see right in picture) turning this off makes the layout look ok. pascal 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