Jump to content

Removing Add to Cart Button for Certain Products in Product List


drchad

Recommended Posts

Hi There,

 

I have been searching the forums for this answer for a while, but still haven't found a clear solution.

 

I'm looking to remove the add to cart button from the product list for only some products, not all products.  I have subscription services, so on the subscription page I wish for customers to click to the main product page instead of having the ability to "add to cart" from the product list page.  

 

However, on all the other pages, I wish for the products to retain the "add to cart" button, so they don't need to click through each time to the specific product page.  

 

Anybody have a way to achieve this?  

 

Thanks,

 

Chad

Link to comment
Share on other sites

Hi Vekia,

 

Thank you for the reply - this doesn't work for my situation, my apologies, let me be more specific about my situation:

 

I have a shop which uses a separate module to communicate with paypal and the prestashop back office for setting up memberships automatically.  This module installs a separate button on my product pages for the memberships called "Subscribe Membership" which takes you directly to Paypal for the orders.  This still communicates with Prestashop however, so making the membership products unavailable for order creates an error when trying to process memberships through Paypal.  

 

Therefore, what I really need is to have 2 things:

1. I need to have the "Add to Cart" button removed from the product list page for just the membership products

2. I need to have the "Add to Cart" button removed from the individual products pages for each membership product.  

 

**However, I still need these products to be available for ordering, or else I will receive errors. Please let me know if you think this is possible.  

 

Thanks Again

Link to comment
Share on other sites

Maybe add some code in themes/<your theme folder>/product-list.tpl.

Here you will find the code where the add to cart button is added: 

				{/if}
				{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)|escape:'html'}" 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)|escape:'html'}" 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}

Here you can add some check if the current customer is member of the subscription group. if so, grey-out or don't show the button.

to get the groups of the customer, you can use:

  $customerGroups = Customer::getGroupsStatic(<ID of customer>);
 

same in themes/<your theme folder>product.tpl

 

Hope this helps,

pascal

Link to comment
Share on other sites

Hi Pascal,

 

Thanks for the reply.  Would it be possible to change whether or not the "add to cart" button and quantity gets displayed depending on the page?  This would probably be the best option, as I still need members to view other products with the "add to cart" buttons active. I'm not very experienced with code, so thanks for your explanations.

Link to comment
Share on other sites

  • 3 months later...

Hi everyone, I know it's  bit old post, but I still hope for a reply.

I'd like to KEEP the add to cart button in product LIST view, but remove the ADD TO CART text and leave only the CART itself as a funtional button. I need this to have more space in the list and for a more clear design. I tried removing the label form product_list.tpl, but its not working. What exactly do I have to modify in the tpl to remove the text? But i also want the leave the button intact on the produt.tpl itself.

I have the "force compilation" activated in backpanel.

 

Thanks in advance

Link to comment
Share on other sites

Salus, do I understand you correctly that you want to reduce the text on the button from 'Add to Cart' -> 'Cart' only?

If so, try to use Customization->translations:

- Select Front Office Translations,

- Select your theme (default, or your own theme)

- Choose your language (Choose USA flag if you want to 'translate' 'English' into 'alternative English':

 

post-455771-0-44584100-1392822852_thumb.png

 

Result:

post-455771-0-02205700-1392822861_thumb.png

 

 

Hope this is what you needed.

pascal

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...