Jump to content

What controls when something is added to cart? Need to make a few changes.


hanny137

Recommended Posts

When I click 'Add To Cart', where is that controlled?

 

I need to change some of the information being passed back via ajax - but cannot find where to edit in order to make that adjustment.

 

I want to adjust the product customization text field (add something to it); do I do that in CartController?

 

It looks like the request is AJAX - so is there a JS file where I would be better suited to adjust it?

Edited by hanny137 (see edit history)
Link to comment
Share on other sites

Please check following file

 

/controllers/front/CartController.php

 

The add/delete/update products is in following controller method, Even the ajax call is posted to this 

    public function postProcess()
    {
        // Update the cart ONLY if $this->cookies are available, in order to avoid ghost carts created by bots
        if ($this->context->cookie->exists() && !$this->errors && !($this->context->customer->isLogged() && !$this->isTokenValid())) {
            if (Tools::getIsset('add') || Tools::getIsset('update')) {
                $this->processChangeProductInCart();
            } elseif (Tools::getIsset('delete')) {
                $this->processDeleteProductInCart();
            } elseif (Tools::getIsset('changeAddressDelivery')) {
            ...................


Link to comment
Share on other sites

I think the ajax call is from module blockcart.

The "Add to cart" button click is override from that module, and when user click "Add to cart" button, it will make an ajax call.

You can look into following file

/modules/blockcart/ajax-cart.js

 

Above is for default theme, different theme may also change the behaviour a little bit.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...