0

I need to export order form magento with remote scripts.

When I work in local I use:

require_once("/app/Mage.php");

Mage::init();

// Set an Admin Session
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);

Mage::getSingleton('core/session', array('name' => 'adminhtml'));

$userModel = Mage::getModel('admin/user');
$userModel->setUserId(1);
$session = Mage::getSingleton('admin/session');
$session->setUser($userModel);
$session->setAcl(Mage::getResourceModel('admin/acl')->loadAcl());

$connection = Mage::getSingleton('core/resource')->getConnection('core_write');


// extract order

$collection = Mage::getModel('sales/order')
                            ->getCollection()
                            ->addAttributeToSelect('*');

foreach($collection as $order)
{
$billingStreet = $billingAddress->getStreet();
[...]
}

But if I want to connect from remote server?

I cannot find an example.

0

Instead of using some custom scripts like this, especially if you want to do it from remote server, I suggest you use the Magento SOAP API (or REST or XMLRpc depending on your needs).

Here's the API documentation for the Sales Order : http://devdocs.magento.com/guides/m1x/api/soap/sales/salesOrder/salesOrder.html

And here's the introduction to the API: http://devdocs.magento.com/guides/m1x/api/soap/introduction.html

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.