VirtueMart cart calculation

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

VirtueMart cart calculation

Post by Joe »

I have been making some edits to virtuemart on joomla and I have encountered a slight problem that I cannot work around. Basically I am trying to display the amount of products that exist in the cart... I use the following code to print the session:

Code: Select all

echo '<pre>Session:<br>';
  print_r($_SESSION);
  echo '</pre>';
And I am resulted with the following:
Session:
Array
(
[cart] => Array
(
[idx] => 2
[0] => Array
(
[quantity] => 4
[product_id] => 1
[description] =>
)

[1] => Array
(
[quantity] => 1
[product_id] => 2
[description] =>
)

)
What I am trying to do is count all the values within the [ quantity ] part, so in this case, it would total upto 5... any ideas on how to do this?.

Thanks![/quote]
Post Reply