Xtaz411 Posted October 9, 2010 Share Posted October 9, 2010 Hi allCan anyone help me with removing the buy now button for products when the price is = 0 or if there is another way to do this that would be great.This is for products that I do not sell directly and offer a link to an outside source.I am using version 1.3.1.1 maybe this is already something offered in the latest version?Thank youXtaz Link to comment Share on other sites More sharing options...
rocky Posted October 10, 2010 Share Posted October 10, 2010 My posts here and here could be combined to do that. Link to comment Share on other sites More sharing options...
Xtaz411 Posted October 12, 2010 Author Share Posted October 12, 2010 Yes that is a great idea.Could you help me with the coding to do the following:Where location is the destination URLand EAN13 is the image name to replace the buy now button.The price should still be displayed. if location is not empty then replace the buy now button with: Thank you in advance for your time and reply Link to comment Share on other sites More sharing options...
rocky Posted October 12, 2010 Share Posted October 12, 2010 Trying changing line 319 of product.tpl (in PrestaShop v1.3.2) from: quantity == 0} 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> to: quantity == 0} style="display:none;"{/if} id="add_to_cart" class="buttons_bottom_block"> {if $product->location} <a href="{$product->location}" target="_blank"><img src="{$product->ean13}.png" alt=""> {else} <input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" /> {/if} Link to comment Share on other sites More sharing options...
Xtaz411 Posted October 13, 2010 Author Share Posted October 13, 2010 Thank you!I actually did not realize my suggestion was incomplete.Would it be possible to do the same:Use 'Location' for the URLand 'Supplier Reference' for the text that will display on the same button type as the add to cart button(EAN13 doesn't accept spaces)So I would have the same button as add to cart but the text would simply be the one put in the supplier reference field.And this again would only apply when location is not empty.Sorry for all the trouble, you are helping me a lot with this and many others as well I am sure. Link to comment Share on other sites More sharing options...
rocky Posted October 13, 2010 Share Posted October 13, 2010 Try: quantity == 0} style="display:none;"{/if} id="add_to_cart" class="buttons_bottom_block"> {if $product->location} <a href="{$product->location}" target="_blank"><img src="{$product->ean13}.png" alt=""> {else} <input type="submit" name="Submit" value="{$product->supplier_reference}" class="exclusive" /> {/if} Link to comment Share on other sites More sharing options...
Xtaz411 Posted October 13, 2010 Author Share Posted October 13, 2010 So I tweaked it a little but get a blank page so I must have added something wrong, what do you think?My code was a little different than yours, I just updated to Version 1.3.2.3.By the way thank you very much for your help with this. quantity > $last_qties || $product->quantity == 0) || $allow_oosp} style="display:none;"{/if} >{l s='Warning: Last items in stock!'} quantity == 0} style="display:none;"{/if} id="add_to_cart" class="buttons_bottom_block"> {if $product->location} <input type="button" name="Submit" value="{$product->supplier_reference}" class="exclusive" onClick="document.location = '{$product->location}'" /> {else} <input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" /> {/if} Link to comment Share on other sites More sharing options...
rocky Posted October 14, 2010 Share Posted October 14, 2010 I think you should use an like in my code instead of using an <input> and using Javascript to redirect it to the site. Link to comment Share on other sites More sharing options...
Xtaz411 Posted October 17, 2010 Author Share Posted October 17, 2010 Hi rockySorry but I am still having issues with this code. I have tried a few things but it always ends up with a blank page...Here is a recap of what I am hoping to do:If location is empty then display existing button saying "Add to cart" (existing setup)If location is not empty the display existing button saying {Reference_Supplier} and make the button go to the url added into {location}I took out the part of adding a different image for the button and find it easier to use the existing one.This is my current code: quantity > $last_qties || $product->quantity == 0) || $allow_oosp} style="display:none;"{/if} >{l s='Warning: Last items in stock!'} quantity == 0} 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> Thank you again for your time and help Link to comment Share on other sites More sharing options...
rocky Posted October 18, 2010 Share Posted October 18, 2010 I've had another look at the code and this time, I've tested it. Try using the following: quantity == 0} style="display:none;"{/if} id="add_to_cart" class="buttons_bottom_block"> {if $product->location} <a href="{$product->location}" class="exclusive" target="_blank"><img src="{$img_dir}{$product->ean13}.png" alt="">{$product->supplier_reference} {else} <input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" /> {/if} Link to comment Share on other sites More sharing options...
rocky Posted October 18, 2010 Share Posted October 18, 2010 Put 1.png, 2.png, etc in the img directory in your theme. Link to comment Share on other sites More sharing options...
Xtaz411 Posted October 18, 2010 Author Share Posted October 18, 2010 Hi rockyI created the images in the theme img dir.When I apply your code to product.tpl I loose then entire product displayhere is the code : quantity > $last_qties || $product->quantity == 0) || $allow_oosp} style="display:none;"{/if} >{l s='Warning: Last items in stock!'} quantity == 0} style="display:none;"{/if} id="add_to_cart" class="buttons_bottom_block"> {if $product->location} location}" class="exclusive" target="_blank">ean13}.png" alt="">{$product->supplier_reference} {else} <input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" /> {/if} see screenshot attached:The first is with the new code - the second is what the normal display looks likeThank you again for your time and help with this. Link to comment Share on other sites More sharing options...
rocky Posted October 19, 2010 Share Posted October 19, 2010 That's odd, since it's working for me. Try editing config/config.inc.php and temporarily changing 'display_errors' from 'off' to 'on'. That should display an error message. Link to comment Share on other sites More sharing options...
Xtaz411 Posted October 22, 2010 Author Share Posted October 22, 2010 It works!!There is only one thing that is a little off. The text is not displayed on the actual button but bellow it.I added a screen clip for you to see what I mean.Any idea how to get the text to show on the button?Thank you again for all the time you spent on this. Link to comment Share on other sites More sharing options...
rocky Posted October 22, 2010 Share Posted October 22, 2010 It is probably a CSS issue. Can you provide a link to your site so I can check it? Link to comment Share on other sites More sharing options...
rocky Posted October 22, 2010 Share Posted October 22, 2010 Thank you. The image is causing the text to be pushed down. What's the purpose of the image? Unless want a different button background for each product, I suggest that you remove the part of the code and add class="exclusive" to the . Link to comment Share on other sites More sharing options...
Xtaz411 Posted October 22, 2010 Author Share Posted October 22, 2010 It worked!! You are the man! Thank you!Last and final question, would I just apply the same code to the product-list.tpl to have the same thing work on that page?OrHow can I simply not display the add to cart button if location is not empty. This would only display the view button. Link to comment Share on other sites More sharing options...
rocky Posted October 22, 2010 Share Posted October 22, 2010 Yes, but use a . instead of ->. For example, {$product.location} instead {$product->location}. Link to comment Share on other sites More sharing options...
Xtaz411 Posted October 22, 2010 Author Share Posted October 22, 2010 Thank youProblem solved I simply don't display the add to cart button in product-list when location has something in it.Thumbs up to Rocky for some awesome help!Thank you 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