Reply to comment

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?

Reply

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <apache>, <bash>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <perl>, <php>, <python>, <ruby>, <xml>. The supported tag styles are: <foo>, [foo].

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.