当前位置: 动力学知识库 > 问答 > 编程问答 >

magento - Access custom order attributes

问题描述:

I have created three custom order attributes sales_person_name, sales_type, referral

I am trying to access them in a different module.

Can anyone tell me how do I access those order attributes in a different module

Do I have to call some model

I tried

$order = Mage::getModel('sales/order')->load($order);

and i got below output but cant get an data in it.

Mage_Sales_Model_Order Object

(

[_eventPrefix:protected] => sales_order

[_eventObject:protected] => order

[_addresses:protected] =>

[_items:protected] =>

[_payments:protected] =>

[_statusHistory:protected] =>

[_invoices:protected] =>

[_tracks:protected] =>

[_shipments:protected] =>

[_creditmemos:protected] =>

[_relatedObjects:protected] => Array

(

)

[_orderCurrency:protected] =>

[_baseCurrency:protected] =>

[_actionFlag:protected] => Array

(

)

[_canSendNewEmailFlag:protected] => 1

[_historyEntityName:protected] => order

[_resourceName:protected] => sales/order

[_resource:protected] =>

[_resourceCollectionName:protected] => sales/order_collection

[_cacheTag:protected] =>

[_dataSaveAllowed:protected] => 1

[_isObjectNew:protected] =>

[_data:protected] => Array

(

)

[_hasDataChanges:protected] =>

[_origData:protected] => Array

(

)

[_idFieldName:protected] =>

[_isDeleted:protected] =>

[_oldFieldsMap:protected] => Array

(

[payment_authorization_expiration] => payment_auth_expiration

[forced_do_shipment_with_invoice] => forced_shipment_with_invoice

[base_shipping_hidden_tax_amount] => base_shipping_hidden_tax_amnt

)

[_syncFieldsMap:protected] => Array

(

[payment_authorization_expiration] => payment_auth_expiration

[forced_do_shipment_with_invoice] => forced_shipment_with_invoice

[base_shipping_hidden_tax_amount] => base_shipping_hidden_tax_amnt

[payment_auth_expiration] => payment_authorization_expiration

[forced_shipment_with_invoice] => forced_do_shipment_with_invoice

[base_shipping_hidden_tax_amnt] => base_shipping_hidden_tax_amount

)

)

I created order attributes as follows

<?php

$installer = $this;

$installer->startSetup();

$installer->addAttribute("order", "sales_person_name", array("type"=>"varchar"));

$installer->addAttribute("order", "sales_type", array("type"=>"varchar"));

$installer->addAttribute("order", "referral", array("type"=>"varchar"));

$installer->addAttribute("quote", "sales_person_name", array("type"=>"varchar"));

$installer->addAttribute("quote", "sales_type", array("type"=>"varchar"));

$installer->addAttribute("quote", "referral", array("type"=>"varchar"));

$installer->endSetup();

I am trying to access the order attributes in the below file

C:\xampp\htdocs\practice1\app\code\core\Mage\Adminhtml\Block\Widget\Grid.php

分享给朋友:
您可能感兴趣的文章:
随机阅读: