Post by farooqashraf » Sat May 30, 2015 5:16 pm

I am in process of creating OpenCart RESTful APIs for an android application. Now I have created an API which would login the customer. No issue. But I don't know how can I handle session cart for each customer who is logged in through android app.

Is there any Token maintained by OpenCart or any cart session variable which I can use.

I saw somewhere in source "$this->session->data['cart']" but couldn't understand its function properly.

Thanks for the help

Newbie

Posts

Joined
Sat May 30, 2015 5:15 pm

Post by straightlight » Sun Jun 28, 2015 10:56 pm

farooqashraf wrote:I am in process of creating OpenCart RESTful APIs for an android application. Now I have created an API which would login the customer. No issue. But I don't know how can I handle session cart for each customer who is logged in through android app.

Is there any Token maintained by OpenCart or any cart session variable which I can use.

I saw somewhere in source "$this->session->data['cart']" but couldn't understand its function properly.

Thanks for the help
The $this->session->data['cart'] object is identical to: $_SESSION['cart'] . It passes the super global array to the browser from jQuery, in this case, to add the products to the cart on the top-right of the template. Then, the controllers, models and templates can recall the class and the method by using: $this->cart->getProducts() . However, $this->session->data['cart'] can still be used at anytime only without any featured calculations while $this->cart->getProducts() returns a massive array of keys and values that contains calculated information based on the admin's end preferences that are specifically set by the merchant.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON
Who is online

Users browsing this forum: No registered users and 2 guests