How do I override the review tab on OnePage Checkout - magento

I am writing a custom module to change the display of the table on checkout/onepage/onepage.phtml I can see in checkout.xml how it gets declared with
<block type="checkout/onepage_review" name="checkout.onepage.review" as="review" template="checkout/onepage/review.phtml">
<block type="checkout/agreements" name="checkout.onepage.agreements" as="agreements" template="checkout/onepage/agreements.phtml"/>
</block>
What I can not figure out is how to set up the /app/design/frontend/{location}/{theme}/layout/{module}.xml file to override the current review.phtml template with the new one. My thought would be to remove the current one and reload with the new one but that doesn't seem to be working.

The first thing i can see is the directory you are using is incorrect.
it should be
app/design/frontend/{location}/{theme}/layout/{module}.xml
instead of
app/layout/frontend/{location}/{theme}/layout/{module}.xml
Also, i'm not sure exactly what you want to do with regards to overriding the review layout table, but the following will replace the review template with your own:
<checkout_onepage_review>
<reference name="root">
<action method="setTemplate"><template>checkout/onepage/your_template.phtml</template></action>
</reference>
</checkout_onepage_review>
Secondly, if you are creating a custom module and want your layout file to be loaded, you have to declare the layout update in your modules config.xml. have you done this?
It would look something similar to this:
<?xml version="1.0"?>
<config>
<modules>
<Your_Company_Your_Module>
<version>1.0.0</version>
</Your_Company_Your_Module>
</modules>
<frontend>
<layout>
<updates>
<yourmodule>
<file>yourmodule.xml</file>
</yourmodule>
</updates>
</layout>
</frontend>
</config>
Finaly, depending on what you are trying to achieve, you may not require a module just to override the checkout review table.
If the sole purpose of the module is simple to override the checkout layout, then it would probably be sufficient to just override the layout by using one of the following methods:
Use local.xml
Create a local.xml file in your themes layout directory:
/app/design/frontend/{location}/{theme}/layout/{module}.xml
and use this for all core layout overrides. There are lots of benefits to this.
Copy the base checkout.xml layout file to your theme
Copy app/design/frontend/base/default/layout/checkout.xml
To app/design/frontend/{location}/{theme}/layout/checkout.xml

Related

Magento 1.9 - modifying layout

What is the best way of modifying a layout for Magento 1.9? I've been updating layouts using the admin backend but now need to do this programatically. Several articles have mentioned using layout.xml but for some reason, my system isn't picking up the layout updates.
Specifically, this is what I'm trying to modify:
Original layout
<block type="catalog/product_view_options" name="product.info.options" as="product_options" template="catalog/product/view/options.phtml">
<action method="addOptionRenderer">
<type>text</type>
<block>catalog/product_view_options_type_text</block>
<template>catalog/product/view/options/type/text.phtml</template>
</action>
...
</block>
Modified layout
<block type="catalog/product_view_options" name="product.info.options" as="product_options" template="catalog/product/view/options.phtml">
<action method="addOptionRenderer">
<type>text</type>
<block>catalog/product_view_options_type_text</block>
<template>catalog/product/view/options/type/newfile.phtml</template>
</action>
...
</block>
My modified layout is located in:app/design/frontend/default/(company name)/(module name)/layout/layout.xml
layout.xml (just checking to see if it will add the block, "test"):
<layout>
<default>
<block type="core/text_list" name="test"/>
</default>
</layout>
app/code/local/(company name)/(module name)/etc/config.xml:
<config>
<modules>
...
</modules>
<frontend>
<layout>
<updates>
<(module name)>
<file>local.xml</file>
</(module name)>
</updates>
</layout>
</frontend>
</config>
Can somebody point me in the right direction? Thanks!
Here are two things I notice which should be changed:
Your layout update file should have a unique name that won’t conflict with existing modules. In your config.xml you have specified <file>local.xml</file>. The problem with this is, local.xml will already be loaded automatically by Magento. So you should not use that filename for your layout update file if you are trying to add a new one specific to your module, however you may add miscellaneous updates to that file and they will get picked up automatically and applied last to the final merged layout.
Behind the scenes there’s an <updates /> section of the global config that contain nodes with all the file names to load. Once the files listed in the config have been combined, Magento will merge in one last xml file, local.xml.
Your layout update file app/design/frontend/default/(company name)/(module name)/layout/layout.xml does not appear to be in the right location. You should create your new layout update file at: app/design/frontend/base/default/layout/(company name)/(module_name).xml. Then, you need to update your config.xml to point to this file: <file>(company name)/(module name).xml</file>.
Because of the ability to use different themes in Magento and its fallback mechanism, all extension related theme files are placed in “base/default” package for frontend...

How to remove additional tab on product page magento

I want to know How to remove additional tab on magento product page. I have using Ultimo theme on magento 1.7.0.2
I try to search from previous post but still can't remove it.
I have add additional information to a product description and change a name to "ข้อมูลสินค้า"
My point is remove a second tab but still show information on "Product description
This is my product page. http://www.siameyewear.com/ray-ban-rb3025-001-58-aviator-large-metal.html
Thank you.
I'd create local.xml file inside your theme folder app/design/frontend/[your_package]/[your_theme] (if you haven't already)
And insert the following lines there
<?xml version="1.0"?>
<layout version="0.1.0">
<catalog_product_view>
<reference name="product.info.tabs">
<action method="unsetChild">
<child>product_additional_data</child>
</action>
</reference>
</catalog_product_view>
</layout>
After that clear the cache.
If you prefer to edit XML in separate files (which I'm not), find catalog.xml of your theme.
find the following line and comment them (<!-- -->)
<action method="addTab" translate="title" module="catalog"><alias>additional</alias><title>Additional Information</title><block>catalog/product_view_attributes</block><template>catalog/product/view/attributes.phtml</template></action>
Are you create new attribute for product description .remove any one of the product attribute.
you can remove your attribute in your magento admin page .
Catalog->attributes->manage attributes
select your attribute you want to delete.
OR
open your attribute check "Visible on Product View Page on Front-end" change yes to no
I am using my module adminhtml layout xml to add or remove tabs (you could use your theme's local.xml, based on these steps with a bit of tweakking.)
Firstly you will need to declare your layout updates (in your module config.xml) like the following:
<adminhtml>
<layout>
<updates>
<mymodule>
<file>mymodule.xml</file>
</mymodule>
</updates>
</layout>
</adminhtml>
Then in mymodule.xml, add the following (here, I am using the admin order view page handle)
<adminhtml_sales_order_view>
<reference name="sales_order_tabs">
<action method="removeTab">
<name>order_shipments</name>
</action>
<action method="addTabAfter">
<name>order_shipments_mymodule</name>
<block>mymodule/adminhtml_order_shipments</block>
<after>order_creditmemos</after>
</action>
<action method="addTab">
<name>order_receipts</name>
<block>mymoduled/adminhtml_order_recp</block>
</action>
</reference>
</adminhtml_sales_order_view
Hope this helps!! (Don't forget to upvote this solution)

Nesting of layout tag in Magento xml

I am not sure where to keep my layout xml in the custom module. Does it go in the config.xml of the module or a separate layout.xml is needed. How does Magento picks up the layout xml?
Right now I am using it like this, which doesn't work. A bit clueless here, any pointers? Code samples work great for me :)
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Ashfame_Adminoverrider>
<version>1.0.0</version>
</Ashfame_Adminoverrider>
</modules>
<global>
<layout>
<adminhtml_sales_order_create_index>
<reference name="root">
<reference name="form">
<reference name="data">
<block type="ashfame_adminoverrider/sales_order_create_shipping_address" as="shipping_address" template="ashfame/adminoverrider/sales/order/create/form/address.phtml" />
</reference>
</reference>
</reference>
</adminhtml_sales_order_create_index>
</layout>
</global>
</config>
Config XML and layout XML are two different things.
The config.xml files can be used to tell Magento to load a new layout xml file. Search for catalog.xml in
app/code/core/Mage/Catalog/etc/config.xml
for the correct place to put the nodes in your own XML files. You're looking for something like this
<catalog>
<file>catalog.xml</file>
</catalog>
<map>
<file>catalog_msrp.xml</file>
</map>
One you're there, place your globally uniquely named xml file in the base design package's layout folder and/or your theme's layout folder.
That should be enough to get you googling. Good luck.

How to override the admin template file in magento?

I need to override the "adminhtml/sales/order/create/items/grid.phtml" file to display some custom text under each item while creating new order from admin. I want this to be done through custom module. Anyone can suggest how to override the admin template files? Any help is really appreciated
I Recommend you that create a new template and add new design in your module with the layout update for the adminhtml section.
For example:
In your config.xml of your custom extension you can update the layout of adminhtml with:
<adminhtml>
<layout>
<updates>
<adminhtml>
<file>yourcustomlayout.xml</file>
</adminhtml>
</updates>
</layout>
</adminhtml>
Ok, then since this layout you can write the next code to add a css for example:
<layout>
<default>
<reference name="head">
<action method="addCss">
<name>aw_all/css/window.css</name>
</action>
</reference>
</default>
</layout>
In your case you need add you custom template for your block
<layout>
<handle>
<reference name="content">
<block type="smspremium/adminhtml_smspremium" name="smspremium">
<action method="setTemplate">
<template>customtemplate.phtml</template>
</action>
</block>
</reference>
</handle>
</layout>
If you want to discart all the block and replace with your block you can made unsetChild
<layout>
<handle>
<reference name="content">
<action method="unsetChild"><name>your.last.block</name></action>
<block type="smspremium/adminhtml_smspremium" name="smspremium">
<action method="setTemplate">
<template>customtemplate.phtml</template>
</action>
</block>
</reference>
</handle>
</layout>
This work same the frontend layout, only with the diference of the directory since you store your files.
For Templates:
app/design/adminhtml/default/default/templates
For layout:
app/design/adminhtml/default/default/layout
Hope help you
Basically, you have to declare a new layout file for your module for adminhtml area, than set a new template path using setTemplate method and reference[name] node.
First of all I'm not believe this is the correct way of overriding adminhtml templates. But I try this approach and it works, So just wanna share.
Add this to your custom Module config.xml
<stores>
<admin>
<design>
<theme>
<default>default</default>
<template>mycustom</template>
</theme>
</design>
</admin>
</stores>
Now You can just override by copying templates from default to mycustom
app\design\adminhtml\default\default\template\sales\order\view\history.phtml app\design\adminhtml\default\mycustom\template\sales\order\view\history.phtml
You can find the detailed instructions for overriding Magento admin files here http://www.techawaken.com/creating-a-new-magento-admin-theme/

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

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>
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()
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.

Resources