简体   繁体   中英

Magento Products Import Programmatically and and Multiple Storefronts

I have created a product import script which parse csv and import simple products. 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. 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.

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() )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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