If there any particular reason for this code setting $node->sell_price, only to read it off again into something else?

// $node was got like this so there's no pass by reference as far as I can see:
      $node = clone $context['subject']['node'];

// SNIP

  if (!isset($prices[$cache])) {
    // The discount action modifies the node's sell_price field.
    $node->sell_price = $price_info['price'];
    //dsm('pull!');
    ca_pull_trigger('calculate_product_discounts', $node, $user);
    $prices[$cache] = $node->sell_price;
  }
  else {
    $node->sell_price = $prices[$cache];
  }

  // Alter the price given in place.
  $price_info['price'] = $node->sell_price;
// The function ends here -- nothing more is done with $node

Why not just store it in $sell_price?

The reason I ask is the extra code needed for #840208: discounts not applied to attribute option labels will return a price that is not the node sell price...

Comments

joachim’s picture

Status: Active » Closed (works as designed)

Turns out this is a hack -- we have to set

$node->sell_price = $price_info['price'];

for the CA to work its stuff.