InnovatecInc Posted September 9, 2014 Share Posted September 9, 2014 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: ArrayKey: 1; Value: ArrayKey: 0; Value: ArrayKey: 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 More sharing options...
PhpMadman Posted September 9, 2014 Share Posted September 9, 2014 We need to see more code to answer that. Where exactly is your line of code placed? My guess it's placed in a loop or a function that get's executed for each product. Link to comment Share on other sites More sharing options...
InnovatecInc Posted September 9, 2014 Author Share Posted September 9, 2014 (edited) 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 September 9, 2014 by InnovatecInc (see edit history) Link to comment Share on other sites More sharing options...
PhpMadman Posted September 10, 2014 Share Posted September 10, 2014 I was correct it's called twice. https://github.com/PrestaShop/PrestaShop/blob/1.6/controllers/admin/AdminOrdersController.php#L1928 On that line and the line bellow, there for you get 2 outputs Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now