Jump to content

Add to cart button in compare page


m4tt300

Recommended Posts

Dear Guys,
 
I modified
 
In /home2/buonissi/public_html/themes/MyNewTheme/product.tpl
I modify the line 443
<input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" />
 
In 
 
<input type="submit" name="Submit" value="{l s='Add to cart'}" class="exclusive" style="border:1px; height:40px; font-size: 18px; color:#FFFFFF; background:#324AB2"/>
 
and worked! 
 
However, 
 
But if I change the line 560
From
<a class="exclusive button ajax_add_to_cart_button" href="{$link->getPageLink('cart', true, NULL, "qty=1&id_product={$accessory.id_product|intval}&token={$static_token}&add")|escape:'html'}" rel="ajax_id_product_{$accessory.id_product|intval}" title="{l s='Add to cart'}">{l s='Add to cart'}</a>
To 
<a style="border:1px; height:40px; font-size: 18px; color:#FFFFFF; background:#324AB2" class="exclusive button ajax_add_to_cart_button" href="{$link->getPageLink('cart', true, NULL, "qty=1&id_product={$accessory.id_product|intval}&token={$static_token}&add")|escape:'html'}" rel="ajax_id_product_{$accessory.id_product|intval}" title="{l s='Add to cart'}">{l s='Add to cart'}</a>
 
Nothing happens but if I change code direct by google chrome it works........
 
Am I in the wrong file?
 
I want to modify the add to cart button but in the "compare" / categories products

 

Link to comment
Share on other sites

Hi M4,

I think you try in the wrong file. It's not in product.tpl.

 

 

Edit file: themes/<your theme folder>/products-comparison.tpl: (around line 90  in 1.5.6.2)

				<a class="cmp_remove" href="{$link->getPageLink('products-comparison', true)|escape:'html'}" rel="ajax_id_product_{$product->id}">{l s='Remove'}</a>
				{if (!$product->hasAttributes() OR (isset($add_prod_display) AND ($add_prod_display == 1))) AND $product->minimal_quantity == 1 AND $product->customizable != 2 AND !$PS_CATALOG_MODE}
					{if ($product->quantity > 0 OR $product->allow_oosp)}
						<a style="border:1px; height:40px; font-size: 18px; color:#FFFFFF; background:#324AB2" class="exclusive ajax_add_to_cart_button" rel="ajax_id_product_{$product->id}" href="{$link->getPageLink('cart', true, NULL, "qty=1&id_product={$product->id}&token={$static_token}&add")|escape:'html'}" title="{l s='Add to cart'}"><span></span>{l s='Add to cart'}</a>
					{else}
						<span class="exclusive">{l s='Add to cart'}</span>
					{/if}
				{else}
					<div style="height:23px;"></div>
				{/if}

result:

post-455771-0-37024500-1401693180_thumb.png

 

 

Hope this helps,

pascal

Link to comment
Share on other sites

Hi Pascal, 

 

Thanks for your reply. 

 

I found the file but my version is 1.5.6.1 so the code is different

 

 <a class="cmp_remove" href="{$link->getPageLink('products-comparison', true)|escape:'html'}" rel="ajax_id_product_{$product->id}">{l s='Remove'}</a>
    {if (!$product->hasAttributes() OR (isset($add_prod_display) AND ($add_prod_display == 1))) AND $product->minimal_quantity == 1 AND $product->customizable != 2 AND !$PS_CATALOG_MODE}
     {if ($product->quantity > 0 OR $product->allow_oosp)}
 
<a style="border:1px; height:40px; font-size: 18px; color:#FFFFFF; background:#324AB2" class="exclusive ajax_add_to_cart_button" rel="ajax_id_product_{$product->id}" href="{$link->getPageLink('cart', true, NULL, "qty=1&id_product={$product->id}&token={$static_token}&add")|escape:'html'}" title="{l s='Add to cart'}"><span></span>{l s='Add to cart'}</a>
     {else}
      <span class="exclusive">{l s='Add to cart'}</span>
     {/if}
    {else}
     <div style="height:23px;"></div>
    {/if}
 
I added this one 
 
> style="border:1px; height:40px; font-size: 18px; color:#FFFFFF; background:#324AB2"
 

but didn't work

 

Any idea? any error you see? why doesn't work?

 

Thanks a lot for your reply! 

Link to comment
Share on other sites

M4,

 

Maybe I misunderstood. From your first post : 

I want to modify the add to cart button but in the "compare" / categories products
 

I understood you wanted the button in the 'compare' screen (i.e after selecting some products and pressing the compare button. You can see that that indeed works (try selecting two products on the page you gave us a link and press compare. You will here see the blue buttons)

 

post-455771-0-55106000-1401983497_thumb.png

 

If it should be on the page you gave us a link to itself, then change this code:

Edit file: themes/<your theme folder>/product-list.tpl

 

Find the code (search for 'add to cart'):

					{if ($product.allow_oosp || $product.quantity > 0)}
						{if isset($static_token)}
							<a style="border:1px; height:40px; font-size: 18px; color:#FFFFFF; background:#324AB2"  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 style="border:1px; height:40px; font-size: 18px; color:#FFFFFF; background:#324AB2" 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 style="border:1px; height:40px; font-size: 18px; color:#FFFFFF; background:#324AB2" class="exclusive"><span></span>{l s='Add to cart'}</span><br />
					{/if}

and add the style="border:1px; height:40px; font-size: 18px; color:#FFFFFF; background:#324AB2" 

 

code to it.

 

Hope this helps,

pascal.

 

Link to comment
Share on other sites

Thank you Pascal, it worked. 

 

I have another question: if you look at my website www.buonissimo.kz/en on the top bar you can click either on

 

1) products

2) gift set blue

3) detox with water

 

When you click on products there are all the subcategories and all products from 2) and 3).

 

I want to disable 1) making not clickable / accessible. Is it possible?  

 

Thanks,

 

M4

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...