Is there any way to create unique classes for add to cart buttons on the product page, and another class for the buttons on the category list pages?
I know the cart_add_block_1 class is dynamically generated based on product ID. Using smarty is there an if condition I could place within the class=" " attribute area that checks if this is a category page add custom_cat_add class, and if a product page custom_prod_add class?
[quote name='panag' timestamp='1322530060' post='126899']
Is there any way to create unique classes for add to cart buttons on the product page, and another class for the buttons on the category list pages?
I know the cart_add_block_1 class is dynamically generated based on product ID. Using smarty is there an if condition I could place within the class=" " attribute area that checks if this is a category page add custom_cat_add class, and if a product page custom_prod_add class?
[/quote]
Yes do something like below. YOu may also want to use the {$mode} variable as well.
{if $controller == 'categories'}
code here
{/if}
Awesome thanks
Or you can use CSS descendant selectors, for example on the product info pages it would be
.product-info .button-submit-action {
background:#000;
}
doing it this way allows for easier and more control and more upgrade-able.
The way I did this is changing in the default_template.tpl file the:
to
anf then, added my own declarations to this classes:
.product-info-2 {overflow: hidden;padding-left: 10px;}
.product-info-2 .button-submit-action,
.product-info-2 .button-submit,
.product-info-2 .button-submit-big,
.product-info-2 .button-action {
background: my-custom-background;}
.product-info-2 .button-submit-action input,
.product-info-2 .button-submit input,
.product-info-2 .button-submit-big input,
.product-info-2 .button-action a {
background: my-custom-background;}
That way you can assign custom size and background to “add-to-cart” button in detail page. I'd love to find an upgradable way, but for now this works… hope this help someone.