Jump to content

Obtain all products and quantity


Recommended Posts

I'm trying to get the length, width and height total of all products in the cart. For the products I use the following line:

 



$products = $params['cart']->getProducts(true);


 

However if there is a unique product in the cart but 2 or more units that are wanted, with this line only detects me as if it were a single quantity and I can not add to the length, width and total height.

 



$products = $params['cart']->getProducts(true);

$alto = 0;
$ancho = 0;
$largo = 0;
$peso = 0;

foreach ($products as $product) {
$peso = $peso + $product['weight'];
$alto = $alto + $product['height'];
$ancho = $ancho + $product['width'];
$largo = $largo + $product['depth'];
}


 

Can someone tell me how to get all products in the cart, counting the units of each.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...