If I have a percent discount, then it applies to both the product and the attribute adjustments.

Example:

My discount is 20%, ie "* -0.2" in the discount settings (yes this is wacky: #492114: improve UI for percent discounts but it works).
Suppose a product price is $100. There is a single attribute with one option which adds $100.

When I add the product to my cart with this option, the cart price correctly shows as $160.

But on the product node, I see a base price of $80 with an option for $100. This is wrong and misleading to the customer.

Comments

Island Usurper’s picture

Status: Active » Needs review
StatusFileSize
new735 bytes
new392 bytes

So, this requires a change to both uc_discount and uc_attribute to work properly. uc_discount needs to handle the 'attribute_option' type, and uc_attribute needs to provide the node in the $context.

joachim’s picture

StatusFileSize
new1.63 KB

UC Discount needs a little bit more than that: discounts whose methods is 'add' rather than 'multiply' must not alter the option prices, so uc_discount_get_discount() needs a way of knowing it's altering an option.
Here's a patch with that (against my SVN, may be a little fuzzy).

Also, node/XX/edit/attributes dies in all cases, and so needs the $context['subject']['node'] as well. Island Usurper, could you look at that please -- you're likely to be much quicker than me at finding the right place for that.

joachim’s picture

StatusFileSize
new1.9 KB

Trying to debug the crash on the node/XX/edit/attributes....

Why does the node display get $context['revision'] = 'formatted', but the node/XX/edit/attributes page get $context['revision'] = 'themed'? This is what I meant needs explaining at #449546: uc_price() is a new complicated thing and needs explaining...

Also, I'm not sure how best to fix this.

Trivially, uc_object_attributes_form() can add the $node to the context, but when it's a class attribute form, that's not possible.

Also, when you think about it, the node/XX/edit/attributes page *shouldn't* show the discounted price. It's an admin page, and you need to be able to see what's what.

So uc_discount_price_handler_alter could simply test for the presence of a $node in the context.

Here's an updated version of my patch in #2 with that. (On my local SVN, may have fuzz.)

However -- are there any other cases where we'd get to uc_discount_price_handler_alter case 'attribute_option' without a $node?