0

My problem: I insert the product from management software into magento. The problem is here:

->setStoreId(1) ->setWebsiteIds(array(1))

I have: 1 web site (id:1) 1 store (id:1) 3 view (id 1, 2, 3)

if i use

->setStoreId(1) ->setWebsiteIds(array(1))

I update only the view the view 1 but not upgrade the other view or store.

if i want update or insert product into main web site(global, what should I enter??

Thanks a lot

Alessandro

0

Try :

$productId = 1;
$storeId  = 1;
$websiteIds = array(1);
$identifierType = null; //
$product = Mage::helper('catalog/product')->getProduct($productId, $storeId, $identifierType);   
if (Mage::app()->isSingleStoreMode()) {
    $product->setWebsiteIds(array(Mage::app()->getStore(true)->getWebsite()->getId()));
}else {
    $product->setStoreId($storeId);
    $product->setWebsiteIds($websiteIds);   
}

try {
    $product->save();
} catch (Mage_Core_Exception $e) {
    $e->getMessage();
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.