Just another WordPress.com weblog

Archive for October, 2010

Magento :: Create Order Attribute.

If you want in create Order Attribute in Magento 1.4.* ..
Here is the code ..

Run this code once

$installer = Mage::getModel('eav/entity_setup');
$installer->startSetup();
$installer->addAttribute(ORDER TYPE ID, 'YOUR ATTRIBUTE NAME', array('type' => 'int'));
$installer->endSetup();

if you want to find Order_type_id for you site
look in eav_entity_type table .. you can find order_type_id..

AFTER THIS..
add a filed in sales_flat_order table …

now save the value ….
Keep Rocking …
Vishal Surani —

Advertisements

Fatal error: Call to a member function toOptionArray() on a non-object

Fatal error: Call to a member function toOptionArray() on a non-object in /home/mystore/public_html/app/code/core/Mage/Adminhtml/Block/System/Config/Form.php on line 284

To solve the above error. Please open the above path file.

if ($e->source_model) {
$sourceModel = Mage::getSingleton((string)$e->source_model);
if ($sourceModel instanceof Varien_Object) {
$sourceModel->setPath($path);
}
$field->setValues($sourceModel->toOptionArray($fieldType == 'multiselect'));
}

Replace above code with below:

if ($e->source_model) {
$sourceModel = Mage::getSingleton((string)$e->source_model);
if ($sourceModel instanceof Varien_Object) {
$sourceModel->setPath($path);
}
if(is_object($sourceModel)){
$field->setValues($sourceModel->toOptionArray($fieldType == 'multiselect'));
} else {
Mage::log($e->source_model);
}
}

Thanks,
-Bijal Bhavsar 🙂