Hi everyone,
i'm trying to grab the cart data but i'm getting the wrong out put,the below php i got online,
My problem is i need the price to be separated from each other (100,46,503..etc) but the below code adds it all to one sum,how can i separate them?
$array = unserialize($_SESSION['__vm']['vmcart']);
$amount = 0;
foreach($array->products as $product){
$amount += $product->product_price;
}
echo $amount;
Thanks for the help.
Just curious, what is your goal?
Hi there,
This is a post i made explaining everything it need to do and what it is,
https://forum.virtuemart.net/index.php?topic=116943.msg394590#msg394590
Thanks.
Quote from: Master_gray on July 29, 2013, 18:54:19 PM
My problem is i need the price to be separated from each other (100,46,503..etc) but the below code adds it all to one sum,how can i separate them?
Don't understand you clearly. What do you mean when you say "separated"? What end result of separating do you wish?
Hi Maxim,
it's currently displaying like this:
461 (all together)
i need it to show like this:
200
240
21
each products price separate from each other and not combined in a total.
Thanks.
Attach to your next post php file where you have these rows.
Sorry i don't know what you mean?
Quote from: Master_gray on July 29, 2013, 18:54:19 PM
$array = unserialize($_SESSION['__vm']['vmcart']);
$amount = 0;
foreach($array->products as $product){
$amount += $product->product_price;
}
echo $amount;
I need full source from which you took that part.
Hi Maxim,
i found the solution here :(i don't know if i my link to another forum if not sorry)
http://stackoverflow.com/questions/15006030/display-the-number-of-items-in-the-cart-on-virtuemart-joomla-2-5
as you can see the code i posted is below the solution - Thanks for your time :) if i have any problems i will post again.