Tags/topics: 
1
Answers
Vote up!
0
Vote down!

Update Quantity of Product B based on Product A

Hello,

I have a website that users can register for Courses on. Courses are a product display and Registration Product is the product type that is tied to it.

Registration Product has a field called Register By that I am using rules to check, and if the Register By field has passed, a Late Fee product is added to the cart when you add the Course. So if you register late, you pay a Late Fee. (I've tried Commerce Fee but had no luck so this made the most sense).

When the user is at the cart screen, and they update the quantity of how many Course Registrations they want, the Late Fee needs to update its quantity as well to reflect the changes.

So I am trying to figure out how to do this in Rules. I have added Commerce Rules Extra to give me a few additional options but still can't figure it out.

So this is what I have working so far:

1) User adds product to cart
2) Rule checks if product has field Register By, and data comparison compared to < now
3) If < now is TRUE, Late Fee product is added to the cart as well
4) If < now is FALSE, no Late Fee product is added.

What I need to happen next:

1) User is in the cart and wants to register for two of the same course (keep in mind that there can be separate courses added to the same order, some with the late fee, some with out.)
2) User updates the quantity of the Course and hits Update Cart
3) Rule needs to trigger when cart is updated
4) Rule needs to check to see if a quantity was changed
5) Rule needs to check to see if the product contains the Register By field
6) Rule needs to check to see if data comparison is TRUE (I think this all needs to be checked again or else it will not know what courses in the cart it should look at and that the Late Fee applies too)
7) Rule needs to then update the quantity of the corresponding Late Fee product to reflect the same number.

This may be easier if the user first placed their quantity on the Product Display and then added to cart, perhaps that would work better but I can't get the quantity field on the product display to try it.

This is Time Sensitive! Since I need to try and figure this out by the end of this week.... Please help!!!

Travis
Asked by: Travis
on June 18, 2013

1 Answer

Vote up!
0
Vote down!

OK, So an update that I managed to get the Qty to show on the product display. Once I did that, and unchecked the Combine , the Late Fee would be added 2 times if you selected 2 as a Qty before Adding to your cart.

So now its just a manner of having the same functionality if the user then realizes they missed someone and they update the qty of the course in the Cart view. Again, remember that there may be two separate late fees in the cart if they are registering for two separate courses and both of which are late registrations...

Travis
Answer by: Travis
Posted: Jun 18, 2013