Magento - Get Custom Option Value details from Option Value ID

前端 未结 4 1726
余生分开走
余生分开走 2021-02-02 15:31

I have some intriguing questions related to Custom Options of Product:-

  1. Is there any difference between Options & Custom Options? This is because I have foun

4条回答
  •  你的背包
    2021-02-02 16:32

    A similar question was asked here:

    get selected custom option price for simple product in observer

    I gave the following answer there:


    If you have the option value ID you can also do I direct query to get the option price. I know this is not completely the Magento way and you might have to do some custom calculating (for procent prices for example), but you could do something like this:

    $optionValueId = 1234; // replace with you option value ID
    
    $resource = Mage::getSingleton('core/resource');
    $connection = $resource->getConnection('read');
    
    $optionvaluePrice = $connection->fetchRow(
        sprintf('SELECT * FROM %1$s WHERE option_type_id = %2$d', 
            $resource->getTableName('catalog/product_option_type_price'), 
            $optionValueId
        )
    );
    

    Sadly, Magento doesn't seem to have a model to load a single option price separately.

提交回复
热议问题