视图.php是不加载在我的自定义Magento主题



好吧,我已经绞尽脑汁了。我只做过另一个Magento主题,所以无论如何我都不是你所说的"专家"。我喜欢认为我对自己在做什么有一个模糊的概念,但我只是在这里画空白。

好的,开始吧。

在我的自定义主题中,我有不同类型的产品。每种产品都需要不同的产品详细信息页面。通常,我要做的是将所有产品通过templates/category/product/view.phtml,检查产品类型并将其通过适当的模板(我知道,我在作弊)。

我的category.xmlpage.xml文件是完全不变的,但这里是相关的位:

<catalog_product_view translate="label">
    <label>Catalog Product View (Any)</label>
    <!-- Mage_Catalog -->
    <reference name="root">
        <action method="setTemplate"><template>page/2columns-right.phtml</template></action>
    </reference>
    <reference name="head">
        <action method="addJs"><script>varien/product.js</script></action>
        <action method="addJs"><script>varien/configurable.js</script></action>
        <action method="addItem"><type>js_css</type><name>calendar/calendar-win2k-1.css</name><params/><!--<if/><condition>can_load_calendar_js</condition>--></action>
        <action method="addItem"><type>js</type><name>calendar/calendar.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
        <action method="addItem"><type>js</type><name>calendar/calendar-setup.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
    </reference>
    <reference name="content">
        <block type="catalog/product_view" name="product.info" template="custom/pages/category.phtml">
            <!--
            <action method="addReviewSummaryTemplate"><type>default</type><template>review/helper/summary.phtml</template></action>
            <action method="addReviewSummaryTemplate"><type>short</type><template>review/helper/summary_short.phtml</template></action>
            <action method="addReviewSummaryTemplate"><type>...</type><template>...</template></action>
            -->
            <block type="catalog/product_view_media" name="product.info.media" as="media" template="catalog/product/view/media.phtml"/>
            <block type="core/text_list" name="alert.urls" as="alert_urls" translate="label">
                <label>Alert Urls</label>
            </block>
            <action method="setTierPriceTemplate"><template>catalog/product/view/tierprices.phtml</template></action>
            <block type="catalog/product_list_upsell" name="product.info.upsell" as="upsell_products" template="catalog/product/list/upsell.phtml">
                <action method="setColumnCount"><columns>4</columns></action>
                <action method="setItemLimit"><type>upsell</type><limit>4</limit></action>
            </block>
            <block type="catalog/product_view_additional" name="product.info.additional" as="product_additional_data" />
            <block type="catalog/product_view_description" name="product.description" as="description" template="catalog/product/view/description.phtml">
                <action method="addToParentGroup"><group>detailed_info</group></action>
            </block>
            <block type="catalog/product_view_attributes" name="product.attributes" as="additional" template="catalog/product/view/attributes.phtml">
                <action method="addToParentGroup"><group>detailed_info</group></action>
            </block>
            <block type="catalog/product_view" name="product.info.addto" as="addto" template="catalog/product/view/addto.phtml"/>
            <block type="catalog/product_view" name="product.info.addtocart" as="addtocart" template="catalog/product/view/addtocart.phtml"/>
            <block type="core/text_list" name="product.info.extrahint" as="extrahint" translate="label">
                <label>Product View Extra Hint</label>
            </block>
            <block type="catalog/product_view" name="product.info.options.wrapper" as="product_options_wrapper" template="catalog/product/view/options/wrapper.phtml" translate="label">
                <label>Info Column Options Wrapper</label>
                <block type="core/template" name="options_js" template="catalog/product/view/options/js.phtml"/>
                <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>
                    <action method="addOptionRenderer"><type>file</type><block>catalog/product_view_options_type_file</block><template>catalog/product/view/options/type/file.phtml</template></action>
                    <action method="addOptionRenderer"><type>select</type><block>catalog/product_view_options_type_select</block><template>catalog/product/view/options/type/select.phtml</template></action>
                    <action method="addOptionRenderer"><type>date</type><block>catalog/product_view_options_type_date</block><template>catalog/product/view/options/type/date.phtml</template></action>
            </block>
                    <block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/>
                </block>
            <block type="catalog/product_view" name="product.info.options.wrapper.bottom" as="product_options_wrapper_bottom" template="catalog/product/view/options/wrapper/bottom.phtml" translate="label">
                <label>Bottom Block Options Wrapper</label>
                <action method="insert"><block>product.tierprices</block></action>
                <block type="catalog/product_view" name="product.clone_prices" as="prices" template="catalog/product/view/price_clone.phtml"/>
                <action method="append"><block>product.info.addtocart</block></action>
                <action method="append"><block>product.info.addto</block></action>
            </block>
            <block type="core/template_facade" name="product.info.container1" as="container1">
                <action method="setDataByKey"><key>alias_in_layout</key><value>container1</value></action>
                <action method="setDataByKeyFromRegistry"><key>options_container</key><key_in_registry>product</key_in_registry></action>
                <action method="append"><block>product.info.options.wrapper</block></action>
                <action method="append"><block>product.info.options.wrapper.bottom</block></action>
            </block>
            <block type="core/template_facade" name="product.info.container2" as="container2">
                <action method="setDataByKey"><key>alias_in_layout</key><value>container2</value></action>
                <action method="setDataByKeyFromRegistry"><key>options_container</key><key_in_registry>product</key_in_registry></action>
                <action method="append"><block>product.info.options.wrapper</block></action>
                <action method="append"><block>product.info.options.wrapper.bottom</block></action>
            </block>
            <action method="unsetCallChild"><child>container1</child><call>ifEquals</call><if>0</if><key>alias_in_layout</key><key>options_container</key></action>
            <action method="unsetCallChild"><child>container2</child><call>ifEquals</call><if>0</if><key>alias_in_layout</key><key>options_container</key></action>
        </block>
    </reference>
    <reference name="content_news">
        <block type="catalog/product_view" name="catalog.product.info" template="custom/pages/news/entry.phtml"/>
    </reference>
    <reference name="right">
        <block type="catalog/product_list_related" name="catalog.product.related" before="-" template="catalog/product/list/related.phtml"/>
    </reference>
</catalog_product_view>

出于一些奇怪的原因,即使我将setTemplate的值更改为page/1column.phtml,或者如果我将catalog/product_view修改为path/to/custom/template.phtml之类的东西,清除缓存并返回,没有任何变化。它甚至不加载模板。

主题当前所做的只是将定义的块刷新到浏览器中,而没有主模板作为包装器。

还有其他人遇到这个问题吗?如果是这样,有什么建议吗?对于我所做的布局文件的任何更改,当我的修改没有改变时,我已经恢复到它们的原始状态,所以这些文件是严格的开箱即用的。

想买吗?

那么content_news是您的自定义块,您想在其中显示您的自定义块命名为catalog.product.info?content_news是什么块类型?它不会呈现任何子类型,除非它是core/text_list或具有包含getChildHtml()调用且第一个参数为空的模板的其他类型。此外,无论用于呈现根块的模板是什么,都需要调用getChildHtml('content_news'),除非content_newscore/text_list块的子块,原因如上所述。

另外,最好将此附加内容放在自定义主题的local.xml中或自定义模块的布局文件中。只需使用相同的布局更新句柄并引用适当的父块。

最新更新