P
P
Pavel Kornilov2017-10-03 13:10:35
PHP
Pavel Kornilov, 2017-10-03 13:10:35

Add item to cart opencart?

Hello, friends!
There is a form filled out by the client. The question is how to add data from it to the opencart basket ? Interested in the path to the controller / handler file, as well as the API of the addition itself.
For example:


file - ...
class - ...
methods - ... (with min. explanation)

I am not familiar with CMS at all, I will be glad to any tips, directions and effective messages.
Yandex did not give anything sensible.
Thank you in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zoozag, 2017-10-03
@KorniloFF

If you want to add from the front, then make a post request to this address
index.php?route=checkout/cart/add
Accordingly, the controller:
catalog/checkout/cart.php method add ()
There, in addition to adding to the cart, different checks pass
For the addition itself the following line responds to the cart:
$this->cart->add($this->request->post['product_id'], $quantity, $option, $recurring_id);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question