0
votes

I just want to view product on front end which is being edited in back end . (Like View Product in woocommerce/wordpress) . Is there any settings in magento backend ?

Thanks

1
No other options ?? Is this possible without installing any plugins ?Sujeesh S

1 Answers

0
votes

Create a new module add the below content in config.xml :

<global>
<blocks>
    <preview>
        <class>Stackoverflow_Preview_Block</class>
    </preview>
    <adminhtml>
       <rewrite>
           <catalog_product_grid>Stackoverflow_Preview_Block_Adminhtml_Catalog_Product_Grid</catalog_product_grid>
        </rewrite>
   </adminhtml>
</blocks>
</global>

and Create Grid Block (Stackoverflow\Preview\Block\Adminhtml\Catalog\Product\Grid.php) as follows:

class Stackoverflow_Preview_Block_Adminhtml_Catalog_Product_Grid extends Mage_Adminhtml_Block_Catalog_Product_Grid
{
public function setCollection($collection)
{
    parent::setCollection($collection);
}

protected function _prepareColumns()
{

   if(Mage::getStoreConfig('preview/preview/enable')) {
       $this->addColumnAfter('panaction',
                array(
                'header'    => Mage::helper('catalog')->__('Show'),
                'width'     => '50px',
                'type'      => 'action',
                'getter'     => 'getId',
                'actions'   => array(
                    array(
                        'caption' => Mage::helper('catalog')->__('Preview'),
                        'target' => '_blank',
                        'url'     => array(
                            'base'=>'catalog/product/view',
                            'params'=>array('store'=>$this->getRequest()->getParam('store'))
                        ),
                        'field'   => 'id'
                    )
                ),
                'filter'    => false,
                'sortable'  => false
        ), 'action');   
    }   
    return parent::_prepareColumns();
}
}

This will add Preview link in Product grid