News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Why is it so difficult to apply a discount to a single product?

Started by z-analysts, May 14, 2013, 02:08:29 AM

Previous topic - Next topic

z-analysts

My client wants to apply discounts of varying amounts to various products. Why can't I just go into a product and assign the discount? I could live with the calculation rule if they could be assigned at the product level but the way VM is currently designed I have to create a brand new category just for the discount?!?

Please tell me if I am missing something and whether what I am asking can be done.

Alternatively, is there an extension available that does product discounts?

Joomla 2.5.11
VM 2.0.20b
PHP 5.3.16

amerloc

Yeah I had this problem and it doesn't seem the DEV Team  have understood their mistake. Here is my core hack that allows you to add prices to child variants using the stockable variants plugin

VM2 2.0.20b

Go and open :

/plugins/vmcustom/stockable/stockable.php

search for
$db->setQuery('SELECT `product_price` FROM `#__virtuemart_product_prices`  WHERE `virtuemart_product_id`="' . (int)$selected . '" ');
Change to:
///My hack to make pricing work with Groups///
$userid =& JFactory::getUser();
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$query->select('a.virtuemart_shoppergroup_id');
$query->from('#__virtuemart_vmuser_shoppergroups AS a');
$query->where('(a.virtuemart_user_id ='.$userid->id.')');
$query = $db->setQuery($query);//Very important
$shopgrpid = $db->loadResult();

$db = JFactory::getDBO();

//$db->setQuery('SELECT `product_price` FROM `#__virtuemart_product_prices`  WHERE `virtuemart_product_id`="' . (int)$selected . '" ');
$db->setQuery('SELECT `product_price` FROM `#__virtuemart_product_prices`  WHERE `virtuemart_product_id`="' . (int)$selected . '" AND `virtuemart_shoppergroup_id`="' . (int)$shopgrpid . '" ');


Presto now you create a Wholesale group and you can assign it different prices.