Offline_update_eav !!install!! May 2026

photo author
- Senin, 2 Desember 2024 | 12:58 WIB
Putuskan untuk pensiun, sosok dari Lebah Ganteng akhirnya terungkap. (Foto: Paramount Picture / Bee Movie)
Putuskan untuk pensiun, sosok dari Lebah Ganteng akhirnya terungkap. (Foto: Paramount Picture / Bee Movie)

Offline_update_eav !!install!! May 2026

Here’s a piece on offline_update_eav — written as a concise technical note / documentation excerpt. Context In Magento (1.x and early 2.x patterns), EAV attributes are updated via standard models and collection saves. For large catalogs, bulk updates (e.g., price, description, or custom attribute changes) cause significant database load and reindexing overhead. The offline_update_eav approach bypasses live ORM overhead by writing directly to EAV tables in a controlled, offline process.

// Assume $productIds array, $attributeCode = 'special_price', $storeId = 0 $attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', $attributeCode); $table = $attribute->getBackend()->getTable(); $attributeId = $attribute->getId(); $value = 19.99; foreach (array_chunk($productIds, 500) as $chunk) { $write = Mage::getSingleton('core/resource')->getConnection('core_write'); $write->beginTransaction(); try { // Delete existing values $write->delete($table, [ 'attribute_id = ?' => $attributeId, 'entity_id IN (?)' => $chunk, 'store_id = ?' => $storeId ]); // Insert new values foreach ($chunk as $entityId) { $write->insert($table, [ 'entity_id' => $entityId, 'attribute_id' => $attributeId, 'store_id' => $storeId, 'value' => $value ]); } $write->commit(); } catch (Exception $e) { $write->rollBack(); // Log error } } // After all updates: reindex and clean cache offline_update_eav

Halaman:
Dilarang mengambil dan/atau menayangkan ulang sebagian atau keseluruhan artikel
di atas untuk konten akun media sosial komersil tanpa seizin redaksi.

Editor: Novi Embun Tristiani

Sumber: AboutMalang.com

Tags

Artikel Terkait

Rekomendasi

Terkini

X