私は独自のCustomerモジュールに新しいブロックを作成しました.config.xmlは次のとおりです。
<?xml version="1.0"?>
<config>
<modules>
<Nauba_Customer>
<version>1.6.2.0.3</version>
</Nauba_Customer>
</modules>
<global>
<resources>
<nauba_customer_setup>
<setup>
<module>Nauba_Customer</module>
</setup>
</nauba_customer_setup>
</resources>
<blocks>
<nauba_customer>
<class>Nauba_Customer_Block</class>
</nauba_customer>
<customer>
<rewrite>
<form_register>Nauba_Customer_Block_Form_Register</form_register>
</rewrite>
</customer>
</blocks>
<models>
<customer>
<rewrite>
<customer>Nauba_Customer_Model_Customer</customer>
</rewrite>
</customer>
</models>
</global>
<frontend>
<routers>
<customer>
<args>
<modules>
<Nauba_Customer before="Mage_Customer">Nauba_Customer</Nauba_Customer>
</modules>
</args>
</customer>
</routers>
</frontend>
</config>
今、私はホームページでそれを呼び出そうとしているので、page.xml レイアウトで指定しました:
<!-- this is only the home page section -->
<page_homepage translate="label">
<label>Homepage</label>
<reference name="root">
<!--reference name="head">
<action method="removeItem"><type>skin_css</type><name>css/styles.css</name></action>
<action method="removeItem"><type>skin_css</type><name>css/styles-ie.css</name></action>
<action method="removeItem"><type>skin_css</type><name>css/widgets.css</name></action>
<action method="removeItem"><type>skin_css</type><name>css/print.css</name></action>
</reference-->
<block type="page/html" name="category_links" template="page/html/category_links.phtml" />
<block type="cms/block" name="homepage_slider_image_1" as="homepage_slider_image_1">
<action method="setBlockId"><block_id>homepage_slider_image_1</block_id></action>
</block>
<block type="cms/block" name="homepage_slider_image_2" as="homepage_slider_image_2">
<action method="setBlockId"><block_id>homepage_slider_image_2</block_id></action>
</block>
<block type="cms/block" name="homepage_slider_image_3" as="homepage_slider_image_3">
<action method="setBlockId"><block_id>homepage_slider_image_3</block_id></action>
</block>
<block type="cms/block" name="homepage_slider_image_4" as="homepage_slider_image_4">
<action method="setBlockId"><block_id>homepage_slider_image_4</block_id></action>
</block>
<block type="cms/block" name="homepage_event_banner_1" as="homepage_event_banner_1">
<action method="setBlockId"><block_id>homepage_event_banner_1</block_id></action>
</block>
<block type="cms/block" name="homepage_event_banner_2" as="homepage_event_banner_2">
<action method="setBlockId"><block_id>homepage_event_banner_2</block_id></action>
</block>
<block type="cms/block" name="homepage_event_banner_3" as="homepage_event_banner_3">
<action method="setBlockId"><block_id>homepage_event_banner_3</block_id></action>
</block>
<block type="nauba_customer/list_ordercrosssell" name="ordercrosssell" as="ordercrosssell" template="nauba_customer/list/ordercrosssell.phtml">
</block>
<action method="setTemplate"><template>page/home.phtml</template></action>
<!-- Mark root page block that template is applied -->
<action method="setIsHandle"><applied>1</applied></action>
<action method="setLayoutCode"><name>page_homepage</name></action>
</reference>
</page_homepage>
しかし、ホームテンプレートで次のように呼び出すと機能しません:
($this->getChildHtml('ordercrosssell'))
また、次の方法で作成しようとしました:
$this->getLayout()->createBlock('ordercrosssell')
しかし、この例外「無効なブロックタイプ」が発生します。助けはありますか?