eCart - get total items of specific category
I am trying to get the total number of items with a specific category that are currently in the cart to give the client an idea of how many more they need to add in order to receive a discount. How do I do that. I tried modifying a discount rule to do it, but I get PHP errors.
Fatal error: Call to undefined function ConditionalTotal() in /home/createwi/public_html/store/crystals/index.php
$discountSchedule = array(16,32,48,64,80,96,112,128,144,160,176,192,208,224,240,256,272,288,304);
function getDiscount($cartNumber){
if (true && ($cartNumber > 0) && ($cartNumber < $discountSchedule[0])) {
$numberRequired = ($discountSchedule - $cartNumber);
$discountMessage = 'You are just '.$numberRequired.' crystals away from a $16 discount.';
}
}
Then the call from the page.
<?php getDiscount(ConditionalTotal("Quantity", "Category", "1")); ?>
The cart is included at the top of the page.