Announcement
Collapse
No announcement yet.
Automatically Update Product Price Before User Checks Out
Collapse
X
-
scottd21 For upgraded stores you need to manually create the item and assign it to the pages you want to use the runtime functions on.
-
Just to make it easy for everyone, please include a popup notification the user to explain to the customer what happend and require an 'OK' to actually update the priceOriginally posted by Brennan View PostHere is some example code that just identifies that a product in the basket has a different price. I've seen this request enough to justify us looking to adding this in as a feature/setting in Miva.
<snip>
Leave a comment:
-
Hey Brennan,Originally posted by Brennan View PostHere is some example code that just identifies that a product in the basket has a different price. I've seen this request enough to justify us looking to adding this in as a feature/setting in Miva.
This is simply outputting text that the item price has changed. If you wanted to automatically update the price there is a new function we released in 10.03 that makes this much easier:Code:<mvt:foreach iterator="group" array="basket:groups"> <mvt:do name="l.return" file="g.Module_Library_DB" value="Runtime_Product_Load_Code( l.settings:group:code, l.settings:product )" /> <mvt:if expr="l.settings:group:price NE l.settings:product:price"> Item: &mvte:group:code; Price has changed! </mvt:if> </mvt:foreach>
https://docs.miva.com/miva10/referen...mejs-referenceCode:function Runtime_BasketGroup_Update( group_id, data, callback, delegator ) { return AJAX_Call_JSON( callback, 'runtime', 'Runtime_BasketItem_Update', { Group_ID: group_id, Quantity: data.quantity, Subscription_Term_ID: data.subterm_id, Attributes: data.attributes }, delegator ); }
We are all upgraded to 10.03, but I am not sure the runtimejs item is available yet. Is there a module that needs to be installed? This just could be me not understanding the new js item and how it integrates. Thanks,
--Scott
Leave a comment:
-
Here is some example code that just identifies that a product in the basket has a different price. I've seen this request enough to justify us looking to adding this in as a feature/setting in Miva.
This is simply outputting text that the item price has changed. If you wanted to automatically update the price there is a new function we released in 10.03 that makes this much easier:Code:<mvt:foreach iterator="group" array="basket:groups"> <mvt:do name="l.return" file="g.Module_Library_DB" value="Runtime_Product_Load_Code( l.settings:group:code, l.settings:product )" /> <mvt:if expr="l.settings:group:price NE l.settings:product:price"> Item: &mvte:group:code; Price has changed! </mvt:if> </mvt:foreach>
https://docs.miva.com/miva10/referen...mejs-referenceCode:function Runtime_BasketGroup_Update( group_id, data, callback, delegator ) { return AJAX_Call_JSON( callback, 'runtime', 'Runtime_BasketItem_Update', { Group_ID: group_id, Quantity: data.quantity, Subscription_Term_ID: data.subterm_id, Attributes: data.attributes }, delegator ); }
- 1 like
Leave a comment:
-
Thanks for the info Colin, I appreciate that. I am just confused why this functionality would not be in the system already to alert and update the price in the customers basket. I have had this happen as a customer numerous times on other websites that I use where a price of a limited item gets adjusted on the fly. As a customer, I don't expect to lock a price by adding something to my cart and keeping the cart alive for a while. Early on in our Miva implementation we also had to get some custom development done to ensure that users could not check out with items that were out of stock in their cart. We ended up overselling a bunch of products until this development was done. We also cannot tie up inventory when someone adds something to their cart as that would not be fair to others trying to get some of these limited run pieces.Originally posted by dreamingdigital View PostYou could also see it from the customer's point of view and magically their items in the cart are changing prices. Basket items are their own table, just like order items. So they're not linked once in the cart in terms of a price update.
If you wanted to do what you ask, it's totally possible and use all built in API calls.
1. For each basket group item you need to run this
https://docs.miva.com/api-functions/...duct_load_code
and see if the price is dfifferent.
If it's different then you use this or similar function. https://docs.miva.com/api-functions/...update_pricing I think the param it needs is the entire basket line item. So copy the current line item to a var/struct, change it's price, then run the API. Then throw a javascript alert to tell the customer you're changing their price and location.replace with the basket url. When the page loads it will have the corrected product price.
Thank you again for that code info above. I will take a look and attempt to use that on our BASK page and see if I can get it updating automatically.
--Scott
Leave a comment:
-
You could also see it from the customer's point of view and magically their items in the cart are changing prices. Basket items are their own table, just like order items. So they're not linked once in the cart in terms of a price update.
If you wanted to do what you ask, it's totally possible and use all built in API calls.
1. For each basket group item you need to run this
https://docs.miva.com/api-functions/...duct_load_code
and see if the price is dfifferent.
If it's different then you use this or similar function. https://docs.miva.com/api-functions/...update_pricing I think the param it needs is the entire basket line item. So copy the current line item to a var/struct, change it's price, then run the API. Then throw a javascript alert to tell the customer you're changing their price and location.replace with the basket url. When the page loads it will have the corrected product price.
Leave a comment:
-
Automatically Update Product Price Before User Checks Out
Hey everyone,
We discovered what we think is a pretty big issue with the standard functionality of our store. If we update a price of a product, this price is not reflected in a customers shopping cart if they already had it in their basket. With today's manufacturing issues we are constantly adjusting pricing. I opened a ticket for this issue and I was told that this is the way it works and I can just dump all the carts if I make a price change. This 100% does not work for us as we sell a ton of little parts to hobbyists. I will admit that we do have a VERY long timeout on carts, but this is what our customers requested. I am hoping someone at Miva sees the issue with this and can add this to a future enhancement.
A temporary solution would be the ability to recalculate carts prices with a scheduled task, but that does not seem to be an option either. If this was an option, we could run the task whenever we update a product price.
I am at the point where I am about to write an update query directly to the BasketItems table in the database when we have to change a price. This is obviously not ideal, but better than using a delete query to remove the individual items from baskets.
Does anyone have any other suggestions?
Thank you,
--ScottLast edited by scottd21; 04-07-22, 12:21 PM.Tags: None
- 2 likes
Leave a comment: