Post by Yossif_Rahiya » Sat Sep 02, 2017 8:54 pm

Why can't I call the methods defined in system/library/cart.php from the controller files for the admin panel?

Examples:
1) Trying to call $this->cart->clear(); from admin/controller/sale/order.php produces an error, as if the method didn't exist.
2) On the other hand $this->session->getId(); works fine when called from the same place.
3) When $this->cart->clear(); is called from catalog/controller/api/cart.php it works fine.

My OpenCart Version is 2.0.3.1.

Newbie

Posts

Joined
Wed Nov 23, 2016 1:37 am

Post by daveyoi » Sun Sep 03, 2017 5:13 pm

The cart library is not loaded into the registry in the admin application, you should use the API as you mention to interact with a customers cart from the admin panel.

Image
Tristar Web Solutions


New member

Posts

Joined
Sun Oct 05, 2014 2:38 am

Post by Yossif_Rahiya » Sun Sep 03, 2017 7:46 pm

Daveyoi, thank you for the reply! Yes, indeed the cart library isn't loaded in admin/index.php as it is loaded in the main index file for the catalog.

Newbie

Posts

Joined
Wed Nov 23, 2016 1:37 am
Who is online

Users browsing this forum: No registered users and 311 guests