从magento中的产品中过滤一个特定的属性值

时间:2011-06-22 08:45:16

标签: magento

我是magento的新手,我正在http://www.theartworkgallery24.com/stage/网站上工作。请检查flash横幅下方,有4个大图像链接到属性值,用户可以直接从中找到产品。

我需要一个显示一个特定属性值的页面,如艺术家的情况,它应该是Gustav Klimt,Leonardo Da Vinci等。这些应该是与属性值相关的实际产品的链接。

请告诉我如何制作您自己的PHTML或PHP文件,使用哪些代码以及如何使用,以及如何在您的magento网站中调用您的代码。

任何想法都将受到赞赏,谢谢。

1 个答案:

答案 0 :(得分:0)

您可以在管理员方面为这些功能创建一个属性(davinchi)。您可以从catalog-> attributes->菜单创建产品属性。之后,您可以在产品创建页面中看到这些属性值。您只需将其分配给不同的产品

之后,您可以为此创建模块。否则只需在catalog / product /文件夹中创建一个phtml文件。

  then enter the below custom collection code in it.

  $collection = Mage::getModel('catalog/product')->getCollection();
  $collection->addAttributeToSelect('*');
      //filter codition
  $collection->addFieldToFilter(array(
    array('attribute'=>'davinchi','eq'=>1),
   ));
  This will load products having attribute value davinchi=1.