X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Hiding the Add to Cart button for certain parts (https://forum.x-cart.com/showthread.php?t=58722)

duke57 04-01-2011 07:48 AM

Hiding the Add to Cart button for certain parts
 
Has anyone been able to hide the add to cart button for specifice parts at all? I have tried various versions of code that utilize the extra fields option which have not worked. I'm definitely missing something here. Any help would be much appreciated. Thanks in advance.

pauldodman 04-04-2011 01:42 AM

Re: Hiding the Add to Cart button for certain parts
 
When you say "parts", do you mean products?

duke57 04-04-2011 04:47 AM

Re: Hiding the Add to Cart button for certain parts
 
Quote:

Originally Posted by pauldodman
When you say "parts", do you mean products?


Yes, I mean products. O:)

cherie 04-04-2011 01:56 PM

Re: Hiding the Add to Cart button for certain parts
 
I think you're on the right track, using Extra Fields to flag which products should hide the button. The button is in product_details.tpl so I would just add a wrapper around it checking for the value of the extra field. :)

duke57 04-11-2011 05:48 AM

Re: Hiding the Add to Cart button for certain parts
 
Quote:

Originally Posted by cherie
I think you're on the right track, using Extra Fields to flag which products should hide the button. The button is in product_details.tpl so I would just add a wrapper around it checking for the value of the extra field. :)


The funny thing is, when I tried doing that, I wasn't using the right code to capture the variables correctly. It either eliminated the cart button for all of the parts, or none of them. Very strange!

cherie 04-11-2011 07:30 AM

Re: Hiding the Add to Cart button for certain parts
 
If it still isn't working did you want to post the code?

duke57 04-13-2011 05:34 AM

Re: Hiding the Add to Cart button for certain parts
 
Sure, thanks so much for your help. Just give me a second to gather the code in question. :-)

duke57 04-13-2011 07:28 AM

Re: Hiding the Add to Cart button for certain parts
 
I basically created an extra field with the service name: NO_ADD_CART, and the field name: "No Add To Cart Button", for every product.

This is the code that I placed in the template common_files/customer/buttons/add_to_cart.tpl which is making the add to cart button dissappear for every product on the site.

{*
$Id: add_to_cart.tpl,v 1.1 2010/05/21 08:32:02 joy Exp $
vim: set ts=2 sw=2 sts=2 et:
*}
{if $extra_fields.field eq "NO_ADD_CART" and $extra_fields.field_value ne "no"}
{include file="customer/buttons/button.tpl" button_title=$lng.lbl_add_to_cart additional_button_class=$additional_button_class|c at:' add-to-cart-button'}
{/if}

mizNRG 04-13-2011 08:50 AM

Re: Hiding the Add to Cart button for certain parts
 
I think you need to put your code in customer/main/product_details.tpl.

duke57 04-15-2011 10:00 AM

Re: Hiding the Add to Cart button for certain parts
 
I guess that some of the variables that I'm referencing aren't recorgnized in some templates? I'll give it a shot. Thanks for the help.


All times are GMT -8. The time now is 10:58 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.