我似乎丢失了包含产品的页面上的块。我确实安装了垂直导航,但我不确定这与它有什么关系。我正在添加产品,检查它们是否显示为库存等,但它们没有出现。如果我甚至在类别上键入描述,也不会出现。如果我也转到产品页面的特定网址,他们仍然无法显示。我已经打开了路径提示,看起来该块只是缺失了?帮助!
答案 0 :(得分:0)
首先确保您正在使用编译器并缓存并在每次更改后刷新Magetno缓存和缓存存储。
您需要学习的两个文件是主题的local.xml文件和主题的产品和类别的list.phtml和view.phtml文件。
将此代码粘贴在/app/design/frontend/yourtheme/default/layout/local.xml的末尾,看看它是否有所作为:
<catalog_category_default translate="label">
<label>Catalog Category (Non-Anchor)</label>
<reference name="left">
<block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/>
</reference>
<reference name="content">
<block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager"/>
<!-- The following code shows how to set your own pager increments -->
<!--
<action method="setDefaultListPerPage"><limit>4</limit></action>
<action method="setDefaultGridPerPage"><limit>9</limit></action>
<action method="addPagerLimit"><mode>list</mode><limit>2</limit></action>
<action method="addPagerLimit"><mode>list</mode><limit>4</limit></action>
<action method="addPagerLimit"><mode>list</mode><limit>6</limit></action>
<action method="addPagerLimit"><mode>list</mode><limit>8</limit></action>
<action method="addPagerLimit" translate="label"><mode>list</mode><limit>all</limit><label>All</label></action>
-->
</block>
<action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
<action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
<action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
<action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
<action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
</block>
</block>
</reference>
</catalog_category_default>
<catalog_category_layered translate="label">
<label>Catalog Category (Anchor)</label>
<reference name="left">
<block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml"/>
</reference>
<reference name="content">
<block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
<!-- <action method="addReviewSummaryTemplate"><type>default</type><template>review/helper/su.phtml</template></action> -->
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager"/>
<!-- The following code shows how to set your own pager increments -->
<!--
<action method="setDefaultListPerPage"><limit>4</limit></action>
<action method="setDefaultGridPerPage"><limit>3</limit></action>
<action method="addPagerLimit"><mode>list</mode><limit>2</limit></action>
<action method="addPagerLimit"><mode>list</mode><limit>4</limit></action>
<action method="addPagerLimit"><mode>list</mode><limit>6</limit></action>
<action method="addPagerLimit"><mode>list</mode><limit>8</limit></action>
<action method="addPagerLimit" translate="label"><mode>list</mode><limit>all</limit><label>All</label></action>
<action method="addPagerLimit"><mode>grid</mode><limit>3</limit></action>
<action method="addPagerLimit"><mode>grid</mode><limit>6</limit></action>
<action method="addPagerLimit"><mode>grid</mode><limit>9</limit></action>
<action method="addPagerLimit" translate="label"><mode>grid</mode><limit>all</limit><label>All</label></action>
-->
</block>
<action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
<action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
<action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
<action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
<action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
</block>
</block>
</reference
</catalog_category_layered>
[此代码取自类别视图页面的MAgento默认XML,因此将其放在local.xml的末尾,尝试将所有块添加回来]
然后查看app / design / frontend / yourtheme / default / template / catalog / catagory / view.phtml并确保它在某处
<?php echo $this->getProductListHtml() ?>
如果产品仍未显示,请在所有xml文件中搜索name="product_list"
和category.products
,以查看某个模块是否正在更改或删除该块。
如果它仍然不存在,请切换到Magento默认主题,以检查默认主题中是否存在。如果不是,请检查您的类别设置并开始禁用第三方模块,直到它返回。
**编辑
这是app / design / frontend / default / modern / layout / catalog.xml的原始代码,请检查该文件中是否包含此代码:
<catalog_category_default translate="label">
<label>Catalog Category (Non-Anchor)</label>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
<reference name="left">
<block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/>
</reference>
<reference name="content">
<block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager"/>
<!-- The following code shows how to set your own pager increments -->
<!--
<action method="setDefaultListPerPage"><limit>10</limit></action>
<action method="setDefaultGridPerPage"><limit>8</limit></action>
<action method="addPagerLimit"><mode>list</mode><limit>10</limit></action>
<action method="addPagerLimit"><mode>list</mode><limit>20</limit></action>
<action method="addPagerLimit"><mode>list</mode><limit>30</limit></action>
<action method="addPagerLimit" translate="label"><mode>list</mode><limit>all</limit><label>All</label></action>
<action method="addPagerLimit"><mode>grid</mode><limit>8</limit></action>
<action method="addPagerLimit"><mode>grid</mode><limit>16</limit></action>
<action method="addPagerLimit"><mode>grid</mode><limit>24</limit></action>
<action method="addPagerLimit" translate="label"><mode>grid</mode><limit>all</limit><label>All</label></action>
-->
</block>
<!--action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
<action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
<action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
<action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
<action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action-->
<action method="setColumnCount"><count>4</count></action>
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
</block>
</block>
</reference>
</catalog_category_default>
<catalog_category_layered translate="label">
<label>Catalog Category (Anchor)</label>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
<reference name="left">
<block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml"/>
</reference>
<reference name="content">
<block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
<!-- <action method="addReviewSummaryTemplate"><type>default</type><template>review/helper/su.phtml</template></action> -->
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager"/>
<!-- The following code shows how to set your own pager increments -->
<!--
<action method="setDefaultListPerPage"><limit>10</limit></action>
<action method="setDefaultGridPerPage"><limit>8</limit></action>
<action method="addPagerLimit"><mode>list</mode><limit>10</limit></action>
<action method="addPagerLimit"><mode>list</mode><limit>20</limit></action>
<action method="addPagerLimit"><mode>list</mode><limit>30</limit></action>
<action method="addPagerLimit" translate="label"><mode>list</mode><limit>all</limit><label>All</label></action>
<action method="addPagerLimit"><mode>grid</mode><limit>8</limit></action>
<action method="addPagerLimit"><mode>grid</mode><limit>16</limit></action>
<action method="addPagerLimit"><mode>grid</mode><limit>24</limit></action>
<action method="addPagerLimit" translate="label"><mode>grid</mode><limit>all</limit><label>All</label></action>
-->
</block>
<!--action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
<action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
<action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
<action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
<action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action-->
<action method="setColumnCount"><count>4</count></action>
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
</block>
</block>
</reference>
</catalog_category_layered>