Jump to content

Trying to manage "Add to Cart" button for "amazonas" theme


Recommended Posts

I had an issue with option "Display the 'Add to cart' button when a product has combinations" , I've described issue  in this post:

 

I've never put my hands on prestashop but I have some developement skills from other frameworks and by digging a bit into the code I've found a pretty basic/inefficient solution, in public_html/themes/amazonas/templates/catalog/_partials/miniatures/product.tpl 

I added the condition

 {if $product.attributes}style="display:none";{/if}

to the button snippet

 

<button class="add_to_cart btn btn-primary" onclick="mypresta_productListCart.add({literal}$(this){/literal});">
    <i class="fa fa-shopping-cart"></i>{l s='Add to cart' d='Shop.Theme.Actions'}
 </button>

It's for sure not well integrated as setting will not be evaluated anymore, but for our purpose it might be ok at the moment, then I still have few doubts:

- is `$product.attributes` the right object to test whether product is a combination or not? I see there are more specific variables like "has_combinations" (in .js files) or "product_has_combinations" in controllers, but I didn't find a more specific key to evaluate it in the ".tpl" file with the snippet. Maybe I could check the "$product.product_type" but it's not set, is there a way to import that information so I can write a better condition?

- my main doubt is, basically, if product attributes are only used to generate combinations, in that case I think that evaluating `$product.attributes` is enough, otherwise I would need least to check if product is actually a combination

 

Thanks in advance

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