Force a quantity of 1 and add a product multiple times (without qty updating)

Started by likrish, September 25, 2015, 17:25:24 PM

Previous topic - Next topic

likrish

Hi,

I want to be able to force the quantity of a product to 1 (easily achieved by hidden field).
However when I add the product a second time, I want the product to be added on a second line.
At the moment Virtuemart simply updates the QTY of the existing product in the cart (if the price is the same).
Ideally I would like to create a plugin that prevents the QTY from being updated and Forces the product onto a separate line.

Any help would be greatly appreciated...
We are developing VM 3.x on Joomla 3.x

K&K media production

Maybe with a customfield plg which adds something to the product to simulate a variant ...

Take a look to the plg development and try a little bit.

PRO

make a hidden custom field,

make the input value a random character string
This will force a new line


In the function plgVmOnDisplayProductFEVM3


// Product Page Display
// is hidden field ONLY in the form and not the custom Params
   function plgVmOnDisplayProductFEVM3(&$product,&$group) {

      if ($group->custom_element != $this->_name) return '';
      $group->display = '<input type="hidden" name="customProductData['.$product->virtuemart_product_id.']['.$group->virtuemart_custom_id.']['.$group->virtuemart_customfield_id.'][hidden]" value="1" />';
return true;
   }