2

enter image description here

Need get Sub options with id 38, 39 Easy get options $_product->getOptions() but how get sub options (row) ?

4
  • are want the data using options select field 38,39?
    – Amit Bera
    Commented Feb 11, 2015 at 12:28
  • yes.., but how?
    – Ratio
    Commented Feb 11, 2015 at 12:31
  • $productOptionValue = Mage::getModel('catalog/product_option_value')->load($valueId);
    – Amit Bera
    Commented Feb 11, 2015 at 12:37
  • are you want all value of option Select your service using it id?
    – Amit Bera
    Commented Feb 11, 2015 at 12:56

3 Answers 3

1

To get Data of Options That is Select your Service in your case you can do like this

$products = Mage::getModel('catalog/product')->load('1'); //product Id with custom options

$option = Mage::getModel('catalog/product_option')->getProductOptionCollection($product);
foreach($option as $o){
 print_r($o->getData());   
}

and to get value Data that is Row 38 and 39 in your case do it like this

$products = Mage::getModel('catalog/product')->load('1'); //product Id with custom options

$option = Mage::getModel('catalog/product_option')->getProductOptionCollection($product);
foreach ($option as $o) {
  print_r($o->getData());      
  $values = Mage::getSingleton('catalog/product_option_value')->getValuesCollection($o);
  foreach($values as $value){
    print_r($value->getData());
  }
}

and you will have it all.

1

You ca get the details by Mage::getModel('catalog/product_option_value') Please use this

$productOptionValue = Mage::getModel('catalog/product_option_value')->load($valueId);

$valueId=38;

Also for getting option value using option id,use

$collection = Mage::getResourceModel('catalog/product_option_value_collection')
            ->addFieldToFilter('option_id', $optionId)
            ->getValues($CurrentStoreId);

get Value ids by Option

$collection = Mage::getResourceModel('catalog/product_option_value_collection')
            ->addFieldToFilter('option_id', $option_id)
            ->getValuesByOption($optionIds, $store_id);
3
  • 38 and 39 only as an example
    – Ratio
    Commented Feb 11, 2015 at 12:41
  • i cannot understand what you want?
    – Amit Bera
    Commented Feb 11, 2015 at 12:44
  • getValues in this option. Snx.
    – Ratio
    Commented Feb 11, 2015 at 12:54
0

Resolved

foreach ($_product->getOptions() as $option) {
    $option->getValues()
}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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