Count Number of Items with the Same ID
Hi Ray
Thanks for you reply. After making sure there was no way of doing this in the eCart Dialog Wizard, I implemented this solution;
<?php
if (!$theCart->IsEmpty())
{
$theCart->MoveFirst();
while (!$theCart->EOF())
{
$_SESSION['item_'.$theCart->DisplayInfo("ID")] = $theCart->GetInfo($theCart->DisplayInfo("ID"), "Quantity");
$theCart->MoveNext();
}
}
$theCart->MoveFirst();
?>
This dynamically sets a session name called "item_" with a suffix of the that item's ID and then using GetInfo Function to obtain the QTY of that item in the cart.
And then, in the Calculations Tab, I did did this;
($_SESSION['item_'.[ID]] >= [disThreshold]) ? ([CartDiscountType] == '%') ? [Quantity] * [Price] * [CartThresholdDiscount] / 100 : [Quantity] * [CartThresholdDiscount]: ''
So, if the $_SESSION['item_$foo'] is greater than or equal to the disThreshold (taken from the database for that item) then the discount is is calculated and applied to the cart.
This works, but there may be another way.