News:

Support the VirtueMart project and become a member

Main Menu

Return with JS custom calculated Price for product into Cart

Started by Mole_LR, October 05, 2013, 00:46:02 AM

Previous topic - Next topic

Mole_LR

Hi!

Joomla 2.5.14 and VM 2.0.22e

I have to create shop for products which prices are different for every single quantity depending on quantity levels (so, single item price for 1 item is not the same as single item price for 2 items; and these rules are different for quantity levels, 1-20, 21-50 etc). So, therefore I had had no options for using any calculation plugin or customfields for this...

So far I've done calculation with JS wich returns me the value as element <b id="custom_price"></b>. This is in category view.

So, the interesting question I have - is it possible to set this element value to the price parameter....I do not know, for example, $product->prices['salesPrice'] or whatever which is correct (so - to override the value that is already set from DB)? I need this custom calculated price to be set also in the Cart! At this moment have no idea - is it possible and how it could be done... Therefore any Hint would be helpfull!

I hope it can be possible! ;-)

Thank You!

Maxim Pishnyak

Quote from: Mole_LR on October 05, 2013, 00:46:02 AM
is it possible to set this element value to the price parameter....I do not know, for example, $product->prices['salesPrice'] or whatever which is correct (so - to override ...
... it in template overrides?
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

Mole_LR

Yes, so far changes for this custom price calculation are done in category view template override!

I'm sure it can be done - because CustomFields also AJAX change Price (I suppose $tmpPrice) if CustomField have additional Price.. ;-)

Mole_LR

Hi!

So far no suggestions, ideas, hints?

I know - it's more that just templating...

But I want to understand - how in Virtuemart it is made to return calculated price to the cart (through session, or returning value in the url; as these are 2 ways how javascript can "give" value to server script parameters)?

Maxim Pishnyak

Quote from: Mole_LR on October 05, 2013, 00:46:02 AM
single item price for 1 item is not the same as single item price for 2 items; and these rules are different for quantity levels, 1-20, 21-50 etc
You can't use this quantity rules in Product Edit form?
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart