本文介紹了如何在 magento 中以編程方式更新自定義選項?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!
問題描述
我有很多帶有自定義選項的產(chǎn)品,現(xiàn)在我需要通過 csv 文件只更新自定義選項.那么我們?nèi)绾我跃幊谭绞阶龅竭@一點?
I have lot of products with custom options, now I have requirement to update only custom options through csv file. so how we can do this programatically?
推薦答案
我找到了一種以編程方式更新自定義選項的解決方案,這是解決方案
i found one solution for updating custom options programatically here is the solution
$product = Mage::getModel('catalog/product')->load($product_id);
$values = array();
foreach ($product->getOptions() as $o) {
$p = $o->getValues();
}
}
foreach($p as $v)
{
$values[$v->getId()]['option_type_id']= $v->getId();
$values[$v->getId()]['title']= 'test';
$values[$v->getId()]['price']= 23;
$values[$v->getId()]['price_type']= 'fixed';
$values[$v->getId()]['sku']= $value1;
}
$v->setValues($values);
$v->saveValues();
$product->save();
希望這對某人有所幫助這只會更新自定義選項值
hope this help someone this only update custom options value
這篇關(guān)于如何在 magento 中以編程方式更新自定義選項?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!