久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

將列添加到 Magento 管理目錄 >管理產品

Add column to Magento admin catolog gt; manage products(將列添加到 Magento 管理目錄 管理產品)
本文介紹了將列添加到 Magento 管理目錄 >管理產品的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

您好,我想在 catolg > 管理產品部分添加一列(不是產品,而是產品列表),此列需要列出產品已與其標識的任何相關產品 - 可能是按 sku 或名稱 - 否偏好那里.

Hi I want to add a column to the catolg > manage products section (not the product but the list of products), this column needs to list any related products the product has identified with it - maybe by sku or name - no preferance there.

我為制造商添加了一列,但忘記了從哪里獲得代碼.

I added a column for manufacturer but forgot where i obtained the code from.

謝謝

推薦答案

我最近(實際上是昨天)不得不在同一個網格中添加一列.部分是因為這是不好的做法,主要是因為另一個模塊已經使用了它自己的覆蓋,我不想完全替換或覆蓋該類.相反,這里提供了一種通過事件修改產品網格的簡潔方法.

I recently (yesterday in fact) had to add a column to the same grid. Partly because it is poor practice and mostly because another module had already used it's own override, I didn't want to replace or override the class completely. Instead here is a clean way to modify the product's grid via events.

app/code/local/My/Module/etc/config.xml

<config>
    <adminhtml>
        <events>
            <adminhtml_block_html_before>
                <observers>
                    <mymodule>
                        <!-- Add column to catalog product grid -->
                        <class>mymodule/adminhtml_observer</class>
                        <method>onBlockHtmlBefore</method>
                    </mymodule>
                </observers>
            </adminhtml_block_html_before>
            <eav_collection_abstract_load_before>
                <observers>
                    <mymodule>
                        <!-- Add column to product list -->
                        <class>mymodule/adminhtml_observer</class>
                        <method>onEavLoadBefore</method>
                    </mymodule>
                </observers>
            </eav_collection_abstract_load_before>
        </events>
    </adminhtml>
</config>

app/code/local/My/Module/Model/Adminhtml/Observer

class My_Module_Model_Adminhtml_Observer
{

    public function onBlockHtmlBefore(Varien_Event_Observer $observer) {
        $block = $observer->getBlock();
        if (!isset($block)) return;

        switch ($block->getType()) {
            case 'adminhtml/catalog_product_grid':
                /* @var $block Mage_Adminhtml_Block_Catalog_Product_Grid */
                $block->addColumn('COLUMN_ID', array(
                    'header' => Mage::helper('mymodule')->__('COLUMN HEADER'),
                    'index'  => 'COLUMN_ID',
                ));
                break;
        }
    }

    public function onEavLoadBefore(Varien_Event_Observer $observer) {
        $collection = $observer->getCollection();
        if (!isset($collection)) return;

        if (is_a($collection, 'Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection')) {
            /* @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection */
            // Manipulate $collection here to add a COLUMN_ID column
            $collection->addExpressionAttributeToSelect('COLUMN_ID', '...Some SQL goes here...');
        }
    }

}

這篇關于將列添加到 Magento 管理目錄 >管理產品的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Magento products by categories(按類別劃分的 Magento 產品)
Resource interpreted as image but transferred with MIME type text/html - Magento(資源被解釋為圖像但使用 MIME 類型 text/html 傳輸 - Magento)
Is there an event for customer account registration in Magento?(Magento 中是否有客戶帳戶注冊事件?)
Magento addFieldToFilter: Two fields, match as OR, not AND(Magento addFieldToFilter:兩個字段,匹配為 OR,而不是 AND)
quot;Error 404 Not Foundquot; in Magento Admin Login Page(“未找到錯誤 404在 Magento 管理員登錄頁面)
Get Order Increment Id in Magento(在 Magento 中獲取訂單增量 ID)
主站蜘蛛池模板: 亚洲色图网址 | 午夜看电影在线观看 | 91精品国产综合久久久久 | 国产一级片一区二区三区 | 欧美精品在线免费观看 | 国产自产c区 | 天天操夜夜操 | 成人激情视频 | 91精品国产一区二区三区 | 亚洲免费网 | 国产一区二区在线播放 | 97伦理电影网 | 男人的天堂视频网站 | 99精品99久久久久久宅男 | 精品久久久久久久久久久久 | 国产三级国产精品 | 99精品免费视频 | 97视频在线观看免费 | 成人午夜免费网站 | 夜夜草天天草 | 97伦理影院 | 一区二区三区不卡视频 | 九七午夜剧场福利写真 | 欧美一级片在线 | 91免费在线视频 | 一区二区三区免费 | 国产精品99久久久久久动医院 | 午夜男人视频 | 97视频在线观看免费 | 欧美a免费 | 尹人av | 国产欧美在线观看 | 99国产视频 | 91成人在线| 狠狠操狠狠操 | 中文字幕国产 | 亚洲午夜久久久 | 久久综合久 | 在线视频一区二区三区 | 激情 一区 | 久久久精品一区 |