简体   繁体   English

在magento中覆盖1column.phtml文件

[英]override 1column.phtml file in magento

I am working on multi store magento setup. 我正在从事多商店magento设置。 I used conditional statement for specific view in particular store in 1column.phtml file.I override the local.xml file also its worked for me,but i want separate 1column.phtml file for each store. 我用条件语句在特定的商店特定视图1column.phtml file.I覆盖local.xml的文件也是它为我工作,但我想单独1column.phtml为每个存储文件。

我相信您可以为每个商店设置不同的主题,每个主题在template / page / 1column.phtml中只有一个文件夹,并使用后备机制使用其他功能。

you need to try manual action where need your store id with this code 您需要尝试使用此代码的需要您商店ID的手动操作

<?php if (Mage::app()->getStore()->getStoreId() == 9): ?>

'9' is your store ID (just for example) it's work for me. “ 9”是您的商店ID(例如),它对我有用。 so you can test and let me know if problem :) 这样您就可以测试并让我知道是否有问题:)

The cleanest solution is to change which template is loaded in the controller based on the store id. 最干净的解决方案是根据商店ID更改在控制器中加载的模板。

if ($storeId == 2) {
  $this->getLayout()->getBlock($oneColumnBlock)->setTemplate($yourCustomTemplate);
}

We can do this by FallBack mechanism as Blastfreak suggest me. 我们可以通过FallBack机制做到这一点,就像Blastfreak建议我的那样。 My folder structure is:- app/design/frontend/stores/store1/template/page/1column.phtml 我的文件夹结构是:-app / design / frontend / stores / store1 / template / page / 1column.phtml

stores is my package store1 is my theme stores是我的包裹store1是我的主题

And i set Current Package Name = stores in admin panel. 然后我将当前包名称设置为=在管理面板中存储。 And Edit my CMS home-page ->Click on design tab->go to Custom Design->select custom theme to store1 under store package. 然后编辑我的CMS主页->单击“设计”选项卡->转到“自定义设计”->选择自定义主题以将store1存储在store package下。 Thats it. 而已。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM