News:

Support the VirtueMart project and become a member

Main Menu

Price Overrides

Started by nickwiebe, May 06, 2013, 17:36:51 PM

Previous topic - Next topic

nickwiebe

I'm trying to use the price override function to move a product from the normal price of 1200 to sales price of 1000 and that part is working fine.  I my page you see the the discount of 200 when I set it up this way.  The problem I'm having is I have a custom field that if selected is supposed to add 180 to the price of the product and this works fine when I'm not using the override, but when I am using the override the 180 gets added to the discount rather than the price of the product when selected in the custom field.

How can I use a price override and have this custom field still add to the price rather than the discount?

I'm using Joomla 2.5 and the latest version of VM2.

thanks,

Nick

jedzon

Have the same problem... Hope someone from VM team see this and give us some tricks to solve it... I think it's serious bug in VM. My VM version is 2.20

nickwiebe

It's been a week since I posted this, is there anybody out there that can help with this?

Milbo

So when you use the price override it is always overriden, regardless the variant?

Hmmm
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

jedzon

Hi Milbo, Hi Nickwiebe,

We have probably similar problem with Nickwiebe (please confirm if it's true).
I tryed hundred of solutions and nothing working...

Please look at:
http://www.e-slubny.com.pl/index.php/component/virtuemart/suknie-slubne/suknie-slubne2013-03-12-09-13-24/elegancka-suknia-do-slubu-wykonana-z-organza-i-satyny-typ-sukni-to-linia-a-bez-ramiaczek-suknia-posiada-naturalna-talie-i-jest-warstwowa-detail?Itemid=0


when custom field is selected additional pric is added only to net price instead of price with VAT, what doeasnt make sens in my opinion.

Can you help me with this Milbo.

Nickwiebe, please confirm if we have similar problem.

Thank you in advance,
Karol

nickwiebe

Yes Milbo,

I'm using a custom field where the field type is a cart variant and cart attribute is YES.  Normal price of the product is 1200, price override is set to 1000 so you see a discount of 200.  When you select the cart attribute, it is supposed to add 180 to the price for a price of 1180 but instead it adds the 180 to the discount so the discount is 380 and the final price is still 1000.

The override appears to force the price to stay at the set override amount.  Any way around this?

thanks,

Nick

nickwiebe

Jedzon,

It does appear that we are having the same problem.

Nick

nickwiebe

Here is the product that I'm having the trouble with.  I will only leave it up for the day since it is not working correctly.

https://pacificad.com/software/autodesk/autocadlt-detail

thanks,

Nick

nickwiebe

Any news on this post?  I really need this to work properly.  Can anybody help with this problem?

jedzon

Hi Nickwiebe,

I think, I have solution... After tree weeks.. I was try everything and...

Please open:
administrator/componensts/com_virtuemart/helpers/calculationh.php

find line similar to this: (around line 353)
$this->productPrices['salesPrice'] = $product_override_price

and change it to:
$this->productPrices['salesPrice'] = $product_override_price + $salesPrice - $costPrice*1.23 ;

(where 1.23 is tax in my country).

I found solution few minutes ago so I'm not sure if it's best one, but for me at the moment looks good :-)
Of course tax should be changed with variable, but for now it's just for testing...
Please, let me know if it working for you too. (I changed lot of code before I found this easiest soultion, so maybe some more changes you need to add - just let me know).
Hope this will work...

Regards,
Karol

nickwiebe

Jezdon,

Thank you for sharing this.  I think you are on the right track.  I am trying to get the cart variant to be added into the product price rather than the tax...not sure what to use for code name, maybe something like this:

$this->productPrices['salesPrice'] = $product_override_price + $CartVariant ;

Do you think this would work?

thanks,

Nick


jedzon

Hi,

I belive that is exacly what we are looking for. Please look at: http://e-slubny.com.pl/index.php/component/virtuemart/suknie-slubne/elegancka-suknia-do-slubu-wykonana-z-organza-i-satyny-typ-sukni-to-linia-a-bez-ramiaczek-suknia-posiada-naturalna-talie-i-jest-warstwowa-detail?Itemid=0

I can not find function coresponding for variant cost so I add few other variables which gave me same effect:

$product_override_price - this is price with discount
$salesPrice - this is price without the discount but with cart variant value
$costPrice - this is net price without cart variant value

For example:
Oryginal product is 2000
Discounted prodvuct value is: 1500
Additional fee: 50

$this->productPrices['salesPrice'] = $product_override_price + $salesPrice - $costPrice*1.23 ;

And we have: 1500 (discounted) + 2050 (price with additional fee) - 1626 (net price before discount and without additional fee) * 1.23 (this is tax in my country so I need to make price with tax) = 1550 (discounted price with additional fee)

If think you need same rules, but if you need price without tax you just should remove tax frome code.

Hopy you will understand what I'm mean becouse my english is not perfect :-)

Hope this will work for you too.
Please let me know.


Regards,
Karol

nickwiebe

Karol,

Thank you so much for helping with this.  You solution has worked perfectly for me as long as I check "Overwrite Final" rather than "Overwrite Price to be Taxed" in the product pricing section of the product.  I'm using avalara for tax calculations, and for some reason it is apply tax to the total price rather than the discounted price, but I think I can work that out with them.

This has been such a big help, and your English is very good :)

thanks,

Nick

woop

#13
#### SOLVED!!!! ######
I had a similar problem. I´m using Joomla 2.5 + VM version 2.0.22b

My problem was that when a product has a discount + prices modifier (type DBTax) + personalized fields (for example an extra of 20€ if you want your product inside a really nice box) the discount also was afecting to the price of the choosed personalized fields.
So for example if the product costs 100€ and has a 10% discount + you choose the nice box for 20€ the calculation that is done is -> (100€ + 20€ ) - 10%
For me the correct calculation has to be (100€ - 10%) + 20€

I solved that doing some changes on administrator/components/com_virtuemart/helpers/calculationh.php
Hear by I attached my modified file so everyone can check the changes. Just look for the lines with "BY WOOP" due the changes are allways lines just below my comments

My comments are in Spanish but I hope that comparing the original file with my modification it´s easy to see the changes I´ve done :)

I hope that this will help others developers that might be facing the same sition I do & if Milbo thinks that this functionality it´s more logic than the one that it has now he could include it on the VM project (or at least create another calculation rule that works as the one I´ve modified for DBTax).

Wish everyone to have a great day!!

[attachment cleanup by admin]
Kind Regards,
Daniel Mateu Solé

woop

just found a bug in my modificaction that was causing trouble with the calculation for those products without discount. I just solved it!!! :D
Attached the new modified file ;)


[attachment cleanup by admin]
Kind Regards,
Daniel Mateu Solé