1

私のストアには、標準の Magento レイアウトとはまったく異なるレイアウトが必要なカテゴリがあります。そこで、1column.phtml の新しいコピーを作成して名前を変更し、テスト用に小さな変更を 1 つ加えました。

フロントエンド/テスト/デフォルト/テンプレート/ページ/1column-lookbook.phtml

    <?php
/**
 * Template for Mage_Page_Block_Html
 */
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>">
<head>
<?php echo $this->getChildHtml('head') ?>
</head>
<body<?php echo $this->getBodyClass()?' class="'.$this->getBodyClass().'"':'' ?>>
<?php echo $this->getChildHtml('after_body_start') ?>
<div class="container">
    <?php echo $this->getChildHtml('global_notices') ?>
    <div class="page">
        <?php echo $this->getChildHtml('header') ?>
        <div class="page_content">
            <div class="row">
                <div class="sixcol">
                    <?php echo $this->getChildHtml('breadcrumbs') ?>
                </div>
                <div class="sixcol last">

                </div>
            </div>
            <div class="row"><h3>Filter here</h3></div>
            <div class="row"><h3>Scrolling content</h3></div>
            <div class="row">
                <div class="main-content">
                    <?php echo $this->getChildHtml('global_messages') ?>
                    <?php echo $this->getChildHtml('content') ?>
                </div>
            </div>
            <?php echo $this->getChildHtml('footer') ?>
            <?php echo $this->getChildHtml('before_body_end') ?>
        </div>
    </div>
</div>
<?php echo $this->getAbsoluteFooter() ?>
</body>
</html>

ただし、これを私のカテゴリで表示することはできないようです。page.xml および layout.xml ファイルに参照を追加しようとしました。しかし、何を試しても、カテゴリのページレイアウトドロップダウンに表示できないようです。

4

4 に答える 4

2

magentoで「1column.phtml」文字列を検索すると、次のようになります。

App / code / core / Mage / Page / etc / config.xml
45行目に、必要な構成があります。

これで、次のように同じ構成構造を独自のモジュールに配置できます。

<global>
    <page>
        <layouts>
            <test module="page" translate="label">
                <label>The test</label>
                <template>page/test.phtml</template>
                <layout_handle>page_test</layout_handle>
            </test>
        </layouts>
    </page>
</global>

Magentoキャッシュを更新し、カテゴリ編集画面=>カスタムデザイン=>ページレイアウトに移動して、ドロップダウンで追加したテンプレートを選択します。

お役に立てれば。

于 2013-03-06T20:37:19.590 に答える
1

新しい CMS レイアウト用の Magento モジュール (バージョン 1.7.0.2)

http://www.magentocommerce.com/boards/viewthread/285425/#t400446

この上にたくさんあります..

カスタム モジュールの XML 構成にいくつかのエントリを追加して、新しいレイアウトを追加します。

<config>
    <modules>
        <My_Module>
            <version>0.0.0.1</version>
        </My_Module>
    </modules>
    <global>
    <page>
        <layouts>
            <my_layout module="page" translate="label">
                <label>My Layout</label>
                <template>page/mylayout.phtml</template>
                <layout_handle>my_layout</layout_handle>
            </my_layout>
        ....

後でキャッシュを更新することを忘れないでください

于 2013-03-05T14:44:39.177 に答える
0

検索: /App/etc/local.xml

</global>タグの直前に、追加のページ レイアウト構成を配置します。

<page>
  <layouts>
    <lookbook module="page" translate="label">
      <label>LOOK BOOK</label>
        <template>page/1column-lookbook.phtml</template>
      <layout_handle>page_lookbook</layout_handle>
    </lookbook>
  </layouts>
</page>

それでおしまい。:)

于 2013-11-28T17:56:36.310 に答える
-1

新しいレイアウトを作成する方が良い方法です。

http://www.sundataplus.com/adding-a-new-page-layout-to-magento-1-x/

ファイルは編集できます: app/code/core/Mage/Page/etc/config.xml .. の間に新しい行を追加し、他のレイアウトも追加します。

<page>
        <layouts>
.
.
        <home module="page" translate="label">
            <label>Home</label>
            <template>page/home.phtml</template>
            <layout_handle>page_home</layout_handle>
        </home>
.
.
        </layouts>
</page>

新しいファイルを作成します: template/page/home.phtml を 1column.phtml、2columns-left.phtml などと共に作成します。home.phtml 内の列レイアウト phtml の 1 つの既存のコードをコピーするだけです。必要に応じて、home.phtml 内のコードを変更します。

于 2016-02-15T06:41:28.170 に答える