Php 在magento管理面板的客户视图的“愿望列表”选项卡中显示sku列

Php 在magento管理面板的客户视图的“愿望列表”选项卡中显示sku列,php,magento,magento-1.8,Php,Magento,Magento 1.8,如何在magento管理面板的客户视图的“愿望列表”选项卡中添加列以显示sku 在app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Wishlist.php中,我在受保护函数下添加了以下代码_prepareColumns()以在Wishlist选项卡中添加SKU列: $this->addColumn('sku', array( 'header' => Mage::helper('customer')-&

如何在magento管理面板的客户视图的“愿望列表”选项卡中添加列以显示sku

app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Wishlist.php中,我在受保护函数下添加了以下代码_prepareColumns()以在Wishlist选项卡中添加SKU列:

$this->addColumn('sku', array(
        'header' => Mage::helper('customer')->__('SKU'),
        'index' => 'sku',
        'width' => '100px'
    ));
添加此代码后,将添加SKU列,但此列下不显示值(即产品的SKU)


请帮忙。如何在SKU列下显示这些值。

扩展到本地代码池,如下所示:

/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Wishlist.php
在以下位置创建新的网格项渲染器:

/app/code/local/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Grid/Renderer/Sku.php
并将现有项目渲染器的内容复制到该文件中:

/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Grid/Renderer/Item.php
创建新的HTML模板:

app/design/adminhtml/default/default/template/customer/edit/tab/view/grid/sku.phtml
与现有的item adminhtml呈现器模板一样,加载$product并从中获取SKU:

$product = $this->getProduct();

echo $this->escapeHtml($product->getSku())
更改文件顶部的函数
\u construct
,以调用新的渲染器模板来获取SKU值:

    parent::_construct();
    $this->setTemplate('customer/edit/tab/view/grid/sku.phtml');
    return $this;
将SKU列添加到函数
\u prepareColumns

    $this->addColumn('sku', array(
        'header'    => Mage::helper('catalog')->__('Product SKU'),
        'index'     => 'sku',
        'renderer'  => 'adminhtml/customer_edit_tab_view_grid_renderer_sku'
    ));
导致:


将以下内容扩展到本地代码池:

/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/Wishlist.php
在以下位置创建新的网格项渲染器:

/app/code/local/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Grid/Renderer/Sku.php
并将现有项目渲染器的内容复制到该文件中:

/app/code/core/Mage/Adminhtml/Block/Customer/Edit/Tab/View/Grid/Renderer/Item.php
创建新的HTML模板:

app/design/adminhtml/default/default/template/customer/edit/tab/view/grid/sku.phtml
与现有的item adminhtml呈现器模板一样,加载$product并从中获取SKU:

$product = $this->getProduct();

echo $this->escapeHtml($product->getSku())
更改文件顶部的函数
\u construct
,以调用新的渲染器模板来获取SKU值:

    parent::_construct();
    $this->setTemplate('customer/edit/tab/view/grid/sku.phtml');
    return $this;
将SKU列添加到函数
\u prepareColumns

    $this->addColumn('sku', array(
        'header'    => Mage::helper('catalog')->__('Product SKU'),
        'index'     => 'sku',
        'renderer'  => 'adminhtml/customer_edit_tab_view_grid_renderer_sku'
    ));
导致:


您需要获得每个产品的sku值。例如:
$sku=Mage::getModel('catalog/product')->load($\u product->getId())->getSku()谢谢你的回答。请告诉我,在wishlist中,在哪里添加代码以获取每个产品的sku值。php您需要获取每个产品的sku值。例如:
$sku=Mage::getModel('catalog/product')->load($\u product->getId())->getSku()谢谢你的回答。请告诉我,在wishlist.php中,在哪里添加代码以获取每个产品的sku值