Index: uc_discount.module =================================================================== --- uc_discount.module (revision 357) +++ uc_discount.module (working copy) @@ -109,6 +109,19 @@ $node = clone $context['subject']['node']; $cache = 'node:'. $node->nid .':'. $price_info['price']; break; + case 'attribute_option': + // If there is no node in the $context, we are either on the node's + // attributes admin page or in product classes attributes, and in both + // cases should show no discount. + if (!isset($context['subject']['node'])) { + return; + } + $node = clone $context['subject']['node']; + $cache = implode(':', array('node', $node->nid, 'attribute_option', $context['subject']['option']->oid)); + // We only pass a $node to the action, so hack into this a property so the action + // knows it's working on an attribute option price. + $node->uc_discount_attribute_option = $context['subject']['option']->oid; + break; case 'cart_item': $node = clone $context['subject']['node']; $item = $context['subject']['cart_item']; Index: uc_discount.ca.inc =================================================================== --- uc_discount.ca.inc (revision 357) +++ uc_discount.ca.inc (working copy) @@ -400,6 +399,15 @@ * @see uc_discount_ca_action() */ function uc_discount_get_discount($entity, $settings) { + // Retrieve our hacked-in flag from the product. This lets us know that we're + // altering an attribute option price rather than the base price. These + // should only be affected by 'multiply' discounts and not 'add'. + if (isset($entity->uc_discount_attribute_option)) { + if ($settings['operation'] == 'add') { + return 0; + } + } + // If we are adding a base number as a discount, return it. if ($settings['operation'] == 'add') { return floatval($settings['amount']);