VirtueMart Forum

VirtueMart 2 + 3 + 4 => Product pricing => Topic started by: jesussuarez on January 03, 2016, 13:24:50 PM

Title: Change to Apply no rules
Post by: jesussuarez on January 03, 2016, 13:24:50 PM
Hello !!

I have more than 500 products with "Apply generic rules" and now, I need to create discounts to some products.
The problem is that when I create a disccount rule, all the products are affected because all the products have "Apply generic rules" selected  :(

How can I change all the products to "Apply no rules" ? It's possible to get it via PHPMyAdmin?
Please, someone can say me what's the code to execute?

Or can I use another method to change all the products to "Apply no rules"?
Or another solution to assign diferent disccounts to diferent products having "Apply generic rules" selected?

Thank's in advance
Best regards :)
Title: Re: Change to Apply no rules
Post by: GJC Web Design on January 03, 2016, 13:44:30 PM
#___virtuemart_product_prices ->  product_discount_id -- set to -1

UPDATE `xxxx_virtuemart_product_prices` SET `product_discount_id`= '-1' WHERE `product_discount_id` = 0
Title: Re: Change to Apply no rules
Post by: jesussuarez on January 03, 2016, 13:56:36 PM
Thank you very much !!! I'll probe it :)

Best regards !!
Title: Re: Change to Apply no rules
Post by: jesussuarez on January 04, 2016, 02:36:59 AM
Work's perfect. Now the "Final price" of all the products are set in "No apply rules".
Thank you very muuuuch !!! Huge regards :)
Title: Re: Change to Apply no rules
Post by: jesussuarez on January 04, 2016, 02:43:03 AM
Some solution to have "No Apply rules" by default?
Title: Re: Change to Apply no rules
Post by: GJC Web Design on January 04, 2016, 10:50:22 AM
hmmm .. it is NULL in the DB

the select is formed here

administrator\components\com_virtuemart\views\product\view.html.php  ->  function renderDiscountList($selected,$name='product_discount_id'){

called here  administrator\components\com_virtuemart\views\product\tmpl\product_edit_information.php  ->

if (!isset($this->product->allPrices[$k]['product_discount_id'])) {
            $this->product->allPrices[$k]['product_discount_id'] = 0;
         }
         $this->lists['discounts'] = $this->renderDiscountList ($this->product->allPrices[$k]['product_discount_id'], 'mprices[product_discount_id][' . $this->priceCounter . ']');


change to

$this->product->allPrices[$k]['product_discount_id'] = '-1';
Title: Re: Change to Apply no rules
Post by: jesussuarez on January 04, 2016, 16:48:08 PM
Yeahhh. Thank you very much !!!

:)
Title: Re: Change to Apply no rules
Post by: tkoletsis on August 18, 2019, 14:56:36 PM
Hello,

I have the same issue too.

I would like this setting to be permanent
If a newer version of virtuemart is installed, this setting will be lost?
Can i make an assignment of this setting in my templates folder ?
In which path?

Thanks in advance
Theo
Title: Re: Change to Apply no rules
Post by: GJC Web Design on August 18, 2019, 15:57:15 PM
just over ride it in your admin template .. e.g. isis

public_html\administrator\templates\isis\html\com_virtuemart\product\product_edit_information.php