Jump to content

1.5.2 Add to Cart Nothing Happens


Recommended Posts

Hello mcamp7, thank you for this message. In order to better understand the situation, lets first find out if there are any errors on your store. Please edit you /config/config.inc.php file around line 29 "Display Errors" and set it to "ON"

 

Then you can browse the pages of your front and back office and let me know if you see any errors.

 

Thank you!

Link to comment
Share on other sites

Yes I do. When the quantities get reset to 0 the product shows as out of stock in Front Office. In my case, the product shows as In Stock, but the add to cart button is not clickable.

 

Please see one of my websites in a multistore group that does not have Share quantities enabled, and notice that the add to cart is working:

 

http://shops.teamnetworkusa.com/index.php?id_product=3&controller=product

 

Here is the same product on a website with share quantities enabled:

 

http://achastore.com/fgcu/index.php?id_product=3&controller=product

Link to comment
Share on other sites

Hi... i have configured a multistore and shared quantities. But the problem is when i add to cart any product flying effect works but cart remains empty.

I am using PS 1.5.2.0 fresh install.

 

If my product does not have combinations then I can click add to cart, the flying effect happens, my cart even says "1 product in cart" but when I click on the cart the total price is 0.00 and no items showing.

Link to comment
Share on other sites

Hi, I also test these multistore feature. So the easiest way is to edit your domain aliases, if you want to use 3 domains, you choose which will be the root folder of all sites. That is the domain which aliases you need to edit (add) domain2 and domain3 in the configuration file. Don't forget to clear very often your browser cache because it is possible that you can not see your changes after 3-4 refreshes of the site. After aliases in back end of the store enable the multistore function in preferences -->general tab, then go to the new multistore button under advanced parameters, click on the default group on the left of the screen and click add new store. Fill the name of the shop, click save, than you will be asked to enter the URL of this new store, click and add the real URL of the new shop, which you have added like allias for the main URL. After saving that you can clear cache of your browser and you must have it! If you want to share orders, but you cannot click on that setting in the options of the default group, that means that you need to erase the 1 order of the shop, which you have it by default John DOE order #1, after that you will be able to share orders on all shops in that group. That goes for the customers sharing too. That is fine very nice job Pesta Shop Team! Awsome.

But if it is a multistore, and customers and order sharing is set to "YES", why customers need to re-login to every single store separately, to make a purchase. I think that account should be shared between the sites, if you login at domain2, you should be able when go to domain1 or domain3 to have your account active. And it is extremely important to have shared cart between sites, otherwise if i want 7 different products from 3 diff stores, I should make 3 orders separately, in every site, so where is the multistore?!? I see other people also asking that question and there is no clear answer to that issue, or maybe we will wait to see some new module in the addons section?

Link to comment
Share on other sites

Share orders:

Once this option is enabled (which is only possible if customers and available quantities are shared among shops), the customer's cart will be shared among all the shops in this group. This way, any purchase started on one of the shops in this group will be able to be finished in another shop from the same shop group. Warning: you will not be able to disable this option once you have orders on at least one shop of this group. That is what should be in fact i can't or don't know how sharing carts between site work. It is all set but not working. It is all testing server and sites, if someone is interested to see what settings do i have check www.geboya.com/admin123 email: [email protected] password: aaa333aaa. Tell me where is my mistake, i want this thing working.

Edited by pepperr (see edit history)
  • Like 1
Link to comment
Share on other sites

i think it's DNS problem from your registrar ! you can translate this thread : http://www.prestasho...post__p__984672

message #7 & #9

 

Essentially the advice is to use the url with www. in front -

What's so strange is that doing this actually allows me to click the Add to Cart button, which wasn't happening before. However, it still gives me an empty cart.

As soon as I turn Share Quantities off for this group of stores, I am able to see my products in cart. However I have great need to have this Share Quantities feature working...

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

it's work for me !

 

New config :

 

DNS zone

mysite.com A 8.8.8.8

www.mysite.com CNAME mysite.com

 

BO presta : mysite.com

 

Old config :

DNS zone

mysite.com A 8.8.8.8

www.mysite.com A 8.8.8.8

 

BO presta : www.mysite.com

 

cr-cheap, you are not able to add to cart with share quantities enabled??

Link to comment
Share on other sites

I am having the same type of problem but the issue happens when I try to add the item to a cart outside of Canada. I'm working on this for my friend in Trinidad. When he tries to add any item to the cart, the item flies into the cart. It says one item. When he clicks on the cart, it is empty. I have the shop setup for both Canada and Trinidad countries but am stumped here. It works when I try the transaction in Canada.

 

Benjamin or anyone, any ideas?

 

[Edit] I'm using PS 1.5.1 This is a single shop not multishop install.

Edited by Presta Newbie Too (see edit history)
Link to comment
Share on other sites

Same problem here, add to cart but cart stays empty, just in google chrome the cart works.

I turned off cache, reinstalled cart module but didnt work.

Reading the firefox console after add to cart it looks like the product is empty:

 

{ "products": [ ], "discounts": [ ], "shippingCost": "0,00 €", "shippingCostFloat": "0", "wrappingCost": "0,00 €", "nbTotalProducts": "0", "total": "0,00 €", "productTotal": "0,00 €", "hasError" : false }

 

Stock turned off in my case

Link to comment
Share on other sites

  • 2 weeks later...

Same over here, cart is empty after click on cart, i have followed all steps written in the forums, this is really an bad issue and i hope it will be fixt verry fast because i lose many customers about. This.... Let me know if you need some information..

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...

We were experiencing this problem too - here's a quick list of all the symtoms we encountered:

 

You can't login to the store as a customer through the front end. If you get the password wrong it still gives you authentication errors, but a correct password just dumps you back to the login page with no errors. Despite this, you can login to the admin area just fine.

 

You can't add products to your cart. as jsonjuri pointed out, the ajax response comes back as:

{ "products": [ ], "discounts": [ ], "shippingCost": "0,00 €", "shippingCostFloat": "0", "wrappingCost": "0,00 €", "nbTotalProducts": "0", "total": "0,00 €", "productTotal": "0,00 €", "hasError" : false }

 

On our custom theme, attempting to load the cart page, which would normally show "You have no items" instead showed an empty page with the header/footer.

 

Switching on error reporting revealed no issues.


This particular issue on our server was due to Cookies not being set or updated correctly.

 

We tested this by using Chrome Debugger or Firebug on Firefox to inspect the cookies.

Firstly, clear all your cookies (Ctrl+Shift+O on Firebug) and then load the Product page. If cookies are working this should initiate a new session without a cart yet assigned.

 

If this doesn't happen, then Context->cookie->write(); (which writes the cookies) is never getting called, and you've encountered the bug.

Since Prestashop 1.5.2, the cookie writed should be called by FrontControllerCore::smartyOutputContent($layout). Our particular problem was we had overridden the display() function in FrontController in 1.5.0, which used to call Smarty directly using $this->context->smarty->display($layout);

 

Simply put, make sure you're not calling smarty directly in your FrontController overrides, which might be hanging around from previous versions. Instead you should be calling $this->smartyOutputContent($layout).

 

Once this is done, you should see the cookie appear, and the default theme's Add To Cart via AJAX should work.


Bonus round: You still can't login

 

If you find you still can't login as a customer, and the login form doesn't give you any validation errors when you get the user/pass right, this can also be caused by the store not updating the cookies correctly on a redirect.

 

Long story short, crack open /classes/Tools.php and modify the end of the redirect function in the following manner (~line 110):

 

	}
	// Update cookies
	Context::getContext()->cookie->write();
	header('Location: '.$url);
	exit;
}

 

What we're doing here is firing the Cookie writer before the redirect is issued, ensuring the cookie is updated on client.


Why did this happen

 

In some instances (eg. redirect) Prestashop relies on the Cookie destructor to call the Cookie writer. Essentially when Prestashop exit()s the garbage collector goes around and fires the destructors (randomly?) and then kills the object. This can also happen if you unset() the Cookie object.

The destructor on the Cookie object calls $this->write() which should write out the cookies to the client.

 

Unfortunately on some servers under some conditions (PHP version?) it appears the destructors are unreliable - object data might already be trashed or the destructor might not call at all. You also have the issue that headers could already be sent, in which case it won't write.

 

What the changes above do is ensure the Cookies are written at an appropriate time. I can see why this feature is in, but you shouldn't rely on it as a method to write your cookies - it should only be there as a failsafe for other peoples legacy modules.


This wasn't my problem and it's still happening

 

Alright, you'll have to get your hands dirty but here's a quick rundown of how you can debug Add To Cart:

 

Crack open /controllers/front/CartController.php

Go to the postProcess function - this is where the AJAX call from Add To Cart gets dispatched.

On line 68 there's a check for the "add" post variable, which is sent by the AJAX request. This calls $this->processChangeProductInCart();

Go to processChangeProductInCart and after line 213 is where the store first checks for the existance of a cart (you shouldn't yet have one) and then loads the product and tries to add it to your cart.

Do the old trick of adding a die('here'); statement and print_r(); any variables which might be enlightening. Unfortunately I can't step you through the full debug process, but this should reveal why this code is failing.

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Hi linster, huko is correct. You need to delete the three lines (333-336) below in your file classes/shop/Shop.php

 

// Optimization - don't redirect and allow WS and other script to work

if (!$id_shop)

$id_shop = Configuration::get('PS_SHOP_DEFAULT');

 

Here is the GitHub link with details: https://github.com/PrestaShop/PrestaShop/commit/93038e45f80c0fbe31cfd61432c2826fe701c916

 

Always make sure you complete a working backup of all databases and files before you change any code. Thanks!

Link to comment
Share on other sites

  • 2 weeks later...

I have deleted:

 

// Optimization - don't redirect and allow WS and other script to work

if (!$id_shop)

$id_shop = Configuration::get('PS_SHOP_DEFAULT');

 

But still impossible to buy anything.

 

I'm using the 1.5.2 version. This bug is present in the 1.5.3.1?

 

Thanks

Edited by AL-DEV (see edit history)
Link to comment
Share on other sites

I have deleted:

 

// Optimization - don't redirect and allow WS and other script to work

if (!$id_shop)

$id_shop = Configuration::get('PS_SHOP_DEFAULT');

 

But still impossible to buy anything.

 

I'm using the 1.5.2 version. This bug is present in the 1.5.3.1?

 

Thanks

 

I have the same issue with same version. Can anyone help? Thank you.

Link to comment
Share on other sites

  • 4 weeks later...
  • 2 weeks later...

Hi @ all,

 

thats fix it for me:

 

I had set www.racebike4u.de set as default-Domain. And racebike4u.de as non-default, but active-Domain. That DIDN't work at all.

 

After i have set racebike4u.de as default-domain, and www.racebike4u.de as active (but non default) it works well on racebike4u.de, but www.racebike4u.de was also available as own subdomain.

 

After i have activate SEO-URL, www.racebike4u.de is redirected to racebike4u.de - for now it may work... will see :)

 

IMPORTANT:

Keep in Mind: The error on my Shop was not cause of the ajax-module for shopping-cart. Cause if i deactivate this, and buy a Product, Presta switch directly to the cart, but this was empty (even if ajax-cart-module was deactivatet)

Edited by rethus (see edit history)
  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...