Call-back icon  Sales: Call 877.832.5289 (N America)|310.295.4144 (International)

Magento

eCommerce Software for Online Growth

Magento Forum

   
Import Experience So Far…
 
United Media Associates
Member
 
Avatar
Total Posts:  48
Joined:  2008-03-27
 

I tried to use the tool to import 79 products from an osCommerce database. It ended up importing 44 and then just died.

I did some looking into the osCommerce database, and found that some of the products don’t have “model” values which is what the import tool seems to translate into an SKU for the product. It also looks like the SKU for a product in the Magento database is required and has to be unique… at least if you try entering the product in manually.

I think I found the code that requests the products from the osCommerce database:
app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce.php

937     public function getProducts($limit = array())
    
938     {
    939         $defaultLanguage 
$this->getOscDefaultLanguage();
    
940         $defaultLanguageId $defaultLanguage['id'];
    
941         $code $this->getWebsiteModel()->getCode();
    
942         $website $code$code$this->getCurrentWebsite()->getCode();
    
943         $connection $this->_getForeignAdapter();
    
944         $select =  "SELECT `p`.`products_id` `id`, `p`.`products_quantity` `qty` ";
    
945         $select .= ", `p`.`products_model` `sku`, `p`.`products_price` `price`";
    
946         $select .= ", `p`.`products_image` `image` ";
    
947         $select .= ", `p`.`products_weight` `weight`, IF(`p`.`products_status`,'Enabled','Disabled') `status` ";
    
948         $select .= ", IF(`p`.`products_status`,'1','0') `is_in_stock`";
    
949         $select .= ", `pd`.`products_name` `name`, `pd`.`products_description` `description` ";
    
950         $select .= ", `pd`.`products_description` `short_description` ";
    
951         $select .= ", `tc`.`tax_class_title` `tax_class_id`, IF(1,'".self::DEFAULT_VISIBILITY."','') `visibility` ";
    
952         $select .= ", IF(1,'".self::DEFAULT_ATTRIBUTE_SET."','') `attribute_set` ";
    
953         $select .= ", IF(1,'".self::DEFAULT_PRODUCT_TYPE ."','') `type` ";
    
954         //$select .= ", IF(1,'".self::DEFAULT_STORE."','') `store` ";
    
955         $select .= ", IF(1,'".$website."','') `website` ";
    
956         $select .= "FROM `{$this->_prefix}products` p LEFT JOIN `{$this->_prefix}products_description` pd ";
    
957         $select .= "ON `pd`.`products_id`=`p`.`products_id` AND `pd`.`language_id`={$defaultLanguageId} ";
    
958         $select .= "LEFT JOIN `{$this->_prefix}tax_class` tc ON `tc`.`tax_class_id`=`p`.`products_tax_class_id` ";
    
959         if ($limit && isset($limit['from']) && isset($limit['max'])) {
    960             $select 
.= " LIMIT {$limit['from']}, {$limit['max']}";
    
961         }
    962         
if (!($result $this->_getForeignAdapter()->fetchAll($select))) {
    963             $result 
= array();
    
964         }
    965         
return $result;
    
966     }

I ran a query to try and determine which items had duplicate SKU values in the osCommerce database:

select products_modelcount(*)
from products
group by products_model
having count
(*) > 1

Then I extracted the query from the above PHP code and ran it to see what appeared around the 45th result. I didn’t find anything odd on the 45th record… but I did notice that the first duplicate SKU appeared on the 47th record, and I also noticed in the first 47 records that 2 of the records had empty values for the SKU. I’m guessing that the import utility skipped all the products with the missing SKUs, because I didn’t see them in the list of 44 products that did get imported. Then I think once it got to the record with an identical SKU value to an item that was already in Magento the script choked on the fact that it had a duplicate SKU.

I also have some bundled items in the osCommerce database and it imported the item as a simple product, so I’m not sure about that one yet, since it’s not really reflected well in Magento yet, but at least it didn’t choke on those items.

Matt (mjohnsonperl)

 Signature 

United Media Associates, LLC.
Professional Magento Consulting and Systems Integration
_________________________________________________________
http://umassociates.com - Magento Silver Partner

 
Magento Community Magento Community
Magento Community
Magento Community
 
Phillip Hughes
Jr. Member
 
Total Posts:  12
Joined:  2008-05-19
 


I would just like to say that I have been trying to use the osCommerce integration tool for a week or so now but have until today failed again and again.

But I have now managed to succesfully import Customers / Products / Categories / Orders without 1 fail. I have around 2000 customers and 1000 products and they have migrated beautifully.

Now I can’t say this will work for everyone but the difference in the working attempt to my previous ones is this:

I’m importing from CRE-Loaded 6.2 so yes there is hope to us all !

I used English (United States) as Language in initial setup even though its a UK install.
I also made sure I exported the SQL file in UTF8 and in the import options I chose UTF8 for both options.

These are the only changes I have made but I have a working migration which means that our business can finally start using Magento.

I’d like to take this time to say congratulation to the Magento team for creating an e-commerce system far ahead the rest and also on releasing the osCommerce Migration Tool so promptly. No its not perfect and not near a Stable version, but it has worked and that is enough.

I hope this helps at least a couple of you out there,
Thanks Magento !

Phil Hughes

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
 
Sales: Call 877.832.5289 (North America) 310.295.4144 (International)
© Copyright 2008 Varien. Magento, eCommerce software, is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
53203 users|781 users currently online|107235 forum posts