Jump to content

Array results from getProduct from Cart


InnovatecInc

Recommended Posts

Hi there

 

I am adapting our Prestashop to allow for our courier

 

 

At this stage I am pulling the array from the Cart via getProduct and I receive a multidimensional array

 

$prodArr = Context::getContext()->cart->getProducts();

 

But if I have two items in my cart my output looks like this"

 

Key: 0; Value: Array
Key: 1; Value: Array
Key: 0; Value: Array
Key: 1; Value: Array

 

when it should be:

 

Key: 0; Value: Array

Key: 1; Value: Array

 

why are does the array duplicate the products?

 

Steve

Link to comment
Share on other sites

Thanks for your reply.

 

I added it into the function getTotalShippingCost.

 

At this point I call my function PostCal which queries the products in the cart to gain custom information - cubic meters etc - of the items, then it returns a shipping price based on the delivery postcode of the customer and the rates of our courier. 

 

It is in a loop as when I exit() after my query I get one set of data for the cart.

 

I am really new to the Prestashop framework and still trying to unravel the processes. :-) So if you can help illuminate me on the cart process I would be happy.

 

Steve

Edited by InnovatecInc (see edit history)
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...