简体   繁体   English

view.phtml未加载我的自定义Magento主题

[英]view.phtml is NOT loading in my custom Magento theme

Alright, I am at wit's end here trying to figure this out. 好吧,我在这里想尽办法。 I've only done one other Magento theme, so I'm not what you would call an 'expert' by any measure. 我只做过另一个Magento主题,所以无论如何我都不是您所说的“专家”。 I like to think I have a vague idea as to what it is I'm doing, but I'm just drawing blanks here. 我想认为自己在做什么方面含糊其辞,但我只是在这里空白。

Alright, here goes. 好了,去。

Within my custom theme, I have different types of products. 在我的自定义主题中,我有不同类型的产品。 Each product requires a different product details page. 每个产品都需要一个不同的产品详细信息页面。 Typically, what I would do, is funnel all products through templates/category/product/view.phtml , check the product type and route it through the appropriate template (I know, I'm cheating). 通常,我会做的是通过templates/category/product/view.phtml所有产品,检查产品类型并通过适当的模板路由(我知道,我在作弊)。 This worked previously, but it simply does not want to work now. 这以前曾起作用,但根本不想现在起作用。

My category.xml and page.xml files are COMPLETELY UNCHANGED, but here are the relevant bits: 我的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>

For some odd reason, even if I change the value of setTemplate to page/1column.phtml or if I modify catalog/product_view to something like path/to/custom/template.phtml , clear the cache and go back, NOTHING changes. 出于某种奇怪的原因,即使我将setTemplate的值更改为page/1column.phtml或将catalog/product_view修改为类似path/to/custom/template.phtmlpath/to/custom/template.phtml清除缓存并返回,什么都不会更改。 It doesn't even load a template. 它甚至不加载模板。

What the theme is currently doing is just flushing the defined blocks out to the browser without the main template as a wrapper. 主题当前正在做的只是将定义的块刷新到浏览器,而没有将主模板作为包装器。

Has anyone else run into this issue? 还有其他人遇到这个问题吗? If so, what are some pointers? 如果是这样,有哪些指针? Any changes to the layout files I've made, I've reverted back to their original state when my modifications haven't changed, so these files are strictly out-of-the-box. 对布局文件所做的任何更改,在修改未更改的情况下,我都已恢复为原始状态,因此这些文件严格是开箱即用的。

Halps? Hal? Magento is killing me. Magento杀死了我。

So content_news is your custom block in which you'd like to show your custom block named catalog.product.info ? 因此content_news是您的自定义块,您想在其中显示名为catalog.product.info的自定义块? What block type is content_news ? content_news是什么块类型? It will not render any children unless it is core/text_list or another type with a template that contains a getChildHtml() call with an empty first argument. 除非它是core/text_list或带有模板的其他类型,否则它将不呈现任何子代,该模板包含带有空参数的getChildHtml()调用。 Also, whatever template is being used for rendering the root block needs to have a call to getChildHtml('content_news') unless content_news is a child of a core/text_list block, for the reasons listed above. 同样,由于上面列出的原因,除非content_newscore/text_list块的子级,否则无论用于渲染根块的任何模板都需要调用getChildHtml('content_news')

Also, this addition would be better placed in either a local.xml in your custom theme or in a custom module's layout file. 此外,最好将其添加到自定义主题中的local.xml或自定义模块的布局文件中。 Just use the same layout update handle and reference the appropriate parent block. 只需使用相同的布局更新句柄并引用相应的父块即可。

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

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