I have created a custom tab in Magento but while saving the product data is not reflected in database.
I have created below from with input field.
<div class="input-field">
<label for="custom_field">Custom Field</label>
<input class="input-text" name="custom_field" id="custom_field" />
</div>
I have wrote below code in Observer.
public function saveProductTabData(Varien_Event_Observer $observer)
{
if (!self::$_singletonFlag) {
self::$_singletonFlag = true;
$product = $observer->getEvent()->getProduct();
try {
$customFieldValue = $this->_getRequest()->getPost('custom_field');
$product->setNewAttribute($customFieldValue);
#$product->custom_field = $customFieldValue;
$product->save();
}
catch (Exception $e) {
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
}
}
}
I have followed all steps of this site https://fishpig.co.uk/magento/tutorials/custom-tabs-magento-product-admin/