Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email

Magento Forum

Multistore: Can’t add to cart from product view - wrong URL in productAddToCartForm.sumbit
Jr. Member
Total Posts:  4
Joined:  2012-11-13

Hi everyone.
I have a problem with add to cart on product pages in a Magento Multistore and it’s driving me insane. Whenever I try to add a product to the cart from the second website (which houses the second store), I get “article could not be added to the cart”. This is because the action on the button – getSubmitUrl – transmits the wrong product URL.
Please please help.

Here’s the situation in detail:
I have a installed a new Magento 1.7 Community Edition that is supposed to run both a b2c store and a b2b store. For this, I made two websites in the system configuration, each with two stores and each store with two store views for German and English.
Both b2b and b2c share the same catalogue, but prices, taxes, customer registration and a bunch of other things will be different. However, none of these things are implemented yet and the installation is completely new.

The main magento installation is here:
It points to the b2c website. Everything works perfectly here.

For the b2b website, I created the subfolder
It contains the adapted index.php and the ht.access

The website configuration of the b2b website is the same for secure and unsecured:
Base URL -
Base Link URL -
Everything else is set to default.

This is what happens
If you want to add a simple product to the cart in the b2b store, it works from the list view but not from the product view. For the product view, I get “article can’t be added to cart”.
In the list view, the “add to cart” button calls the function

onclick=\\\"setLocation(\\\'<?php echo $this->getAddToCartUrl($_product) ?>\\\')\\\"
which works fine.
In the product view, the button calls
which transmits the wrong URL: It should return, but it returns - it includes the subfolder.
The form in productAddToCartForm calls the action

That seems to reference the Base Link URL that I put in the settings, not the Base URL. But if I change the Base Link URL in the configuration, the b2b store can’t be called at all and immediately switches to the b2c version.
Sort of defeating the whole purpose of the whole thing.
Now I found the problematic function productAddToCartForm in the Abstract.php and it says:

    public function getAddToCartUrl($product, $additional = array())
        if ($product->getTypeInstance(true)->hasRequiredOptions($product)) {
            if (!isset($additional[\\\'_escape\\\'])) {
                $additional[\\\'_escape\\\'] = true;
            if (!isset($additional[\\\'_query\\\'])) {
                $additional[\\\'_query\\\'] = array();
            $additional[\\\'_query\\\'][\\\'options\\\'] = \\\'cart\\\';

            return $this->getProductUrl($product, $additional);
        return $this->helper(\\\'checkout/cart\\\')->getAddUrl($product, $additional);

public function getSubmitUrl($product, $additional = array())
        $submitRouteData = $this->getData(\\\'submit_route_data\\\');
        if ($submitRouteData) {
            $route = $submitRouteData[\\\'route\\\'];
            $params = isset($submitRouteData[\\\'params\\\']) ? $submitRouteData[\\\'params\\\'] : array();
            $submitUrl = $this->getUrl($route, array_merge($params, $additional));
        } else {
            $submitUrl = $this->getAddToCartUrl($product, $additional);
        return $submitUrl;

So I’m guessing that SubmitRouteData is the problem, but I just don’t see how to fix it.

Interestingly, adding product to the wishlist from the product view works perfectly. That calls the function productAddToCartForm.submitLight.

So what the heck am I doing wrong?

These are the things I already tried without success after hours and hours of googling:
Adding the directory „var/tmp“ to the subfolder that holds the index.php of the b2b website
Switching to all possible combinations of Base URL and Base Link URL (always the same error message)
Making the index.php run a website instead of a store

I don’t care about pretty anymore. Doesn’t have to be elegant. It just hast o freaking work. Somehow.
Pleeeasssesomeone have mercy and help.

File Attachments
index.php  (File Size: 3KB - Downloads: 23)
Magento Community Magento Community
Magento Community
Magento Community
Jr. Member
Total Posts:  3
Joined:  2012-11-07

I have got a similiar problem, It looks pretty much like this problem. I have posted a topic here:

When i figured something out I will reply here aswell....


Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top