[ic] Possible bug in discount handling?

Jeff Boes jeff at endpoint.com
Mon Oct 1 18:02:35 UTC 2012


(Interchange version 5.7.6)

I encountered this one recently; in situations where an item in the cart has both a [discount] and an "mv_discount", the
tags [item-discount-price] and [item-discount-subtotal] return incorrect values. See the code snippet below:

=====cut======
[perl no_return=1]
  $Items = [
    {
        'mv_ib' => 'products',
        'mv_ip' => '0',
        'code' => '2299-ram-3500',
        'mv_discount' => '$s * 0.95',
        'quantity' => '2',
    },
  ];
[/perl]
First step:
[discount hide=1 code='2299-ram-3500'][/discount]
<ul>
[item-list]
  <li> Price: [item-price]</li>
  <li> Discount Price: [item-discount-price]</li>
  <li> Discount Subtotal: [item-discount-subtotal]</li>
[/item-list]
</ul>

Second step:
[discount hide=1 code='2299-ram-3500']
  %s * 0.95
[/discount]
<ul>
[item-list]
  <li> Price: [item-price]</li>
  <li> Discount Price: [item-discount-price]</li>
  <li> Discount Subtotal: [item-discount-subtotal]</li>
[/item-list]
</ul>
=====cut======

This outputs:

=====cut======
First step:

    Price: $289.51
    Discount Price: $275.03
    Discount Subtotal: $550.07

Second step:

    Price: $289.51
    Discount Price: $550.07
    Discount Subtotal: $1,100.14
=====cut======

Essentially, the adjustment of the price for quantity is happening twice when there are two discounts present. I dug
around in the code but could not pin down where the bug is. Can anyone comment?


-- 
Jeff Boes <><
jeff at endpoint.com
269-408-0811



More information about the interchange-users mailing list