dkpatt
dkpatt

Reputation: 580

Retrieve the UPS Account number of a customer in Magento API

In Magento, a customer can associate an UPS Account # with their account allowing them to ship and pay for their shipments with their personal UPS account number.

I'm in need of retrieving that on an order or customer basis via the Magento API (V2). Does anyone know if that is data that can be pulled via the V2 API? I'm trying to avoid hitting the Magento DB directly.

Thanks

Upvotes: 0

Views: 1156

Answers (1)

Max
Max

Reputation: 8836

That information is in a System Config (Mage::getStoreConfig()). I don't think the API gives you access to system configurations, you're going to have to get them using code:

$userid      = Mage::getStoreConfig('carriers/ups/username');
$userid_pass = Mage::getStoreConfig('carriers/ups/password');
$access_key  = Mage::getStoreConfig('carriers/ups/access_license_number');

Good luck.

EDIT based on comment:

So if you have the Customer object ($customer = Mage::getModel('customer/customer')->load($customerId); you can do $customer->getShippingAccount(); (or whatever the attribute is called). You don't want to be querying the varchar table directly. If you're looping through customers you would do

Mage::getModel('customer/customer')->getCollection()
    ->addAttributeToSelect('shipping_account')
    ;

Upvotes: 1

Related Questions