Search code examples
magentoexportcustom-attribute

Multiselect prodct's attribute


I have created a new multi select type attribute from admin in magento using manage attribute section and used back end source model for label and value.

Now when I export the product csv from admin using export all data profile than my multi select attribute shows blank. i want to show selected value in csv.

My source model code:

<?php
    class CityVal_City_Model_Product_Attribute_Unit extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
    {
      public function getAllOptions()
      {
        $connection = Mage::getModel('core/resource')->getConnection('core_read');
        $sql = 'SELECT  city_id,city_name FROM cities';
        $orders = $connection->fetchAll($sql);
        foreach($orders as $ord)
        {
            $customerArr[] = array(
                           'value' => $ord['city_id'],
                           'label' => $ord['city_name'],
                            );
        }
        if (!$this->_options) {
            $this->_options = $customerArr;
        }
        return $this->_options;
      }
    }
    ?>

After foreach we have value in multi select city drop down in admin. i am unale to post image otherwise, i post a image


Solution

  • If you want to export multi select attribute then go to system -> import/export -> dataflow - profiles and export product by select your store. You will find multiselect attribute with value which product have selected in csv file.