In order to solve the +2 -2 problem, you must edit the file located under:
And change the following two lines that you can find at the top of the file:
plus = cart.find('.quantity-plus'),
minus = cart.find('.quantity-minus'),
plus = cart.find('.quantity-plus').unbind("click"),
minus = cart.find('.quantity-minus').unbind("click"),http://stackoverflow.com/questions/1536660/jquery-click-event-handler-is-called-twice-for-a-checkbox
EXPLANATIONS ABOUT THE PROBLEMS OF THIS POST:
I don't understand why this feature is not active by default. As some people commented here it is a very useful option and it would be a check into the Virtuemart configuration
to enable/disable the fetaure.
Furthermore, I found difficulties reading this post. For this reason I will write this here:
The procedure that you must follow in order to display the "ADD TO CART" button and "QUANTITY" box, when you are viewing a page with virtuemart Categories listed is:
1. Copy with ctrl+c the code of the first post of this thread.
2. Edit the file: /var/www/joomla/components/com_virtuemart/views/category/tmpl/default.php
3. Insert the copied code between the following lines:
<?php // Product Details Button
echo JHTML::link($product->link, JText::_('COM_VIRTUEMART_PRODUCT_DETAILS'),
array('title' => $product->product_name,'class' => 'product-detail\s'));
PASTE THE CODE HERE!!!!!!!!!!!!!!!!
// Do we need to close the current row now?
4. Save and close. The buttons will appear.
5. If you try to click on + and - buttons, you will see that the quantity of the product is increasing/decreasing by 2. It's because the click event is passed to the "input" element, and also passed to another element. It makes that the function of clicking gets executed two times. In order to solve this, read the top of this post that deals with modificating the file vmprices.js.
MY TEMPLATE DESIGN PROBLEMS:
I am having problems with the button colors, aspect, etc. I would like to change the button to a smallest and less abusive button, but only in the Categories page. I tried to change the line in the default.php (the one that I modified some lines ago in this post) that says:
<input type="submit" name="addtocart" class="addtocart-button" value="<?php echo $button_lbl ?>" title="<?php echo $button_lbl ?>" />
Changing the class="addtocart-button" , to "addtocart-button-smaller", and creating a class into the .css file. The button appears as I want, but it does not run.... while I am writing these lines I see the problem. When I click the button the JQuery function that adds the products to the cart does not get executed, because the function is executed only for certain classes. So I see.. I have to modify vmprices.js and I suppose that I have to modify it adding:
addtocart-smaller = cart.find('input.addtocart-button-smaller'),
And adding a function for this:
addtocart-smaller.click(.... identical content of addtocart.click(...)
That's all for me