$product_id = 25;
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$configProduct = $objectManager->create('Magento\Catalog\Model\Product')->load($product_id);
foreach ($configProduct->getOptions() as $options)
{
$optionData = $options->getValues();
$parent_title = $options->getTitle();
$parent_id = $options->getId();
$parent[$parent_id] = $options->getTitle();
foreach ($optionData as $data) {
/* echo '<pre>';
print_r($data->getData());
echo '</pre>'; */
$optionPrice [ $data['option_id'] ][ $data['title'] ] = $data->getPrice();
$optionid [ $data['option_id'] ][ $data['title'] ] = $data['option_type_id'];
}
}
$optionPricemyJSON = json_encode( $optionPrice );
In system.xml file field for multi select of category is like: NOTE: Use Select for Single item and multiselect for multiple in - <field id = "bannerlist" translate = "label" type = " multiselect " <group id = "bannerblock_setting" translate = "label" type = "text" delault = "1" sortOrder = "3" showInDefault = "1" showInWebsite = "1" showInStore = "1" > <label> Setting </label> <field id = "bannerlist" translate = "label" type = "multiselect" sortOrder = "10" showInDefault = "1" showInWebsite = "1" showInStore = "1" > <label> Select Category </label> <!-- <source_model>Magento\Config\Model\Config\Source\Yesno</source_model>--> <source_model> Ipragmatech\Bannerblock\Model\Config\Source\C...
Comments
Post a Comment