Jump to content
Pechy.cz

PS 1.7.x: Problem with Cookies? Sometime not working AddToCart

Recommended Posts

Hi,

first i want to apologize for bad English...

 

So..

I have big troubles with PS 1.7. ...

Problems was in version 1.7.0, now also in 1.7.2.

 

Sometime, when i click to Add product to cart, nothing happens (empty modal shows).

To explain it:

First is called ajax for adding to cart. -> result is success

Second is called ajax for refresh cart and display modal -> here is problem visible, because modal is show without product due to cart is still empty.

When i have some product in cart, this problem will not happen.

Its only when is cart empty and what's worst, only sometime.

I was spend lot of hours of debug and trying to reproduce, but without result.

 

So I discovered one problem, but I did not understand.

It will be something with cookies, because:

 

Several cases looked like when adding to a cart, a new cart was created, but after ajax/refresh this cart was not in cookie->id_cart. So every, when i click to add to cart, a new cart was created and ajax to show cart return empty cart.

More cases was after placing order. Cart was not removed from cookie after order. So immediately FrontController::init log error with loading cart, which has already been used for the order.

The customer also reported one problem that even after his logout, his cart remained at his disposal.

 

That's why I think there's a problem with Cookie...

Maybe bad server conf, i do not know.... 

 

I do not know what to do next...

Now iam on PS 1.7.2.0 and Apache/2.4.6 (CentOS) OpenSSL/1.0.1e-fips mod_fcgid/2.3.9 PHP/7.0.21

Localhost is on PHP7.0.9, Windows, MAMP with Apache.

I have PS on SSL.

 

Has anyone encountered this problem?

Is there any quick fix for repair?

Edited by Pechy.cz (see edit history)

Share this post


Link to post
Share on other sites

Same here.

 

Prestashop 1.7.2.2

 

When adding to cart the first time its OK.

If I change to combination that has 2 minimal quantity I can add it to cart.

When I change back to where minimal quantity is 1 can't add to cart. In the html the minimal quantity is set to 2 (from the last product), not error message, nothing. The button doesn't work. Sometimes it adds for the second time 2 x last option selected (not the actual one).

Only can add minimum 2 where Minimum Quantity Required for this Option is 1.

 

It's happening from 1.7.2.0 I think.

 

Help please.

Share this post


Link to post
Share on other sites

Same issue here. We even deleted and re-installed a fresh installation of 1.7.2...still having the issue, but can't replicate consistently or narrow down the exact cause.

 

Some notes:

1. Only happens when the cart is empty.

2. Sometimes turning ajax cart on and off in module settings will work but I don't understand why that would be.

3. Using Dev Console - Cart shows post to cart as "True" and ajax shows "sucessfully added to cart"...but no picture/price/qty shows in the cart display. Clicking to checkout shows you have an empty cart.

 

This is output when it works:

Cart Output:

  1. success: true, id_product: 1, id_product_attribute: 0, quantity: 1,…}
    1. cart:{products: [,…], totals: {total: {type: "total", label: "Total", amount: 15.75, value: "CA$15.75"},…},…}
    2. id_product:1
    3. id_product_attribute:0
    4. quantity:1
    5. success:true
    6.  
    7.  
    8.  

Ajax output:

  1.  
    1. {,…}
      1. modal:"<div id="blockcart-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">↵ <div class="modal-dialog" role="document">↵ <div class="modal-content">↵ <div class="modal-header">↵ <button type="button" class="close" data-dismiss="modal" aria-label="Close">↵ <span aria-hidden="true">×</span>↵ </button>↵ <h4 class="modal-title h6 text-sm-center" id="myModalLabel"><i class="material-icons"></i>Product successfully added to your shopping cart</h4>↵ </div>↵ <div class="modal-body">↵ <div class="row">↵ <div class="col-md-5 divide-right">↵ <div class="row">↵ <div class="col-md-6">↵ <img class="product-image" src="https://myshopnamehere.com/shop/1-home_default/laundry-soap.jpg" alt="" title="" itemprop="image">↵ </div>↵ <div class="col-md-6">↵ <h6 class="h6 product-name">Laundry Soap</h6>↵ <p>CA$10.50</p>↵ ↵ <p><strong>Quantity:</strong> 1</p>↵ </div>↵ </div>↵ </div>↵ <div class="col-md-7">↵ <div class="cart-content">↵ <p class="cart-products-count">There is 1 item in your cart.</p>↵ <p><strong>Total products:</strong> CA$10.50</p>↵ <p><strong>Total shipping:</strong> CA$5.25 </p>↵ <p><strong>Included taxes</strong> CA$0.75</p>↵ <p><strong>Total:</strong> CA$15.75 (tax incl.)</p>↵ <div class="cart-content-btn">↵ <button type="button" class="btn btn-secondary" data-dismiss="modal">Continue shopping</button>↵ <a href="//myshopnamehere.com/shop/en/cart?action=show" class="btn btn-primary"><i class="material-icons"></i>Proceed to checkout</a>↵ </div>↵ </div>↵ </div>↵ </div>↵ </div>↵ </div>↵ </div>↵</div>↵"
      2. preview:"<div id="_desktop_cart">↵ <div class="blockcart cart-preview active" data-refresh-url="//myshopnamehere.com/shop/en/module/ps_shoppingcart/ajax">↵ <div class="header">↵ <a rel="nofollow" href="//myshopnamehere.com/shop/en/cart?action=show">↵ <i class="material-icons shopping-cart">shopping_cart</i>↵ <span class="hidden-sm-down">Cart</span>↵ <span class="cart-products-count">(1)</span>↵ </a>↵ </div>↵ </div>↵</div>↵"
    2.  
    3.  
    4.  
    5.  
  2.  
  3.  
  4. Output when it doesn't:
  5. Cart Output:
    1. {success: true, id_product: 1, id_product_attribute: 0, quantity: 1,…}
      1. cart:{products: [,…], totals: {total: {type: "total", label: "Total", amount: 15.75, value: "CA$15.75"},…},…}
      2. id_product:1
      3. id_product_attribute:0
      4. quantity:1
      5. success:true
      6.  
      7.  

Ajax output:

 

    1. {,…}
      1. modal:"<div id="blockcart-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">↵ <div class="modal-dialog" role="document">↵ <div class="modal-content">↵ <div class="modal-header">↵ <button type="button" class="close" data-dismiss="modal" aria-label="Close">↵ <span aria-hidden="true">×</span>↵ </button>↵ <h4 class="modal-title h6 text-sm-center" id="myModalLabel"><i class="material-icons"></i>Product successfully added to your shopping cart</h4>↵ </div>↵ <div class="modal-body">↵ <div class="row">↵ <div class="col-md-5 divide-right">↵ <div class="row">↵ <div class="col-md-6">↵ <img class="product-image" src="" alt="" title="" itemprop="image">↵ </div>↵ <div class="col-md-6">↵ <h6 class="h6 product-name"></h6>↵ <p></p>↵ ↵ <p><strong>Quantity:</strong> </p>↵ </div>↵ </div>↵ </div>↵ <div class="col-md-7">↵ <div class="cart-content">↵ <p class="cart-products-count">There is 0 item in your cart.</p>↵ <p><strong>Total products:</strong> CA$0.00</p>↵ <p><strong>Total shipping:</strong> Free </p>↵ <p><strong>Included taxes</strong> CA$0.00</p>↵ <p><strong>Total:</strong> CA$0.00 (tax incl.)</p>↵ <div class="cart-content-btn">↵ <button type="button" class="btn btn-secondary" data-dismiss="modal">Continue shopping</button>↵ <a href="//myshopnamehere.com/shop/en/cart?action=show" class="btn btn-primary"><i class="material-icons"></i>Proceed to checkout</a>↵ </div>↵ </div>↵ </div>↵ </div>↵ </div>↵ </div>↵ </div>↵</div>↵"
      2. preview:"<div id="_desktop_cart">↵ <div class="blockcart cart-preview inactive" data-refresh-url="//myshopnamehere.com/shop/en/module/ps_shoppingcart/ajax">↵ <div class="header">↵ <i class="material-icons shopping-cart">shopping_cart</i>↵ <span class="hidden-sm-down">Cart</span>↵ <span class="cart-products-count">(0)</span>↵ </div>↵ </div>↵</div>↵"

 

 

Any ideas??? Fighting this ghost for 2 weeks now.

Edited by kellyriverstone (see edit history)

Share this post


Link to post
Share on other sites

Hi,

i dont know, if is issue for you, but we finally found our problem.

 

We have fresh install PS 1.7.x, but we migrate data from old store (customers/products/orders).

And here was the problem.

 

We migrate old orders, where have id_cart saved.

But carts are not migrated, then started with id from 1.

 

So, when id_cart was same with id_cart from old order, here was a problem a cart cannot be use. (Due to protection of using carts with finished orders)

 

So solution was go to database and increase AUTOINCREMENT for column id in table cart to higher, than is higher id_cart in orders.

Edited by Pechy.cz (see edit history)
  • Like 4

Share this post


Link to post
Share on other sites

Genius! :) Many thanks. Just cross checked carts missing in action against carts that actually got built and you are correct. There is a conflict between old orders created from carts in our last PS installation and our new store. Thank you! Setting the operand of AUTOINCREMENT past highest number showing in orders looks like it solved the issue and makes sense as to why it seemed random.

Edited by kellyriverstone (see edit history)

Share this post


Link to post
Share on other sites

It's an good idea but not the solution on my problem :(

Or find the error that goes back because I have no track...

My problem is the same : core.js:39 POST /module/ps_shoppingcart/ajax ERROR 500

I have just migrated the data from Migro (1.5 to 1.7.6)

Share this post


Link to post
Share on other sites

Ok, I replace all file in  ps_shoppincart folder and now it's ok.....

Thanks for solution autoincrement after migration.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More