我们的使命

助力跨境卖家高效建立全球销售网络

喜报2021年我司获《江苏省国家高新技术企业》认定

分类目录

文章标签

热门推荐

相关咨讯

opencart缓存插件,magento快速导入

2022-10-19 10:26:00 - 米境通跨境电商

   

    首先

    评估要导入Magento的内容.qestion得到回答越清楚,评估你的选择就越容易.

    基本上,这些选项包括通过内置导入(内置方式)导入数据,通过自定义脚本导入数据(脚本方式),通过纯SQL(可怕的,可怕的SQL方式)导入数据以及通过外部模块导入(模块方式).

    内置的方式

    首先,您可以通过后端导入csv数据,如果您可以将基于opencart的产品/客户以CSV格式提供,然后可以在后端重新导入-请参阅此处或此处(仅限产品).

    这个解决方案取决于你如何从开放式购物车中导出数据这一事实,我坦率地说,这不是专家.只要你可以导出到XLS,CSV或类似产品,你应该没问题.

    脚本方式

    如果你不能这样做,我建议使用Magento自己的模型编写一个导入脚本.一个非常基本的片段,可以帮助您入门:

   
    //placethisfileintheMagentoroot,e.g../import.php,"."beingyouMagentoroot

    //loadthemagentoappwiththeadminstore

    require_once('app/Mage.php');

    Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);

    //dataimport,Iassumeyoucanwritesomesortofinputforthis$datalikereadingazipfileorsomeotherformat,ihere,Iassume,this$dataarrayholdsarraysofproducts($new_product)containinginformationonaproductfromopencart

    $data=...

    //loopoverthedataandcreatetheMagentomodels,thesecanincludeproducts,customers,etc.-forsimplicitythisisdoneforproducts,butcanbedoneforeveryotherdataobjectinmagento

    foreach($dataas$new_product){

    //loadanemptyMagentoproductmodel

    $product=Mage::getModel('catalog/product');

    //settheattributesyouwant

    $product->setData('sku',$new_product['sku']);

    $product->setData('name',$new_product['name']);

    .

    .

    .

    //saveit

    try{

    $product->save();

    }

    catch(Exception$e){

    Mage::logException($e);

    continue;

    }

    }

    这是一个利用的例子Mage_Catalog_Model_Product,其他数据类型可以是Mage_Sales_Model_Order订单或Mage_Customer_Model_Customer客户.我可以从内存中回忆一下Magento风格的一些数据对象实例化调用的代码:

    Mage_Catalog_Model_Product可以实例化为Mage::getModel('catalog/product')

    Mage_Catalog_Model_Category可以实例化为Mage::getModel('catalog/category')

    Mage_Customer_Model_Customer可以实例化为Mage::getModel('customer/customer')

    Mage_Sales_Model_Order可以实例化为Mage::getModel('sales/order')
    联系我们
  • 24H客服
  • 联系电话:16651690460(龙经理)
  • 微信咨询:
南京天遥路联网络科技有限公司,版权所有 Copyright By ©米境通ERP4.0,2015-2025,苏ICP备:苏ICP备15044100号-4, 苏公网安备:32011402011043