0

In the low stock report I need to add the manufacturer/brand as a column for each ID or product name, so that I'm able to prepare stock requests per manufacturer.

Any help to accomplish this is very welcome.

1 Answer 1

1

Hope you have override the core Class for Increase stock.

Step 1: Override the grid Class in local folder.

Step 2: In Prepare Column add below Code.

 $this->addColumn('brand',
        array(
            'header' => Mage::helper('reports')->__('Pending'),
            'type' => 'string',
            'filter' => false,
            'sortable' => false,
            'renderer' => 'Namespace_Modulename_Block_Adminhtml_Renderer_brand'
        ));

Step 3: create File app/code/local/Namespace/Modulename/Block/Adminhtml/Renderer/brand.php.

Step 4: Copy and paste below code.

<?php

class Namespace_Modulename_Block_Adminhtml_Renderer_brand extends  Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
   public function render(Varien_Object $row){

    $data=Mage::getSingleton('catalog/product')->load($row['entity_id']);
    $brandName=$data->getData('brand');
    return number_format($brandName,0);
   }
}

Step 5: Refresh cache and check in your Grid.

4
  • good answser. +1 for it. Commented Sep 29, 2014 at 13:00
  • Thanks Keyul. I've followed your steps, however, low stock report shows up now as a blank page. Note that manufacturer is an "attribute" that I created and added to an "attribute set" to be assigned individually to each product. For Step 2 I've copy-pasted your code in app/code/core/Mage/Adminhtml/Block/Report/Product/Lowstock/grid.php (85). For Step 3 I created the file in "Lowstock_Block_Adminhtml_Renderer_brand", should I create this inside "app/code/core/Mage/Adminhtml/..." instead?
    – Frank
    Commented Sep 30, 2014 at 14:27
  • Tried to write brand.php like this: <<?php class Local_Lowstock_Block_Adminhtml_Renderer_brand extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract { public function render(Varien_Object $row){ $data=Mage::getSingleton('catalog/product')->load($row['entity_id']); $manufacturer=$data->getData('brand'); return number_format($manufacturer,0); } }
    – Frank
    Commented Sep 30, 2014 at 14:37
  • what is actual problem then
    – Keyul Shah
    Commented Oct 7, 2014 at 9:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.