在Magento 1.6.1中将SKU列添加到订单网格

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在Magento 1.6.1中将SKU列添加到订单网格相关的知识,希望对你有一定的参考价值。

Add the below commented sections into the appropriate functions in your /app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php and you'll be good to go! This has been (personally) tested with 1.6.1.0
  1. /* You will need to edit/replace your $collection declaration in _prepareCollection() */
  2.  
  3. $collection = Mage::getResourceModel($this->_getCollectionClass())
  4. ->join(
  5. 'sales/order_item',
  6. '`sales/order_item`.order_id=`main_table`.entity_id',
  7. 'skus' => new Zend_Db_Expr('group_concat(`sales/order_item`.sku SEPARATOR ",")'),
  8. 'names' => new Zend_Db_Expr('group_concat(`sales/order_item`.name SEPARATOR ",")'),
  9. 'quantities' => new Zend_Db_Expr('group_concat(`sales/order_item`.qty_ordered SEPARATOR ",")'),
  10. )
  11. );
  12. $collection->getSelect()->group('entity_id');
  13.  
  14. /* You will then need to add new columns in _prepareColumns() */
  15.  
  16. $this->addColumn('sku', array(
  17. 'header' => Mage::helper('Sales')->__('Skus'),
  18. 'width' => '100px',
  19. 'index' => 'skus',
  20. 'type' => 'text',
  21.  
  22. ));
  23. $this->addColumn('names', array(
  24. 'header' => Mage::helper('Sales')->__('Name'),
  25. 'width' => '100px',
  26. 'index' => 'names',
  27. 'type' => 'text',
  28. ));

以上是关于在Magento 1.6.1中将SKU列添加到订单网格的主要内容,如果未能解决你的问题,请参考以下文章

在 WooCommerce 中将列添加到管理订单列表

如何在magento中将订单详细信息传递给paypal express checkout?

如何在 Magento 管理面板中添加新按钮到订单视图?

Magento 2:从数据库中获取产品、Sku 和制造商名称

Magento:在产品页面中将产品选项显示为两列中的列表元素

Magento在admin中将自定义输入字段添加到客户帐户窗体