Import products with custom options in Magento

We had to import 75,000 products to a Magento store and all the products had options. I was shocked to discover that, Magento does not support any import profile for custom options. I look around and found someone had posted a fix, which worked. Here is the code: To add this customization to your magento store first copy app/code/core/Mage/Catalog/Model/Convert/Adapter/Product.php to app/code/local/Mage/Catalog/Model/Convert/Adapter/Product.php. This will prevent upgrades from overwriting your changes. Next you need to add some code to “local” version of Product.php (code/local/Mage/Catalog/Model/Convert/Adapter/Product.php). The line numbers below correspond to version 1.3 they may be a bit different in older versions. At about line 566 you will see: foreach ($importData as $field => $value) {     Just above that add:           $custom_options = array();     At about line 575 you will see:   $attribute = $this->getAttribute($field); if (!$attribute) { continue; }   You will need to add some code above the continue statement.
/* CUSTOM OPTION CODE */
if(strpos($field,':')!==FALSE && strlen($value)) {
   $values=explode('|',$value);
   if(count($values)>0) {
      @list($title,$type,$is_required,$sort_order) = explode(':',$field);
      $title = ucfirst(str_replace('_',' ',$title));
      $custom_options[] = array(
         'is_delete'=>0,
         'title'=>$title,
         'previous_group'=>'',
         'previous_type'=>'',
         'type'=>$type,
         'is_require'=>$is_required,
         'sort_order'=>$sort_order,
         'values'=>array()
      );
      foreach($values as $v) {
         $parts = explode(':',$v);
         $title = $parts[0];
         if(count($parts)>1) {
            $price_type = $parts[1];
         } else {
            $price_type = 'fixed';
         }
         if(count($parts)>2) {
            $price = $parts[2];
         } else {
            $price =0;
         }
         if(count($parts)>3) {
            $sku = $parts[3];
         } else {
            $sku='';
         }
         if(count($parts)>4) {
            $sort_order = $parts[4];
         } else {
            $sort_order = 0;
         }
         switch($type) {
            case 'file':
               /* TODO */
               break;
               
            case 'field':
            case 'area':
               $custom_options[count($custom_options) - 1]['max_characters'] = $sort_order;
               /* NO BREAK */
               
            case 'date':
            case 'date_time':
            case 'time':
               $custom_options[count($custom_options) - 1]['price_type'] = $price_type;
               $custom_options[count($custom_options) - 1]['price'] = $price;
               $custom_options[count($custom_options) - 1]['sku'] = $sku;
               break;
                                          
            case 'drop_down':
            case 'radio':
            case 'checkbox':
            case 'multiple':
            default:
               $custom_options[count($custom_options) - 1]['values'][]=array(
                  'is_delete'=>0,
                  'title'=>$title,
                  'option_type_id'=>-1,
                  'price_type'=>$price_type,
                  'price'=>$price,
                  'sku'=>$sku,
                  'sort_order'=>$sort_order,
               );
               break;
         }
      }
   }
}
/* END CUSTOM OPTION CODE */
-----------------------------------------------
Now further on in the code (about line 710) you’ll see $product->save(); Just after this add the following code:
--------------------------------------------------------------------------
/* Remove existing custom options attached to the product */
foreach ($product->getOptions() as $o) {
   $o->getValueInstance()->deleteValue($o->getId());
   $o->deletePrices($o->getId());
   $o->deleteTitles($o->getId());
   $o->delete();
}
/* Add the custom options specified in the CSV import file */
if(count($custom_options)) {
   foreach($custom_options as $option) {
      try {
        $opt = Mage::getModel('catalog/product_option');
        $opt->setProduct($product);
        $opt->addOption($option);
        $opt->saveOptions();
      }
      catch (Exception $e) {}
   }
}
---------------------------------------------------------
Now you should be all set to importing custom options

Salesforce integration into Magento

Powersync (for Salesforce)

This module provides a simple and flexible way of integrating Magento ordering functionality with Salesforce. Each order that is being placed on your website will be pushed into Salesforce as a Lead or an Opportunity (this setting is available in the configuration window). You will have an ability to create custom mappings between Magento order information and fields in your Salesforce objects. Please contact Parent Technology for more information

Reminder: Magento`s default phone numbers and callouts need to be changed before site launch

If you are getting any SQL error message like, SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘Reminder: Change Magento`s default phone numbers and callouts be’ for key ‘title’ or just want to get rid of the Admin Notifications thing, then here is the workaround for that : Copy the file: MAGENTO/app/code/core/Mage/AdminNotification/Model/Resource/Inbox.php to MAGENTO/app/code/local/Mage/AdminNotification/Model/Resource If the directories do not exist, create them, manually. Edit the file MAGENTO/app/code/local/Mage/AdminNotification/Model/Resource/Inbox.php Find this : --------------------------------------
public function parse(Mage_AdminNotification_Model_Inbox $object, array $data)
    {
        $adapter = $this->_getWriteAdapter();
        foreach ($data as $item) {
            $select = $adapter->select()
                ->from($this->getMainTable())
                ->where('title = ?', $item['title']);
            if (empty($item['url'])) {
                $select->where('url IS NULL');
            } else {
                $select->where('url = ?', $item['url']);
            }
            if (isset($item['internal'])) {
                $row = false;
                unset($item['internal']);
            } else {
                $row = $adapter->fetchRow($select);
            }
            if (!$row) {
                $adapter->insert($this->getMainTable(), $item);
            }
        }
    }
}
--------------------------------------------------------------
Replace with this:
-------------------------------------------------------------
public function parse(Mage_AdminNotification_Model_Inbox $object, array $data)
   {
       $adapter = $this->_getWriteAdapter();
       foreach ($data as $item) {
           $select = $adapter->select()
                     ->from($this->getMainTable())
                     ->where('url=? OR url IS NULL', $item['url'])
                     ->where('title=?', $item['title']);
           }
           if (isset($item['internal'])) {
               $row = false;
               unset($item['internal']);
           } else {
               $row = $adapter->fetchRow($select);
           }
           if (!$row) {
               $adapter->insert($this->getMainTable(), $item);
           }
       }
   }

Magento - SugarCRM Bridge

SugarCRM Bridge

If you are a professional retailer and you run both - off-line store and an online eCommerce shop you probably wonder how to connect these two branches of your retail business, integrate and synchronize the information. Using CRM systems is very good for your sales and support team, but how could you enhance your online presence and increase your conversions for Magento based stores? With our solution you can connect your Magento site with SugarCRM and synchronize site users and purchases with customers, cases and opportunities in CRM system.
  • You can map multiple fields from Magento to SugarCRM in several easy steps. Flexible and adjustable mapping allows you to map any Magento and SugarCRM fields. Built-in PHP code processor will let you process eCommerce data and/or combine fields before inserting results into SugarCRM.
  • Magento SugarCRM integration ensures easy export of website customers to SugarCRM. You can export Magento orders to Cases or Opportunities in SugarCRM.
  • Track every item that is being added to the cart by user even if the user is not logged in. After user registers or logs in the bridge will connect this info to the record in SugarCRM.
  • Track abandoned shopping carts in Magento. Every checkout step taken by user is updated in SugarCRM opportunities/cases status so in case of abandoned cart you have tools to track at what stage the cart was left (available in Bridge version 1.3)
  • Our synchronization solution ensures live synchronization process with no cron job required
Being an effective and time-saving solution, our Magento - Sugar CRM synchronization extension will help your sales team to save time on data entry form eCommerce software reports to CRM system and to focus on Customer and sales analysis, which will increase the overall revenue. Whether you aim at increasing online shop customer satisfaction, raising sales through the website, enhancing productivity and efficiency of you eCommerce store or keeping your records organized you will find our extension very helpful and time-saving. Manage your website customers and analyze opportunities and cases to convert website traffic into more sales. Magento-Sugar CRM integration bridge supports Magento Community versions 1.4.xx, 1.5.xx, 1.6.xx,  SugarCRM Community 5.2 and above, SugarCRM PRO. Take a look at the Magento - SugarCRM Bridge Demo site and try all the features yourself: Login at Magento admin demo page and see how to set up field mapping Go to SugarCRM admin demo page and see results of data synchronization Use the following access to login: demouser / demouser1

Site Search

Contact Us

 
 
 
Parent Technology Inc.
1535 Rosalind Rd Se
East Grand Rapids, MI 49506, USA
 
 

This email address is being protected from spambots. You need JavaScript enabled to view it.