Jump to content

[SOLVED] Negative percentage voucher - for Fee


Recommended Posts

Not tested. Removing 'value' from $fieldsValidate and $webserviceParameters fields of Discount class will allow you to create a negative invoice. How that would work with the arithmetic of voucher calculations, I don't know. Each method where it is used may also need to be modified.

Link to comment
Share on other sites

But my intention is not to create a negative invoice, but to create a negative discount voucher (in other words to add a fee). Since the voucher will act as a fee, the invoice total will go up not down and never negative.

 

So far I tried using negative % vouchers by editing the discount value directly on the database, and it works perfect at first. It adds a % fee to the order summary, allows selection of payment and shipping but when I click on confirm my order I get this error:

(Fatal error (Discount -> value = -12.00)

Minus 12 is the value I am using for the negative % discount. I hope this clarifies the issue I am having.

Link to comment
Share on other sites

But my intention is not to create a negative invoice, but to create a negative discount voucher
Yeah that is what I meant to write, negative voucher. It is a typo.

 

The reason you are getting errors is during voucher creation a check is made on the value of the voucher that it is a positive value. In addition to what you are doing now, if you modify the Voucher class not to check the value field as I described in previous post it may work.

Link to comment
Share on other sites

It worked! Thanks a lot!

 

For everyone else, I just commented what phrasespot indicated in /classes/Discount.php (PS v1.4.6.2)

 

LINE 94

From:

'name' => 'isDiscountName', 'value' => 'isPrice', 'quantity' => 'isUnsignedInt', 'quantity_per_user' => 'isUnsignedInt',

To:

'name' => 'isDiscountName', /*'value' => 'isPrice', */'quantity' => 'isUnsignedInt', 'quantity_per_user' => 'isUnsignedInt',

 

LINE 112

From:

'value' => array('sqlId' => 'value'),

To:

//'value' => array('sqlId' => 'value'),

Link to comment
Share on other sites

  • 2 months later...

Hi there,

 

I've followed what you both did and it worked, I get the extra fee on the checkout page (order summery page) but once the invoice is made it shows the amount that was added on the order summery page as a discount and removes the same amount from the initial amount (before the added fee).

 

an example:

order summery-> price = 3000 (before voucher was added)

price = 3105 (after voucher was added)

 

Invoice-> price = 3000 before "discount"

price = 2895 after "discount"

 

My question is how to fix the amount on the invoice itself so it shows the same price as the order summary page. and also how to change the word "discount" to something else like "discount / aditional fees"

 

Thanks.

Yohai A.

www.buildweb.co.il

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...