Page 1 of 1

Modification of Cart (Header & Page) OpenCart 3.0.3.1

Posted: Thu Mar 21, 2019 3:24 am
by FIITGuy
Hello,

I'm trying to make a modification in the way quantities are displayed but have encountered a problem. I've tried to pass a new parameter to the cart controller for display in the cart page and cart widget in the header but I've been unable to find where the cart controller gets it's data. I'm unable to find any model for the cart and can't find the function called getProducts() (Where it's defined and the data retrieved specified.).

Does anyone have any pointers on where to find this function so I can pass the appropriate data to the controller? Also, why the cart controller doesn't have a model? (A little weird for an MVC-L framework.)

Re: Modification of Cart (Header & Page) OpenCart 3.0.3.1

Posted: Sat Mar 23, 2019 2:33 am
by ocmta
Look into this file: /system/library/cart/cart.php

Re: Modification of Cart (Header & Page) OpenCart 3.0.3.1

Posted: Thu Apr 25, 2019 8:03 pm
by cedcommerceteam
Heyya FIITGuy,

Here's your answer!

You can see in catalog/controller/checkout/cart.php at line no .58

$products = $this->cart->getProducts();

here it get data from cart library.

you can see in startup.php the cart object is set in registry

// Cart
$this->registry->set('cart', new Cart\Cart($this->registry));

and accessible at controller as $this->cart

you can check all funtions related cart at below path

system/library/cart/cart.php

and make desired changes in data