Hi there, really interested in this feature. But can't get it to work. I created a PHP file and put in the 2 codes:
<?php
$options = array(); $options[$sku] = array( 'title' => 'Cadeauverpakking?', 'type' => 'checkbox', 'is_require' => 1, 'sort_order' => 0, 'values' => array() );
foreach($options as $sku => $option) { $id = Mage::getModel('catalog/product')->getIdBySku($sku); $product = Mage::getModel('catalog/product')->load($id);
if(!$product->getOptionsReadonly()) { $product->setProductOptions(array($option)); $product->setCanSaveCustomOptions(true); $product->save(); } }
?>
------
But I get following error:
Fatal error: Class 'Mage' not found in /home/gift/....................
I put the .php in mydomain.com/hack/cpo.php
Could you help me out?
<code>
<blockcode>
<apache>
<bash>
<c>
<cpp>
<drupal5>
<drupal6>
<java>
<javascript>
<perl>
<php>
<python>
<ruby>
<xml>
<foo>
[foo]
More information about formatting options
Hi there, really interested in this feature. But can't get it to work. I created a PHP file and put in the 2 codes:
<?php
$options = array();
$options[$sku] = array(
'title' => 'Cadeauverpakking?',
'type' => 'checkbox',
'is_require' => 1,
'sort_order' => 0,
'values' => array()
);
foreach($options as $sku => $option) {
$id = Mage::getModel('catalog/product')->getIdBySku($sku);
$product = Mage::getModel('catalog/product')->load($id);
if(!$product->getOptionsReadonly()) {
$product->setProductOptions(array($option));
$product->setCanSaveCustomOptions(true);
$product->save();
}
}
?>
------
But I get following error:
Fatal error: Class 'Mage' not found in /home/gift/....................
I put the .php in mydomain.com/hack/cpo.php
Could you help me out?