VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: razor7 on May 17, 2012, 18:48:15 PM

Title: Add to cart button input tag is selected from its class instead of its id
Post by: razor7 on May 17, 2012, 18:48:15 PM
Hi, I had a terrible bad time on styling my "add to cart" button, because i wanted to look different on categories and product details.

The code of the standard add to cart button is this:
<input type="submit" name="addtocart" class="addtocart-button" value="<?php echo JText::_('COM_VIRTUEMART_CART_ADD_TO'?>" title="<?php echo JText::_('COM_VIRTUEMART_CART_ADD_TO'?>" />

If you change the "class" attribute, lets say you want a different class to control styling it brokes javascript addtocart popup. In my case, I wanted this to work
<input type="submit" name="addtocart" class="addtocart-button-cat" value="<?php echo JText::_('COM_VIRTUEMART_CART_ADD_TO'?>" title="<?php echo JText::_('COM_VIRTUEMART_CART_ADD_TO'?>" />

I think that the javascript that handles addtocart popup functionality, must select the add to cart tag by some ID instead its class value.
<input type="submit" name="addtocart" id="addtocart-button" class="addtocart-button" value="<?php echo JText::_('COM_VIRTUEMART_CART_ADD_TO'?>" title="<?php echo JText::_('COM_VIRTUEMART_CART_ADD_TO'?>" />

Thanks for adding this in future releases.

Best regards!

Title: Add to cart button input tag is selected from its class instead of its id
Post by: razor7 on June 27, 2012, 19:25:29 PM
Hi, will this be added in future releases?