简体   繁体   English

Magento产品以编程方式和多个店面导入

[英]Magento Products Import Programmatically and and Multiple Storefronts

I have created a product import script which parse csv and import simple products. 我创建了一个产品导入脚本,它解析csv并导入简单的产品。 which is quite easy and there is lot of help available on it. 这很容易,并且有很多帮助。 The real problem is when i set them for different multiple storefronts. 真正的问题是当我为不同的多个店面设置它们时。

 $websites = Mage::getModel('core/website')->getCollection()->setLoadDefault(false);
 $websiteLookup = array();
 foreach ($websites as $website) {
    $websiteLookup[$website->getCode()] = $website->getWebsiteId();
 }
 $product->setWebsiteIds($websiteLookup)->save();

Question is, How could i set product titles and product descriptions for each storefront while adding product? 问题是,如何在添加产品时为每个店面设置产品标题和产品说明?

 $product->setDescription("DESCRIPTION HERE");

Does above function for setting Description takes array with store ids or is there another way around. 上面用于设置描述的函数是使用存储ID的数组还是有另一种方法。 Immediate help will be appreciated. 我们将不胜感激。

I recomend you read the functions 我建议你阅读这些功能

_initProduct()
_initProductSave()
saveAction()

in

class Mage_Adminhtml_Catalog_ProductController

Which covers how Magento does it. 其中包括Magento如何做到这一点。

You can capture the POST data by creating a test product in the Magento admin area, pressing the save button and inspecting the POST data sent back to Magento (or by sticking a quick var_dump in saveAction() ) 您可以通过在Magento管理区域中创建测试产品来捕获POST数据,按下保存按钮并检查发送回Magento的POST数据(或者在saveAction()粘贴快速var_dump

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM