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

How to move an interface package out of Magento and into a website-specific directory? 
 
Matt Puchlerz
Jr. Member
 
Total Posts:  15
Joined:  2008-01-09
Lisle, IL
 

I will preface this message by saying that I’m still fairly new to using Magento. Regardless, what I would like to do is move a custom interface package out of Magento’s directory and into a website-specific directory. My reasoning is mostly do to ease-of-use for the front-end developers.

Current Scenario:

- One common Magento admin will control multiple websites.
- Each website has it’s own interface package.
- The main Magento installation is in a location on the server that’s not viewable by the public.
- Each website has a publicly-viewable directory, which has nothing more than the root .htaccess and index.php files, which have been slightly modified to point back to the common Magento directory.

# Common Magento directory
/path/on/server/magento/...
/
path/on/server/magento/app/design/frontend/website1/...
/
path/on/server/magento/app/design/frontend/website2/...
/
path/on/server/magento/skin/frontend/website1/...
/
path/on/server/magento/skin/frontend/website2/...

# Website1 public directory
/publicly/viewable/path/website1.com/.htaccess
/publicly/viewable/path/website1.com/index.php

# Website2 public directory
/publicly/viewable/path/website2.com/.htaccess
/publicly/viewable/path/website2.com/index.php

This setup is fairly simple to get working: a few rewrite hacks in the .htaccess, change a path and store code in the index.php, and you’re set. However, if one just wants to make edits to a specific website’s interface package, the developer will most likely have to check out the entire common Magento directory. This seems a little excessive given the nature of the task.

Ideal Scenario:

I was thinking that it’d simplify things if the website-specific interface packages could just be moved into the public directory of the website, alongside of the index.php and .htaccess files that are already there.

# Common Magento directory
/path/on/server/magento/...

# Website1 public directory
/publicly/viewable/path/website1.com/.htaccess
/publicly/viewable/path/website1.com/index.php
/publicly/viewable/path/website1.com/app/design/frontend/website1/...
/
publicly/viewable/path/website1.com/skin/frontend/website1/...

# Website2 public directory
/publicly/viewable/path/website2.com/.htaccess
/publicly/viewable/path/website2.com/index.php
/publicly/viewable/path/website2.com/app/design/frontend/website2/...
/
publicly/viewable/path/website2.com/skin/frontend/website2/...

I can’t seem to figure out how to get this working. I doubt that it’s as easy as changing some paths within the Magento admin, but I’ve been wrong before. I also want to make sure that I retain the great fall-back-to-default functionality of themes. If anyone has any input, I’d greatly appreciate it.

Thanks in advance.

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

In current version it is a bit complicated to configure this.

In next update it will be possible to set from index.php:

<?php

$options 
= array('design_dir'=>'./app/design''skin_dir'=>'./skin');
Mage::run('website1''website'$options);
 
Magento Community Magento Community
Magento Community
Magento Community
 
Matt Puchlerz
Jr. Member
 
Total Posts:  15
Joined:  2008-01-09
Lisle, IL
 

Do you have any idea when the “next version” will be out? Or could you possibly give me a few insights as to how it might be accomplished with 1.0?

Thanks again.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Matt Puchlerz
Jr. Member
 
Total Posts:  15
Joined:  2008-01-09
Lisle, IL
 

Also… After posting what you did, I looked into the code a bit more, and saw that you could run a “website” instead of a “store” from Mage::run(). What is the actual difference between them? I’ve tested it on my installation and I haven’t yet seen any noticeable differences.

Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Matt Puchlerz
Jr. Member
 
Total Posts:  15
Joined:  2008-01-09
Lisle, IL
 

Anyone have any additional insights to this?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mark_Kimsal
Sr. Member
 
Total Posts:  186
Joined:  2007-09-12
Michigan, USA
 

Have you tried changing app/etc/config.xml ?
from

<default>
        <
system>
            <
filesystem>
                <
design>{{app_dir}}/design</design>

to

<default>
        <
system>
            <
filesystem>
                <
design>{{root_dir}}/design</design>

EDIT:
This doesn’t quite work.  There’s no way to inject or override the core config, because it’s loaded before any of the XML configs are loaded.

You need to add this to the index.php file

$indexRoot dirname(__FILE__);

And then in Mage/Core/Model/Config.php

//around line 277

            global $indexRoot;
            
$this->_distroServerVars = array(
                
'client_dir'  => $indexRoot,
                
'root_dir'  => dirname(Mage::getRoot()),
                
'app_dir'   => dirname(Mage::getRoot()).DS.'app',
                
'var_dir'   => $this->getTempVarDir(),
                
'base_url'  => $baseUrl,
            );

then, you can use “client_dir” in the app/etc/config.xml to set the root for your design dir.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mootrealm
Sr. Member
 
Avatar
Total Posts:  150
Joined:  2007-09-14
San Francisco, CA
 

Did this ever happen?
Having those theme folders spread out is a pain when using svn.

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