this.parentNode.elements is undefined when updating Quantities in Virtuemart

t

How Can We Help?

this.parentNode.elements is undefined when updating Quantities in Virtuemart

To solve this problem open the following file

components/com_virtuemart/js/themes/default/templates/product_details/includes/quantity_box_general.tpl.php

and in line 46 and 47 remove this code 

<input type="button" class="quantity_box_button quantity_box_button_up" onclick="var qty_el = this.parentNode.elements[\'quantity[]\']; var qty = qty_el.value; if( !isNaN( qty )) qty_el.value++;return false;" />
 
<input type="button" class="quantity_box_button quantity_box_button_down" onclick="var qty_el = this.parentNode.elements[\'quantity[]\']; var qty = qty_el.value; if( !isNaN( qty ) && qty > 0 ) qty_el.value--;return false;" />

and replace it with this code

<input type="button" class="quantity_box_button quantity_box_button_up" onclick="var qty_el = document.getElementById(\'quantity'.$prod_id.'\'); var qty = qty_el.value; if( !isNaN( qty )) qty_el.value++;return false;" />
 
<input type="button" class="quantity_box_button quantity_box_button_down" onclick="var qty_el = document.getElementById(\'quantity'.$prod_id.'\'); var qty = qty_el.value; if( !isNaN( qty ) && qty > 0 ) qty_el.value--;return false;" />

About the author

Ian Carnaghan

I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment.

About Author

Ian Carnaghan

I am a software developer and online educator who likes to keep up with all the latest in technology. I also manage cloud infrastructure, continuous monitoring, DevOps processes, security, and continuous integration and deployment.

Follow Me