I have an order attribute set by a community extension that works fine in admin but I need to use it from frontend too but I don't get it, I think is because is set like this in mysql4-install-0.3.0.php

$this->addAttribute('order', 'atribute_name', array(
    'type'          => 'varchar',
    'label'         => 'Atribute Label',
    'visible'       => false,
    'required'      => false,
    'visible_on_front' => false,
    'user_defined'  =>  false

How do I update it? I tried adding a update mysql 0.4.0 script and update the version without luck, also is there any other reason I get it empty from frontend.

  • Can you paste your config.xml and the update script? – Joe Constant Sep 2 '15 at 1:11
  • on the update script I just copy/paste the install script with visible_on_front true, as per config I just bumped the version – John Sep 2 '15 at 1:29
  • Did you mean product attribute in your question? – Joe Constant Sep 2 '15 at 1:33
  • No, I updated to code – John Sep 2 '15 at 1:50

Order attributes don't have an is_visible or is_visible_on_front setting. Those are exclusive to products. To make a particular order attribute appear on the frontend, you have to modify the appropriate template (after copying it to your theme, don't modify default/base) to expose that attribute.

  • Just that $order->getAttributeName Works fine on phpunit or admin but can't get it from logged in frontend user, I need it inside an event. – John Sep 2 '15 at 2:03
  • Perhaps the collection is loading only specific attributes then. You would need to modify that collection to call addFieldToSelect("attribute_code") – Joe Constant Sep 2 '15 at 2:07
  • is a new order event, has nothing to do with collections, products – John Sep 2 '15 at 2:25
  • Can you update your question with some more context on what you are trying to do (along with some code) – Joe Constant Sep 2 '15 at 2:27

From Magento 1.4,Mage_Sales Module has been convert to Flat structure from Eav Structure.So if you was failed to update sales order field.

Even you will try using updateAttribute()

For this case, you need to use basic mysql Alter query for update any field of sales Module at Database

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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