Magento Forum

   
Import from OXID eSales
 
Aldoric
Jr. Member
 
Total Posts:  4
Joined:  2008-01-18
 

Hello,

There’s an old shop system based on the commercial OXID eSales system. Since there are many entries inside this shop I’d like to ask if there is an import script someone know about to convert the database from OXID to Magento.

Thanks for every help

 
Magento Community Magento Community
Magento Community
Magento Community
 
pableu
Jr. Member
 
Total Posts:  29
Joined:  2008-09-19
 

Hi,

I know this is an old topic, but this might help others that search for a solution to this.

Our company is also currently switching from Oxid to Magento, and I’ve found that the WEB-API is quite powerful and easy to use. It’s documented here: http://www.magentocommerce.com/wiki/doc/webservices-api/api

For the Moment, I have written a script that takes the Oxid MySQL database and imports the products (including pictures) into magento. It basically uses the following code.

<?php

$start 
microtime($get_as_float=TRUE);

$skipuntil ''// use this to skip everything until a certain OXARTNUM / SKU appears.
$prefix 'uhu-images-temp'// specify where the 1,2,3,.. folders from OXID shop reside.


header('Content-Type: text/plain;charset=utf-8');
// see http://www.magentocommerce.com/wiki/doc/webservices-api/api
ob_end_flush();

$proxy = new SoapClient('http://...api/soap/?wsdl');
$sessionId $proxy->login('...',
    
'...');

// get list of SKUs from Magento
$products = ($proxy->call($sessionId,
    
'catalog_product.list'));
$SKUs = array();
foreach (
$products as $product)
    
$SKUs[] $product['sku'];


mysql_connect('...','...','...');
mysql_select_db('...');

$query "SELECT 
    `OXARTNUM`,
    `OXTITLE`,
    `OXSHORTDESC`,
    `OXLONGDESC`,
    `OXTITLE_2`,
    `OXSHORTDESC_2`,
    `OXLONGDESC_2`,
    `OXEXTURL`,
    `OXPRICE`,
    `OXPIC1`,
    `OXPIC2`,
    `OXPIC3`,
    `OXPIC4`,
    `OXPIC5`,
    `OXPIC6`,
    `OXPIC7`,
    `OXPIC8`,
    `OXPIC9`,
    `OXPIC10`,
    `OXPIC11`,
    `OXPIC12`
    FROM `oxarticles` WHERE `OXACTIV`=1 AND `OXPARENTID` IS NULL"
;

$result mysql_query($query);


while (
$r mysql_fetch_assoc($result)) {
    
foreach ($r as &$v// & = by reference
        
$v utf8_encode($v);
    
    
$sku     array_shift($r);
    
$title   array_shift($r);
    
$shortd  array_shift($r);
    
$longd   array_shift($r);
    
$titlef  array_shift($r);
    
$shortdf array_shift($r);
    
$longdf  array_shift($r);
    
$url     array_shift($r);
    
$price   array_shift($r); // now, only OXPIC1 to OXPIC12 remain in $r
    
    
print "\n\nLooking at $sku ($title$shortd)";
    
    
$prodD = array(
        
'name'              => $title,
        
'websites'          => array(0,1),
        
'short_description' => $shortd,
        
'description'       => $longd,
        
'price'             => $price,
        
'ext_url'            => $url,
        
'status'             => 1,
        
'visibility'         => 4,
        
'tax_class_id'        => 2
    
);
    
$prodF = array();
    
    if (
$title != $titlef)
        
$prodF['name'$titlef;
    if (
$shortd != $shortdf)
        
$prodF['short_description'$shortdf;
    if (
$longd != $longdf)
        
$prodF['description'$longdf;

    if (!
in_array($sku,$SKUs))// product not yet in magento
        
$proxy->call($sessionId'product.create', array('simple'$sku$prodD));
        print 
"\n   Inserted into main store";
    
}
    
    
if (count($prodF)>0){
        $proxy
->call($sessionId'product.update', array($sku$prodF'uhu_fr'));
        print 
"\n   Inserted into French";
    
}
    
    
if (!in_array($sku,$SKUs)){
        
print "\n   Adding Pictures:";
        foreach(
$r as $name => $file){
        
            $name 
substr($name,5); // extract image number, e.g. 3 from OXPIC3.
        
            
if ($file=='nopic.jpg')
                continue; 
// continue if it's no picture
            
            
$uri $prefix.'/'.$name.'/'.$file;
        
            if (!
is_file($uri))
                continue; 
// continue if pic doesn't exist
            
            
$newImage = array(
                
'file' => array(
                    
'content' => base64_encode(file_get_contents($uri)),
                    
'mime'    => 'image/jpeg'
                
),
                
'label' => '',
                
'position' => $name,
                
'types' => (($name==1)?(array('small_image','image','thumbnail')):array()),
                
'exclude' => 0
            
);
        
            
$imageFilename $proxy->call($sessionId,'product_media.create',array($sku,$newImage));
        
            print(
" ".$imageFilename);
        
}
    }
    
print("\n   Time used so far: ".(microtime($get_as_float=TRUE)-$start));
}
?>

The above code es even more complicated because it also imports french product titles and descriptions that where custom-added to our oxid installation. Anyways, I think it’s a good starting point for writing your own Oxid-To-Magento Script grin

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top