简体   繁体   English

排序新产品magento

[英]Sort new products magento

I'm developing a magento webshop. 我正在开发一个magento网上商店。 On my homepage I display the newly added products. 在我的主页上,显示新添加的产品。 I want to sort those, preferably by colour. 我想对它们进行排序,最好按颜色排序。

home xml: 家用xml:

<block type="catalog/product_new" name="home.catalog.product.new" alias="product_new" 
 template="catalog/product/new.phtml" after="cms_page">  
    <action method="setProductsCount"><count>100</count></action>
        <action method="addPriceBlockType">
            <type>bundle</type>
            <block>bundle/catalog_product_price</block>
            <template>bundle/catalog/product/price.phtml</template>
        </action>
</block>

I tried adding an attribute called "kleur" which can be used to sort. 我尝试添加一个名为“ kleur”的属性,该属性可用于排序。 After that I put these next two lines in this block and that did not work. 之后,我将接下来的两行放在此块中,这没有用。

    <action method="setDefaultOrder"><field>kleur</field></action>
    <action method="setDefaultDirection"><dir>asc</dir></action>

I also tried to set the "kleur" field in the display settings of the category. 我还尝试在类别的显示设置中设置“ kleur”字段。 And last but not least I also tried to set it in the configuration->category. 最后但并非最不重要的一点是,我也尝试在configuration-> category中进行设置。

On the web I can't find more solutions to the problem. 在网上找不到更多解决方案。

Is there any other way, except editing the template file to sort the new products. 除了编辑模板文件以对新产品进行排序以外,还有其他任何方法。

I hope I gave you enough information to be able to give some advice, if you need more don't hesitate to ask. 希望我给您足够的信息,以便能够提出一些建议,如果您需要更多信息,请随时提出。

Thanks in advance! 提前致谢!

Follow these steps: 跟着这些步骤:

  1. Login to Admin Panel 登录到管理面板
  2. Go to: Catalog->Attributes->Manage Attributes, then edit the Attribute which want to use in sorting. 转到:目录->属性->管理属性,然后编辑要在排序中使用的属性。
  3. Under Frontend Property you will get a field "Used for Sorting in Product Listing", set it's value to "Yes" 在“前端属性”下,您将获得一个字段“用于产品列表中的排序”,将其值设置为“是”
  4. Then, reindex, if required. 然后,根据需要重新索引。

Now set this attribute for sorting from admin or from xml depend upon, what your block is reading. 现在,设置此属性以从admin或xml进行排序,具体取决于您的块正在读取什么。

If, you are using magento default block for sorting, then 如果您使用的是magento默认块进行排序,则

Go to: System->Configuration->CATALOG/Catalog->Frontend->Product Listing Sort by: Select Attribute 转到:系统->配置->目录/目录->前端->产品列表排序方式:选择属性

If, reading xml for sorting, then 如果读取xml进行排序,则

<action method="setDefaultOrder"><field>Attribute_Code</field></action>
<action method="setDefaultDirection"><dir>ORDER (asc/desc)</dir></action>

Hope will help! 希望会有所帮助!

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

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