Jump to content

Problem with cart updating in prestashop 1.7.2


Recommended Posts

I ve a problem with the cart update:

everything works fine if i refresh page, but if i try to change quantity of products o delete a product, nothing happen (if i don't refresh the page).

 

This is the error of my chrome console:

 

ERROR WHEN I UPDATE QTY

core.js:3 Uncaught TypeError: Cannot read property 'cart' of undefined at Object.<anonymous> (core.js:3) at Object.n.emit (theme.js:276) at Object.<anonymous> (theme.js:180) at Object.<anonymous> (core.js:2) at u (core.js:2) at Object.fireWith [as resolveWith] (core.js:2) at r (core.js:3) at XMLHttpRequest.<anonymous> (core.js:3)

 
 
 
 
 
 
 

ERRORE WHEN I TRY TO DELETE A PRODUCT

 

core.js:3 Uncaught TypeError: Cannot read property 'cart' of undefined at Object.<anonymous> (core.js:3) at Object.n.emit (theme.js:276) at Object.<anonymous> (theme.js:180) at Object.<anonymous> (core.js:2) at u (core.js:2) at Object.fireWith [as resolveWith] (core.js:2) at r (core.js:3) at XMLHttpRequest.<anonymous> (core.js:3)

 

Link to comment
Share on other sites

  • 2 months later...
  • 4 years later...
  • 1 month later...
On 11/17/2021 at 10:00 AM, nawres said:

Same problem after upgrade my site  , so I'm  trying to change the function  UpdateCart in the file (/themes/core.js) :

 before : 

o.default.cart = e.resp.cart;

after 

o.default.cart = e.reason.cart;

it works in my case 

Thanks, that solved the problem with the delete product in the cart page.

jQuery.Deferred exception: Cannot read properties of undefined (reading 'cart') TypeError: Cannot read properties of undefined (reading 'cart')

 

Link to comment
Share on other sites

  • 1 month later...

Hello,

I have this behaviour on my site https://pharmanovea.com and I have change core.js like you mention but when I debug the file in devlopement tools is not changed.

Cache is disabled and smartcache for js also.

The strange thing is when I try with a clone https://presta17.pharmanovea.com the problem of ajax refresh disapears when I disable the javascript smartcache but this is not working in my production version.

Thanks helping me with this.

Jean-Marie

Link to comment
Share on other sites

  • 4 weeks later...

try executing this line in javascript after deleting a product or updating it:
 

prestashop.emit('updateCart', {resp: 'test'})


in case it says "e.anyWord is undefined". You have to change "resp" to "anyWord" for example:

 

prestashop.emit('updateCart', {anyWord: 'test'})

 

  • Thanks 1
Link to comment
Share on other sites

  • 4 weeks later...
  • 1 month later...

 

On 8/4/2017 at 11:08 AM, Elgade said:

core.js:3 Uncaught TypeError: Cannot read property 'cart' of undefined at Object.<anonymous> (core.js:3) at Object.n.emit (theme.js:276) at Object.<anonymous> (theme.js:180) at Object.<anonymous> (core.js:2) at u (core.js:2) at Object.fireWith [as resolveWith] (core.js:2) at r (core.js:3) at XMLHttpRequest.<anonymous> (core.js:3)

I was seeing this error when adding a product to the cart from any button, or deleting the product in cart page or side cart. The cart was updated, but page was loaded most of the times for ever, so yu had to manually reload the page to see the updated cart.

 

On 11/17/2021 at 10:00 AM, nawres said:

Same problem after upgrade my site  , so I'm  trying to change the function  UpdateCart in the file (/themes/core.js) :

 before : 

o.default.cart = e.resp.cart;

after 

o.default.cart = e.reason.cart;

it works in my case 

This solved my problem. Problem appeared after upgrading to 1.7.8.5 from 1.7.6.5. Custom theme.

How did you find this solution if easy to explain?

Thank you!!

Link to comment
Share on other sites

  • 2 months later...

To solve this, I had to copy the theme/classic/assets/js folder to my current theme and also, replace the theme/cores.js with the original file from the same version as my store. I had to download the Prestashop in the same version as replace the file.

 

Thanks @kornwaikas

Edited by fredericomarinho.com
wrong word (see edit history)
Link to comment
Share on other sites

  • 4 weeks later...
  • 2 months later...
On 11/17/2021 at 11:00 AM, nawres said:

Same problem after upgrade my site  , so I'm  trying to change the function  UpdateCart in the file (/themes/core.js) :

 before : 

o.default.cart = e.resp.cart;

after 

o.default.cart = e.reason.cart;

it works in my case 

Worked in ps 1787 

Link to comment
Share on other sites

  • 10 months later...
On 11/17/2021 at 10:00 AM, nawres said:

Same problem after upgrade my site  , so I'm  trying to change the function  UpdateCart in the file (/themes/core.js) :

 before : 

o.default.cart = e.resp.cart;

after 

o.default.cart = e.reason.cart;

it works in my case 

Worked on 1.7.8 also... and it was so easy to fix thanks to this perfectly explained solution!!!

Link to comment
Share on other sites

  • 5 months later...
On 11/17/2021 at 10:00 AM, nawres said:

Same problem after upgrade my site  , so I'm  trying to change the function  UpdateCart in the file (/themes/core.js) :

 before : 

o.default.cart = e.resp.cart;

after 

o.default.cart = e.reason.cart;

it works in my case 

Yes!, this solved the problem :):) :)

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...