2010-10-26 72 views

回答

4

如果你需要添加你自定义的产品属性到购物车,只需添加下面的代码行到你的模块配置:

<config> 
    <global> 
      <sales> 
       <quote> 
        <item> 
         <product_attributes> 
          <[your_custom_attribute_code] /> 
         </product_attributes> 
        </item> 
       </quote> 
      </sales> 
    </global> 
</config> 

只需用属性的代码替换[your_custom_attribute_code]。 您也可以添加任意数量的属性,只需在配置中添加一个属性即可。

+0

谢谢你以前不知道的新东西。 – clockworkgeek 2010-10-27 23:06:49

+0

但[your_custom_attribute_code]此代码对于不同的属性是动态的,所以客户端不可能遵循这种XML格式结构。 – smart 2010-10-29 11:07:05

+1

我想这是为开发人员而不是为客户。顺便说一下,另一种方法是重写quote_items集合,但对于客户端来说是不可能的:)无论如何,您总是可以编写一个cusotmization,它将通过Magento Admin界面添加这些属性来配置Magento。你只需要调用方法'Mage :: getConfig() - > setNode('node/path','nodeValue');'。 – 2010-10-30 07:19:34

相关问题