0

I need to add additional information for Magento attribute set, like when i add custom attribute for invoice like this:

Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));
$installer = new Mage_Sales_Model_Mysql4_Setup;

$attribute  = array(
    'type'          => 'datetime',
    'backend_type'  => 'datetime',
    'frontend_input' => 'datetime',
    'is_user_defined' => true,
    'label'         => 'Last Sync',
    'visible'       => true,
    'required'      => false,
    'user_defined'  => false,
    'searchable'    => true,
    'filterable'    => true,
    'comparable'    => true,
    'default'       => NULL
);
$installer->addAttribute('invoice', 'last_sync', $attribute); 

$installer->endSetup();

so i can load the data like this:

$attributeSetCollection = Mage::getResourceModel('eav/entity_attribute_set_collection');
foreach ($attributeSetCollection as $id=>$attributeSet) { 
    $lastSync = $attributeSet->getLastSync();
}

1 Answer 1

0

I think you're trying to say that you want to load a custom attribute from an invoice to get it's value. The example you have going on is not what you're looking for, if that's the case.

$invoice = Mage::getModel('sales/invoice')->load( .. );
$invoice->getLastSync(); // this will retrieve the new invoice attribute value for the invoice

If this is not what you're looking for please clarify your question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.