Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Hiding the Add to Cart button for certain parts

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 04-01-2011, 07:48 AM
 
duke57 duke57 is offline
 

Member
  
Join Date: Apr 2011
Posts: 12
 

Default 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.
__________________
X-Cart 4.4.2
Reply With Quote
  #2  
Old 04-04-2011, 01:42 AM
  pauldodman's Avatar 
pauldodman pauldodman is offline
 

X-Guru
  
Join Date: Jul 2003
Location: Spain / UK
Posts: 3,052
 

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

When you say "parts", do you mean products?
__________________
Paul Dodman
e-business & m-commerce consultant
w: www.luminointernet.com
e: xcart@luminointernet.com

Professional X-Cart help, advice, support and services, specialists in Mobile X-Cart.
Reply With Quote
  #3  
Old 04-04-2011, 04:47 AM
 
duke57 duke57 is offline
 

Member
  
Join Date: Apr 2011
Posts: 12
 

Default 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.
__________________
X-Cart 4.4.2
Reply With Quote
  #4  
Old 04-04-2011, 01:56 PM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default 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.
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote
  #5  
Old 04-11-2011, 05:48 AM
 
duke57 duke57 is offline
 

Member
  
Join Date: Apr 2011
Posts: 12
 

Default 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!
__________________
X-Cart 4.4.2
Reply With Quote
  #6  
Old 04-11-2011, 07:30 AM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

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

If it still isn't working did you want to post the code?
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote
  #7  
Old 04-13-2011, 05:34 AM
 
duke57 duke57 is offline
 

Member
  
Join Date: Apr 2011
Posts: 12
 

Default 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.
__________________
X-Cart 4.4.2
Reply With Quote
  #8  
Old 04-13-2011, 07:28 AM
 
duke57 duke57 is offline
 

Member
  
Join Date: Apr 2011
Posts: 12
 

Default 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}
__________________
X-Cart 4.4.2
Reply With Quote
  #9  
Old 04-13-2011, 08:50 AM
  mizNRG's Avatar 
mizNRG mizNRG is offline
 

Senior Member
  
Join Date: Jun 2010
Posts: 157
 

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

I think you need to put your code in customer/main/product_details.tpl.
__________________
X-Cart 4.4.4 Gold
Reply With Quote
  #10  
Old 04-15-2011, 10:00 AM
 
duke57 duke57 is offline
 

Member
  
Join Date: Apr 2011
Posts: 12
 

Default 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.
__________________
X-Cart 4.4.2
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 06:12 AM.

   

 
X-Cart forums © 2001-2020