Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to define Magento layout updates on a per-store basis

Tags:

magento

I have a single Magento install running two different websites. One sells ebooks and the other not and so the business team would like to see the "My Downloads" link removed from the customer navigation block in the My Account area of the application.

I can see the link defined in design/frontend/base/layout/downloadable.xml but cannot see any way defined that would let me disable the link on just one of the websites. Obviously, I could override this XML to turn off globally but I need the change to be limited in scope.

How do you define layout overrides on a single website or store in a multi site Magento installation?

Based on the responses below, I have done the following:

Created app/local/Mage/Customer/Block/Account/Navigation.php and added a method removeLink() which is not in the core code.

If I make the following change in local.xml, the download link is removed:

<?xml version="1.0" encoding="UTF-8"?>
<layout>
    <default>
        <remove name="catalog.compare.sidebar"/>
    </default>   
    <customer_account>
        <reference name="customer_account_navigation">
            <action method="removeLink" translate="label" module="downloadable"> <name>downloadable_products</name></action>
        </reference>
    </customer_account>
</layout>

But, if try to target a specific store, it is not. E.g.

<?xml version="1.0" encoding="UTF-8"?>
<layout>
    <default>
        <remove name="catalog.compare.sidebar"/>
    </default>
    <STORE_mm>
    <customer_account>
        <reference name="customer_account_navigation">
            <action method="removeLink" translate="label" module="downloadable"> <name>downloadable_products</name></action>
        </reference>
    </customer_account>
    </STORE_mm>
</layout>
like image 674
Andrew Rutter Avatar asked Mar 20 '12 12:03

Andrew Rutter


People also ask

What is the difference between website store and store view in Magento?

On a Magento website level the merchant setting up basic business logic which includes choosing a payment, shipping methods, currency and price). The main difference between Magento Website and Store is that the first one contains only customer data with no products and categories.

Where are the best files of the page layout files located in the Magento directory?

The basic view of all Magento storefront pages is defined in two page configuration layout files located in the Magento_Theme module: <Magento_Theme_module_dir>/view/frontend/layout/default. xml : defines the page layout.

Which type of layout file is used to define the page structure and wireframe?

A page layout file defines the page wireframe, for example, one-column layout. Technically page layout is an . xml file defining the structure inside the <body> section of the HTML page markup.


2 Answers

As Anton suggested, set a new layout theme for your store. Another approach for anything site-wide + store-scoped would be to use the store layout handle - it's like a <default> handle which is applied each store. If your store code (under Manage Stores > Store View) is 'foo' the store layout handle would be <STORE_foo>.

Ref. Mage_Core_Controller_Varien_Action::addActionLayoutHandles()

like image 187
benmarks Avatar answered Oct 21 '22 23:10

benmarks


Create different themes for this websites.
Create app/design/frontend/default/website1/layout/local.xml
and app/design/frontend/default/website2/layout/local.xml
Where you can make changes needed for downloadable layout. This is described in magento feature.

like image 24
Sergey Avatar answered Oct 21 '22 23:10

Sergey