News:

Support the VirtueMart project and become a member

Main Menu

Adding the quantity to cart from custom fields

Started by bardossi, May 17, 2013, 23:28:27 PM

Previous topic - Next topic

bardossi

Greetings,

I am setting up a printing related webshop and trying to set up quantity based pricing. I have tried two methods to reach my goals:

1. Set the product price to 0.0001 $ and using custom fields to add different unit prices to the different quantities e.g. 100 pcs is 22$/pc, 200 pcs is 18$/pc.
2. I tried the 'Custom Fields Dropbox Plugin' from Banquet Tables Pro, setting up that 100 pcs = 22$, 200 pcs = 18$

Both methods are doing the job except one thing I could not figure out: when I click the Add to cart it will add only 1 pc instead of my quantity selection. Is there an easy way to get somehow the quantity from custom field and add it to the shopping cart? I can remove the quantity box but unfortunately, I am not a coder and it is certainly not enough to add the desired quantity to my cart. (maybe in the default_showprices.php but I am not sure).

Additionally, it would be great to 'echo' not just the unit price which is changing if I drop down the quantity box but to show the value (quantity * unit price) underneath.

Can somebody help me out?

My Joomla: 2.5.11
My VM: 2.0.10

Thank you in advance.


bardossi

Hello,

I think I have found where to modify the default_addtocart.php, I should get the quantity after value= but I am still not finding the variable for my custom field:

<span class="quantity-box">
<input type="text" class="quantity-input js-recalculate" name="quantity[]" value="<?php if (isset($this->product->min_order_level) && (int)$this->product->min_order_level 0) {
echo $this->product->min_order_level;
} else {
echo '1';
?>
"/>
    </span>


If someone could help would be highly appreciated.