- This topic has 5 replies, 3 voices, and was last updated 14 years, 2 months ago by .
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
- You must be logged in to reply to this topic.
Support site for Tips and Tricks HQ premium products
by
Tips and Tricks HQ Support Portal › Forums › Simple PayPal Shopping Cart › Simple Shopping Cart Tweaks › Finding out the number of items in the simple shopping cart
The following function should do the job to calculate the number of items in the shopping cart:
function simple_cart_total_itmes()
{
$total = 0;
foreach ($_SESSION['simpleCart'] as $item)
{
$total ++;
}
return $total;
}
Is this to find out the number of line items or the number of line items + quantity of each line item?
Where would I put this function?
I want to use it as a tool to discount the total based on how many individual items are ordered. with discounts increasing with each additional line item (up to 4)
any suggestions?
Rob
This is to find out the number of line items.
So, if I had 4 cans of Chicken Noodle Soup, and 3 cans of Mushroom Roup; the number is 7, right?
Nope, the number of line items in the cart would be 2. The total quantity would be 7 (I don’t know what to call this
I’m gonna try that reasoning the next time I use the 10 item express lane at the supermarket, LOL!