Pergunta

I have problem ,while i programmatically create product. I want add two different values for store views

$product = Mage::getModel('catalog/product');
$product->setStoreId(1)->setData('name', 'English name')->save();
$product->setStoreId(2)->setData('name', 'Polish name')->save();

After those operation I have proper data in catalog_product_entity_varchar

┌────────┬──────────────┬────────────┬────────┬─────────┬────────────┐
│value_id│entity_type_id│attribute_id│store_id│entity_id│value       │
├────────┼──────────────┼────────────┼────────┼─────────┼────────────┤
│1       │10            │96          │0       │1        │English name│
├────────┼──────────────┼────────────┼────────┼─────────┼────────────┤
│6       │10            │96          │2       │1        │Polish name │
└────────┴──────────────┴────────────┴────────┴─────────┴────────────┘

And this data are good.....

BUT if I want add description (the same way) after name

$product->setStoreId(1)->setData('description', 'English')->save();
$product->setStoreId(2)->setData('description', 'Polish')->save();

catalog_product_entity_varchar change to:

┌────────┬──────────────┬────────────┬────────┬─────────┬────────────┐
│value_id│entity_type_id│attribute_id│store_id│entity_id│value       │
├────────┼──────────────┼────────────┼────────┼─────────┼────────────┤
│1       │10            │96          │0       │1        │English name│
├────────┼──────────────┼────────────┼────────┼─────────┼────────────┤
│2       │10            │96          │1       │1        │Polish name │
├────────┼──────────────┼────────────┼────────┼─────────┼────────────┤
│6       │10            │96          │2       │1        │Polish name │
└────────┴──────────────┴────────────┴────────┴─────────┴────────────┘

What is that? I must make additional operations between those setData? If I comment description part everything works well :(

Nenhuma solução correta

Licenciado em: CC-BY-SA com atribuição
Não afiliado a magento.stackexchange
scroll top