Magento Forum

lojas multiplas em 1.4 .0.0 rc1
 
to silva
Jr. Member
 
Total Posts:  8
Joined:  2009-02-13
 

estava a testar lojas multiplas de magento na versão 1.4 e descobri uma coisa fantastica!!

Não consegui trabalhar com aqui por ser demasiado simples.

nesta versão pelo que investiguei foram feitas alterações e tornaram tudo mais simples.

antigamente estes ----- http://www.magentocommerce.com/magento-on-the-fly/multiple-sites/ --- eram os passos a seguir mas tudo foi alterado para esta nova versão:

Home » Blogs » Lucjan Wilczewski’s blog

Setting up Magento with multiple websites or stores
10/12/2009 - 12:10 / Posted by Lucjan Wilczewski

There are many tutorials how to set Magento to work with multiple stores and make different domains point at each store. Since release of Magento CE 1.4.0.0-beta1 and Magento EE 1.6.0.0 it is even more easy to do.
Magento evolves

Solutions used in previous versions required developer to modify index.php file to handle different domains pointing at different stores. New index php contains following code:

$mageRunCode = isset($_SERVER[’MAGE_RUN_CODE’]) ? $_SERVER[’MAGE_RUN_CODE’] : ‘’;
$mageRunType = isset($_SERVER[’MAGE_RUN_TYPE’]) ? $_SERVER[’MAGE_RUN_TYPE’] : ‘store’;

Mage::run($mageRunCode, $mageRunType);

So it checks two environmental variables and use them to start Magento runing. What does it give you? You can set now which store/website is supposed to be running under selected domain directly in virtual host definition or even htaccess.
VirtualHost solution

To benefit from this little piece of code it is enough for you to add following lines within your VirtualHost definition:

SetEnv MAGE_RUN_CODE “base” # put here your website or store code
SetEnv MAGE_RUN_TYPE “website” # put here ‘website’ or ‘store’
.htaccess solution

If you have no access to virtual host definitions, you can still try to use .htaccess for that, putting within following lines:

SetEnvIf Host .*yourhost.* MAGE_RUN_CODE="base";
SetEnvIf Host .*yourhost.* MAGE_RUN_TYPE="website";

Where .*yourhost.* is an regex expression matching the domain for which you want to set environmental variable.

So now you are capable of setting up your Magento multiple stores website without messing up with the core. Good luck.

MASW TENHO UMA DÙVIDA!!!

nestas linhas qual é a sintaxe correcta? 

SetEnvIf Host .*yourhost.* MAGE_RUN_CODE="base";
SetEnvIf Host .*yourhost.* MAGE_RUN_TYPE="website";

bate tudo certo excepto isto e eu como um boi a frente de um palácio não vejo nada!  é do sono!! ou da falta de conhecimentos básicos!!

alguém ajuda?

já agora este blog tem coisas giras.

t.s

 
Magento Community Magento Community
Magento Community
Magento Community
 
ptjedi
Sr. Member
 
Avatar
Total Posts:  250
Joined:  2008-03-12
Porto, Portugal
 

Tb estou empancado aí. Eu coloco no .htaccess

RewriteCond %{HTTP_HOST} ^(.*)dominio.com
RewriteRule ^ - [E=MAGE_RUN_CODE:codigowebsite]

E dá 404: Not found…

 
Magento Community Magento Community
Magento Community
Magento Community
 
ptjedi
Sr. Member
 
Avatar
Total Posts:  250
Joined:  2008-03-12
Porto, Portugal
 

Bem, acho que já descobri (a solução estava num dos comentários do dito blog)

SetEnvIf Host .*dominio1.com.* MAGE_RUN_CODE=codigowebsite1
SetEnvIf Host .*dominio1.com.* MAGE_RUN_TYPE=website

SetEnvIf Host .*dominio2.com.* MAGE_RUN_CODE=codigowebsite2
SetEnvIf Host .*dominio2.com.* MAGE_RUN_TYPE=website

Não colocar as aspas!

 
Magento Community Magento Community
Magento Community
Magento Community
 
alexaminer68
Jr. Member
 
Total Posts:  3
Joined:  2011-02-15
 

Nice one! A true eye opener - never thought of it like this. kabbalah

 
Magento Community Magento Community
Magento Community
Magento Community
 
alexaminer68
Jr. Member
 
Total Posts:  3
Joined:  2011-02-15
 

RewriteCond %{HTTP_HOST} ^(.*)dominio.com
RewriteRule ^ - [E=MAGE_RUN_CODE:codigowebsite]
Doesnt work for me on http://www.kab.tv as well

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