Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/260.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 添加带有属性颜色、大小的产品名称(按顺序排列)_Php_Magento_Magento 1.9_Magento 1.8_Magento Dev - Fatal编程技术网

Php 添加带有属性颜色、大小的产品名称(按顺序排列)

Php 添加带有属性颜色、大小的产品名称(按顺序排列),php,magento,magento-1.9,magento-1.8,magento-dev,Php,Magento,Magento 1.9,Magento 1.8,Magento Dev,我想添加带有属性(颜色、大小)的产品名称。但使用以下代码后,总记录仅显示2条记录。这是我的密码: 文件名为:app/code/local/Mage/Adminhtml/Block/Sales/Order/Grid protected function _prepareCollection() { $collection = Mage::getResourceModel($this->_getCollectionClass()); $collecti

我想添加带有属性(颜色、大小)的产品名称。但使用以下代码后,总记录仅显示2条记录。这是我的密码: 文件名为:app/code/local/Mage/Adminhtml/Block/Sales/Order/Grid

 protected function _prepareCollection()
    {
        $collection = Mage::getResourceModel($this->_getCollectionClass());
        $collection->getSelect()->joinLeft('sales_flat_order', 'main_table.entity_id = sales_flat_order.entity_id',array('customer_email'=>'customer_email'));
        $collection->getSelect()->joinLeft('sales_order_status', 'sales_flat_order.status=sales_order_status.status',array('label'=>'label'));
        $collection->join(
                'sales/order_item',
                '`sales/order_item`.order_id=`main_table`.entity_id',
                array(
                     'product_name' => new Zend_Db_Expr('group_concat(`sales/order_item`.name SEPARATOR ",")'),
                    )
                );
        $collection->getSelect()->group('entity_id');

        //$collection->getSelect()->join('sales_flat_order_address', 'main_table.entity_id = sales_flat_order_address.parent_id AND sales_flat_order_address.address_type = "shipping" ',array('telephone', 'email'));
        //var_dump((string)$collection->getSelect());
        $this->setCollection($collection);
        return parent::_prepareCollection();
    }
和函数中的_prepareColumns()


请帮助我如何添加具有产品名称的属性?

您好,我想您当时需要使用magento中的“渲染器”将新字段添加到产品网格中。你试过了吗,请检查一下,希望你的问题能完全解决。嗨,不,我没有使用渲染器。请告诉我如何在销售订单网格中使用渲染器,并告诉我如何查询以获取带有属性(颜色、大小)的产品名称。我使用以下代码获取产品属性颜色和大小,但当我打印$attributes时,它什么也不显示:$\u Product=Mage::getModel('catalog/Product')->load($row['entity_id']);$attributes=$product->getAttributes();您好,如果您想在此时将新字段添加到产品网格,则需要使用“Renderer”在magento中。您尝试过了吗?请检查,希望您的问题能够得到完全解决。您好,不,我没有使用渲染器。请告诉我如何在销售订单网格中使用渲染器,并告诉我如何查询以获取具有属性(颜色、大小)的产品名称。我使用下面的代码来获取产品属性的颜色和大小,但当我打印$attributes时,它什么也不显示:$\u product=Mage::getModel('catalog/product')->load($row['entity\u id'));$attributes=$product->getAttributes();
$this->addColumn('product_name', array(
            'header'    => Mage::helper('Sales')->__('Product Name'),
            'width'     => '100px',
            'index'     => 'product_name',
            'type'        => 'text',
        ));