UPDATE `catalog_product_option` SET `is_require`=1
Getting the values for those options is difficult using sql queries so here's a bit of code to achieve that.
<?php require_once (str_replace('//','/',dirname(__FILE__).'/') .'../app/Mage.php'); umask(0); Mage::app('admin'); $collection = Mage::getModel('catalog/product')->getCollection()->load(); echo $collection->count(),"<b r/>"; foreach ($collection as $product) { echo "<b>",$product->getId(), " - ",$product->getSku(),"</b><b r/>"; $product->load(); $i = 1; echo "<pre>"; foreach ($product->getOptions() as $o) { echo "<strong>Custom Option:" . $i . "</strong><b r/>"; echo "Custom Option TYPE: " . $o->getType() . "<b r/>"; echo "Custom Option TITLE: " . $o->getTitle() . "<b r/>"; echo "Custom Option Required: " . $o->getIsRequire() . "<b r/>"; echo "Custom Option Values: <b r/>"; $values = $o->getValues(); foreach ($values as $v) { print_r($v->getData()); } $i++; echo "----------------------------------<b r/>"; } }
Thanks to Subesh Pokhrel
Due to some unknown black magic the br tags in the code snippets get interpreted and having no time to deal with it now I've just put a space between the b and the r
No comments:
Post a Comment