E-Commerce tiered pricing: help me with a simple (?) modification
Permalink
In the E-Commerce add-on, tiered pricing doesn't work correctly if you have multiple varieties (e.g. colors) of the same product.
Example of wrong behavior:
* Add 3 green widgets at tiered price $5/each to cart.
* Add 5 blue widgets at tiered price $4/each to cart.
* Let's say that the price tiers are [qty 1-3: $5/each ... qty 4-7: $4/each ... qty 8-12: $3/each].
The cart will NOT update to show the 8 widgets at $3/each.
Instead it shows 3 green widgets at $5 and 5 blue widgets at $4.
Note that regardless of color, the widgets are all the same 'productID'.
Fixing this should be relatively simple, but I need your help.
I can pay someone who helps me.
Even if I could write a function to update the order's prices in the database, I wouldn't know where to implement that function. It's easy to say "call the function every time the cart is displayed", but how do I do that exactly?
Also, how do I implement this fix in the smartest way to avoid breaking it when I upgrade Concrete or E-Commerce? I peeked at the documentation but I'd rather pay someone to help me.
I think I already have the algorithm for how to fix the cart prices:
1.) Get current 'orderID'
2.) Get all rows in CoreCommerceOrderProducts where 'orderID' matches, and sort by 'productID'
3.) For each group of 'productID' values, calculate the total quantity (e.g. 3 green widgets + 5 blue widgets = 8 widgets). Note that regardless of color, the widgets all have the same 'productID'.
4.) Get 'tierPrice' from CoreCommerceProductTiererdPricing where productID matches and total quantity is between 'tierStart' and 'tierEnd'
5.) Update CoreCommerceOrderProducts, set 'prPricePaid' equal to the correct price where ('orderID' equals the current orderID) and ('productID' equals the current productID)
6.) Now display the cart.
To reiterate, I don't have the desire or the time to read documentation. I want to pay someone to help me solve this problem.
I'm currently using Concrete 5.5.2.1 and E-Commerce 2.8.6. I can update Concrete to the latest version though.
Thank you!
Example of wrong behavior:
* Add 3 green widgets at tiered price $5/each to cart.
* Add 5 blue widgets at tiered price $4/each to cart.
* Let's say that the price tiers are [qty 1-3: $5/each ... qty 4-7: $4/each ... qty 8-12: $3/each].
The cart will NOT update to show the 8 widgets at $3/each.
Instead it shows 3 green widgets at $5 and 5 blue widgets at $4.
Note that regardless of color, the widgets are all the same 'productID'.
Fixing this should be relatively simple, but I need your help.
I can pay someone who helps me.
Even if I could write a function to update the order's prices in the database, I wouldn't know where to implement that function. It's easy to say "call the function every time the cart is displayed", but how do I do that exactly?
Also, how do I implement this fix in the smartest way to avoid breaking it when I upgrade Concrete or E-Commerce? I peeked at the documentation but I'd rather pay someone to help me.
I think I already have the algorithm for how to fix the cart prices:
1.) Get current 'orderID'
2.) Get all rows in CoreCommerceOrderProducts where 'orderID' matches, and sort by 'productID'
3.) For each group of 'productID' values, calculate the total quantity (e.g. 3 green widgets + 5 blue widgets = 8 widgets). Note that regardless of color, the widgets all have the same 'productID'.
4.) Get 'tierPrice' from CoreCommerceProductTiererdPricing where productID matches and total quantity is between 'tierStart' and 'tierEnd'
5.) Update CoreCommerceOrderProducts, set 'prPricePaid' equal to the correct price where ('orderID' equals the current orderID) and ('productID' equals the current productID)
6.) Now display the cart.
To reiterate, I don't have the desire or the time to read documentation. I want to pay someone to help me solve this problem.
I'm currently using Concrete 5.5.2.1 and E-Commerce 2.8.6. I can update Concrete to the latest version though.
Thank you!
Maybe this isn't as simple of a fix as I thought. Still, I hope someone can assist me.