Magento

eCommerce Software for Online Growth

Magento Forum

From setting up your store to managing your products, pages and promotions to generating detailed reports, the Magento User Guide empowers the user to utilize the platform for all of its vast capacity.
Available in eBook and Print formats – Download Now!!!
   
custom-fields with help of Mage::getModel(’sales/order’)
 
Jeena Paradies
Jr. Member
 
Avatar
Total Posts:  20
Joined:  2008-03-10
 

How can I get my custom-fields with help of Mage::getModel(’sales/order’)?

<?php
// I get my custom oldcustomerid within /template/customer/widget/name.html with this line
$this->getObject()->getOldcustomerid()

// I would like to get it here too, like ->getName() and so on but It does not work, I just get NULL
Mage::getModel('sales/order')
    ->
getCollection()
    ->
addAttributeToSelect('increment_id')
    ->
addAttributeToFilter("state"Mage_Sales_Model_Order::STATE_NEW)
    ->
load()
    ->
getItems()[0]
    
->getBillingAddress()
    ->
getOldcustomerid();

 
Magento Community Magento Community
Magento Community
Magento Community
 
Jeena Paradies
Jr. Member
 
Avatar
Total Posts:  20
Joined:  2008-03-10
 

Perhaps some more information, I do have a custom field for each customer which I call oldcustomerid, it works within the frontend and within the admin center.

I also have a export script which uses Mage::getModel(’sales/order’) to get all orders and uses Magentos internal methods to build a custom XML file which I use to export the order-data to an other system. I got all I need from the Mage::getModel(’sales/order’) but my custom oldcustomerid. I try to figure out how I can get this oldcustomerid which is attached to a custommer from the sales/order model and hope for some help.

/Jeena

 
Magento Community Magento Community
Magento Community
Magento Community
 
Jeena Paradies
Jr. Member
 
Avatar
Total Posts:  20
Joined:  2008-03-10
 

I need the customer email-address too, it is also saved with the customer data.

 
Magento Community Magento Community
Magento Community
Magento Community
 
joyously
Guru
 
Total Posts:  447
Joined:  2008-08-21
 

Seems like you would have to add the code to handle the added fields on output, just like you added it for input.
What are you using to get the data in there? (I need to add some data.)

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mukesh Chapagain
Member
 
Avatar
Total Posts:  56
Joined:  2009-07-19
 

http://www.magentocommerce.com/boards/viewthread/42862/

This thread might help.. see #4

Good Luck.

 Signature 

Blog: http://blog.chapagain.com.np ~ Lots of Magento Tips and Tutorials
Twitter: @chapagain

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
 
© Copyright 2010 Varien. Magento, eCommerce software, is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
177697 users|1199 users currently online|277262 forum posts