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 magento.stackexchange.com, 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 community@magento.com.

Magento Forum

Multiple Website Question
 
wd
Jr. Member
 
Total Posts:  10
Joined:  2007-10-30
 

I am setting up a multiple website scenario.
I am using Magento 1.0
I am using a single URL, example.com
The core magento software is installed in example.com/main
I created another website in example.com/main/websiteA
It has index.php, .htaccess and the interface and theme files.
I followed the multiple website videos and everything works so far but the “add to cart” button.
I have an item in the catalog and it shows up but when you click “add to cart” nothing happens
When I copy the item into the root store “add to cart” works fine.

When I look at the source code on my websiteA page and look at the “add to cart” button code, it’s onclick is
<button class="form-button" onclick="setLocation(’http://example.com/main/websitA/index.php/checkout/cart/add/uenc/aHR0cDovL3VyaW5lLW9mZi51cy9tYWluL3BldHN0b3JlL2luZGV4LnBocC9jYXQtcHJvZHVjdHM=/product/3/’)"><span>Add to Cart</span></button>

When I look at the source code of the root store “add to cart” button says
<button class="form-button" onclick="setLocation(’http://example.com/main/index.php/checkout/cart/add/uenc/aHR0cDovL3VyaW5lLW9mZi51cy9tYWluL3BldHN0b3JlL2luZGV4LnBocC9jYXQtcHJvZHVjdHM=/product/3/’)"><span>Add to Cart</span></button>
This works fine.

The difference is that websiteA is in the path of the websiteA onclick code but not the root store onclick code.
Do I need to duplicate the entire root code in the websiteA folder? Or is there a way to point websiteA to use the root sites mage directory.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Dustin
Sr. Member
 
Total Posts:  160
Joined:  2008-03-13
Columbus, OH
 

The reason it is not able to add to the cart is because if you are in your second domain, domain2.com, it is searching for all the js files on domain2.com but in reality they are located on domain1.com.

So under your system->configuration->web tab for domain2.com you need to change the following:

Base Skin URL
Base Media URL
Base Javascript URL

TO

domain1.com/skin/
domain1.com/media/
domain1.com/js/

This will then set the right path to all the files for when you are on domain2.com

If this is the correct way I have no idea, but it works.

 
Magento Community Magento Community
Magento Community
Magento Community
 
wd
Jr. Member
 
Total Posts:  10
Joined:  2007-10-30
 

My current plan is to not use a multiple domain setup.
I am using a single URL which will go to a main html/flash home page and then branch off into different stores.
I may go sub-domain though.

The problem seems to be some kind of pointer to the main app/code/core/mage files
My second web site is looking for the mage files within the second website directory structure. I just need to point it to the main site

My main store is http://urine-off.us/main
My second website store is http://urine-off.us/main/petstore

Main Store
default config
Unsecure
Base URL {{base_url}}
Base Link URL {{unsecure_base_url}}
Base Skin URL {{unsecure_base_url}}skin/
Base Media URL {{unsecure_base_url}}media/
Base JavaScript URL {{unsecure_base_url}}js/

Secure
Base URL
Base Link URL
Please make sure that Base URL ends with ‘/’ (slash), e.g. http://yourdomain/magento/
Base Skin URL
Base Media URL
Base JavaScript URL
Use Secure URLs in Frontend No
Use Secure URLs in Admin No

second website
unsecure
Base URL http://urine-off.us/main/
Base Link URL {{unsecure_base_url}}petstore/
Base Skin URL {{unsecure_base_url}}petstore/skin/
Base Media URL {{unsecure_base_url}}petstore/media/
Base JavaScript URL {{unsecure_base_url}}petstore/js/

Secure
Base URL http://urine-off.us/main/
Base Link URL {{secure_base_url}}petstore/
Base Skin URL {{secure_base_url}}petstore/skin/
Base Media URL {{secure_base_url}}petstore/media/
Base JavaScript URL {{secure_base_url}}petstore/js/
Use Secure URLs in Frontend No
Use Secure URLs in Admin No

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

@wd: If you wish to have only 1 copy of Magento files, you could create petstore/ folder inside Magento and copy index.php and .htaccess in there and edit store code in index.php. Configuration as follows:

Main Store
default config
Unsecure
Base URL {{base_url}}
Base Link URL {{unsecure_base_url}}
Base Skin URL {{unsecure_base_url}}skin/
Base Media URL {{unsecure_base_url}}media/
Base JavaScript URL {{unsecure_base_url}}js/

Secure
Base URL http://urine-off.us/main/
Base Link URL {{secure_base_url}}
Base Skin URL {{secure_base_url}}skin/
Base Media URL {{secure_base_url}}media/
Base JavaScript URL {{secure_base_url}}js/
Use Secure URLs in Frontend No
Use Secure URLs in Admin No

second website
unsecure
Base URL http://urine-off.us/main/
Base Link URL {{unsecure_base_url}}petstore/
Base Skin URL {{unsecure_base_url}}skin/
Base Media URL {{unsecure_base_url}}media/
Base JavaScript URL {{unsecure_base_url}}js/

Secure
Base URL http://urine-off.us/main/
Base Link URL {{secure_base_url}}petstore/
Base Skin URL {{secure_base_url}}skin/
Base Media URL {{secure_base_url}}media/
Base JavaScript URL {{secure_base_url}}js/
Use Secure URLs in Frontend No
Use Secure URLs in Admin No

****
It is also possible to try and enable System > Configuration > Web > Url Options > Add Store Code to Urls
This will add store view code in the URL automatically, and when rewrites enabled looks like you have folders for each store there.
In this case use default settings for Base URLs

 
Magento Community Magento Community
Magento Community
Magento Community
 
danilodimoia
Member
 
Total Posts:  36
Joined:  2008-04-21
Chieti
 

sorry, i cannot find “add store code to urls” in system > web I have no “url options” menu… and i cannot find it.

how it works? thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
wd
Jr. Member
 
Total Posts:  10
Joined:  2007-10-30
 

Installed 1.0.19700 and started from scratch.
Installed into magento folder instead of main.
Second website is magento/petstore
Went slow and careful when setting up second website web config.
Add to cart now works in the second site.
Also, pictures now show up. I did not set base media to petstore. I left it default.
So far so good.
Learning.

Basic install using default settings
Basic website is http://urine-off.us/magento

Second website is http://urine-off.us/magento/petstore
Second store web config
Unsecure
Base URL http://urine-off.us/magento/
Base Link URL {{unsecure_base_url}}petstore/
Base Skin URL {{unsecure_base_url}}petstore/skin/
Base Media URL {{unsecure_base_url}}media/
Base JavaScript URL {{unsecure_base_url}}js/

Secure
Base URL http://urine-off.us/magento/
Base Link URL {{secure_base_url}}
Base Skin URL {{secure_base_url}}skin/
Base Media URL {{secure_base_url}}media/
Base JavaScript URL {{secure_base_url}}js/
Use Secure URLs in Frontend No
Use Secure URLs in Admin No

Setting the link URL and skin URL to petstore even shows my new theme without doing anything in the config design tab.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

@danilodimoia: this option is available since latest release, 1.0.19700

 
Magento Community Magento Community
Magento Community
Magento Community
 
Dustin
Sr. Member
 
Total Posts:  160
Joined:  2008-03-13
Columbus, OH
 
Moshe - 02 May 2008 10:52 AM

@danilodimoia: this option is available since latest release, 1.0.19700

That is what I am running and I also do not see that option.

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