I had added a custom option Complete
in action dropdown(sales->orders). It's working fine and order status changes to complete successfully.
I am integrating all orders with Salesforce
. I have need of all of order details by orderid
. Item details and grand total is fetched successfully.
Can anyone please help to fetch Customer
name and his/her company name how submitted order. Below is my complete code to fetch order details:
$order = Mage::getModel('sales/order')->load($orderId);
$items = $order->getAllItems();
$_totalData = $order->getData();
$_grand = $_totalData['grand_total'];
$custname = $_totalData->getCustomerName();
$itemcount=count($items);
foreach ($items as $itemId => $item)
{
$sObject2->Item_name__c = $item->getName();
$sObject2->Unit_price__c = $item->getPrice();
$sObject2->Sku__c = $item->getSku();
$sObject2->Quantity__c = $item->getQtyToInvoice();
}
try this
$order->getCustomerName()
You probably don't need to cast $order->getData()
to a new variable. This will only serve to chew up memory, especially since there is only one element you need from that data, which can be retrieved with a less intensive method.
Instead, try it this way:
$order = Mage::getModel('sales/order')->load($orderId);
$_grand = $order->getGrandTotal();
$custname = $order->getCustomerName();
foreach ($order->getAllItems() as $itemId => $item)
{
// Do stuff
}
if $order->getCustomerName()
doesn't work for you, try:
$order->getBillingAddress()->getName();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With