0

我需要在 Magento 的产品集合中添加一个相当复杂的排序选项,而我对 Zend 框架或 EAV 表不太擅长,以弄清楚我需要做什么才能完成这项工作。考虑到运输成本,我希望能够按毛利对产品系列进行分类。 cost是一个 Magento 属性,存储在catalog_product_entity_decimal表中。运费存储actual_shipping_costcatalog_product_entity_varchar表格中。不知何故,我需要在 SQL 选择语句中添加一列,我可以对其进行排序。此列需要包含costfromc_p_e_decimal 减去 actual_shipping_costfrom c_p_e_varchar

我有自己的类扩展Mage_Catalog_Block_Product_List,Mage_Catalog_Block_Product_List_ToolbarMage_Catalog_Model_Config. 它们一起工作,将必要的排序选项添加到可用的排序数组中。在我的自定义List类中,我检查getCurrentOrder()了工具栏实例。如果是边距,我需要添加具有必要值的列并应用排序。

所以,我已经做到了这一点,但它正在构建让Zend_Db_Expr我感到困惑的正确性。我不是联接、联合和所有 SQL 方面的专家,对 Zend 框架也不是很了解,所以请原谅我的无知。我一直在阅读 Zend 框架,现在当我找到示例时,我基本了解我在看什么,但是从头开始构建我自己的框架仍然有点超出我的能力。所以任何指导都会非常有帮助!

谢谢!

4

1 回答 1

0

Well if you need to sort your fields by margins then you are looking values from wrong places as you only know the margin after the sale and shipping costs also after the user has entered the address and so on. So your best approach would be to go over completed orders and items in each order and shipping cost over each order and write the margin value to some attribute in your product collection, later filter like any other attribute.

于 2011-08-19T09:41:41.457 回答