0
votes

Currently we are working on Magento 1.5 and we want to upgrade it to the newest Magento version. Several attempts resulted in an 'add to cart' problem. This problem occurs shows up when a product is selected and you try to add it to the cart. Clicking on add to cart redirects you to the cart page saying: "Kan dit artikel niet toevoegen aan de winkelwagen", which means you can not add this article to the cart.

How to reproduce it? 1) I install the same version (1.5.0.1) of Magento as the current live version on a different server/domain. 2) Delete the database and replace it with the db of the live version. 3) Change the web/unsecure/base_url and secure base url in config_core_data 4) Test to add a product to the cart (still works here). 5) Update the version to latest Magento version. This is done through magento connect and/or via SSH. I also installed the magento 1.8 version over my files after an advice here. 6) After the update the aforementioned add to cart problem occurs. I dont see any errors appearing in the console of chrome/firefox and in Magento.

Implementing the cookie life time and the noconflict-code did not have any effect. I also tried to install different versions at step 1. Can you please help me?

UPDATE: Add to cart still works after upgrading 1.5 to 1.6, but does not work after upgrading 1.6 to 1.7

After some debugging I found out that the error is caused by the next call in app/code/core/Mage/Checkout/Model/cart.php :

$this->getQuote()->getShippingAddress()->setCollectShippingRates(true);

Which is in the function:

public function save()
   {
    Mage::dispatchEvent('checkout_cart_save_before', array('cart'=>$this));

    $this->getQuote()->getBillingAddress();
    $this->getQuote()->getShippingAddress()->setCollectShippingRates(true);
    $this->getQuote()->collectTotals();
    $this->getQuote()->save();
    $this->getCheckoutSession()->setQuoteId($this->getQuote()->getId());
    /**
     * Cart save usually called after changes with cart items.
     */
    Mage::dispatchEvent('checkout_cart_save_after', array('cart'=>$this));
    return $this;
}

Anyone know how I can fix this?

3
Hi, try to reindex all the database data. Clear magento/var folder.Martin

3 Answers

0
votes

You should do the following. Helper for me.

  1. Clear cache
  2. Reindex everything
  3. Add cookie lifetime
  4. Set Cookies - Use HTTP Only to NO
  5. check if all folder permissions are the same

If all these wont help consider debuging AddToCart controller.

Hope that helps at least a little.

0
votes

There is an extension called : Amasty_Xcoupon , turn this off to get it working. Turn it of in the XML File and NOT in the backend

0
votes

Form Key is essential to add product to cart in magento. Add this code just after form tag in catalog/product/view.phtml of your template:

<?php echo $this->getBlockHtml('formkey') ?>