2

I am Created Custom Module for Customer Grid Serializer and now I want to Store That Values in Diffrent Table. Can Any one Help me? Any Kind of help will appreiciated.

My Grid Code : app/code/local/Sigmasolve/Recipe/Block/Adminhtml/Recipe/Edit/Tab

     <?php

class Sigmasolve_Recipe_Block_Adminhtml_Recipe_Edit_Tab_Customers extends Mage_Adminhtml_Block_Widget_Grid
{
   public function __construct()
    {
        parent::__construct();
        $this->setSaveParametersInSession(false);
        $this->setUseAjax(true);
        $this->setId('recipe_customers');
    }
    protected function _prepareCollection()
    {
        $collection = Mage::getResourceModel('customer/customer_collection')
            ->addNameToSelect();

        $this->setCollection($collection);
        return parent::_prepareCollection();
    }
    protected function _prepareColumns()
    {
        $this->addColumn('selected_customers', array(
            'header'    => $this->__('Popular'),
            'type'      => 'checkbox',
            'index'     => 'entity_id',
            'align'     => 'center',
            'field_name'=> 'selected_customers',
            'values'    => $this->getSelectedCustomers(),
        ));

        $this->addColumn('name', array(
            'header'    => $this->__('Name'),
            'index'     => 'name',
            'align'     => 'left',
        ));

        return parent::_prepareColumns();
    }
    public function getGridUrl()
    {
        return $this->getUrl('*/*/customersGrid', array('_current' => true));
    }
}
3
  • share your gird code. Dec 23 '16 at 10:05
  • I put my code in Question
    – H_Parekh
    Dec 23 '16 at 10:07
  • you code in custroller save action to store value Dec 23 '16 at 10:36
1

That will your custom grid field name orders change it accordingly your name

 $this->addColumn('selected_customers', array(
        'header'    => $this->__('Popular'),
        'type'      => 'checkbox',
        'index'     => 'entity_id',
        'align'     => 'center',
        'name'     => 'customers',
        'field_name'=> 'selected_customers',
        'values'    => $this->getSelectedCustomers(),
    ));


if(isset($postData['links'])){
      $customgrid = Mage::helper('adminhtml/js')->decodeGridSerializedInput($postData['links']['customers']); //Save the array to your database
      $customgridvalues = implode(",", $customgrid);
      }

complete example of grid

3
  • can I ask for that in which table data are store in databse?
    – H_Parekh
    Dec 23 '16 at 10:15
  • I want to create new table for that?
    – H_Parekh
    Dec 23 '16 at 10:15
  • you want to store these values in different table $customgridvalues. these are your values. Dec 23 '16 at 10:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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