magento根据订单号来获取订单信息

magento根据订单号来获取订单信息

(2012-05-03 17:37:00)
标签:

it

分类:magento

第一步:require_once(“/var/www/dressesonlinesalecouk/app/Mage.php”);先引用

$app =Mage::app(‘default’);

$orders =Mage::getModel(‘sales/order’)->getCollection();

$orders->addAttributeToFilter(‘increment_id’,$incrementID); //其中 $incrementID为订单号

$orders->addAttributeToSelect(‘*’);

$orders->load();

$alldata =$orders->getData();

$sales_order =Mage::getModel(‘sales/order’)->load($alldata[0]['entity_id']);

$billingAddress=$sales_order->getBillingAddress();

$Email=$sales_order->getData(‘customer_email’);//客户的邮件

foreach($sales_order->getAllItems() as $item) {

$option =$item->getProductOptions();

$qty=  $item->getQtyOrdered();

if(count($option)>1){

if($version ==’1.2.1.1′&&isset($option['attributes_info'][0]['value'])){

$size =$option['attributes_info'][0]['value'];

}

else{

$size =$option['options'][0]['value'];

}

}else{

$size = “”;

}

循环输出产品信息,,用print_r($option)来打印所有的option属性

 

$item->getName()//获取订单产品名

$option =$item->getProductOptions(); //获取option属性

$qty=  $item->getQtyOrdered(); //获取订单产品数量

$item->getPrice();//获取订单金额

$item->getRowTotal();//获取total

$item->getSku()获得sku

下面是客户的各种信息

$FirstName=$billingAddress->getFirstname();
$LastName=$billingAddress->getLastname();
$Email=$sales_order->getData(‘customer_email’);

$Phone=$billingAddress->getTelephone();
$ZipCode=$billingAddress->getPostcode();
$company=$billingAddress->getCompany();
$Address=$billingAddress->getStreetFull();
$City=$billingAddress->getCity();
$State=$billingAddress->getRegion();
$Country=$billingAddress->getCountry();
$adress_info .=$Email.”~”.$FirstName.”~”.$LastName.”~”.$company.”~”.$Address.”~”.$City.”~”.$State.”~”.$ZipCode.”~”.$Country.”~”.$Phone.”~”;
echo $adress_info;

0

0

阅读 (622) 评论 (0) 收藏 (0) 转载 (3) 喜欢 打印 举报
已投稿到:
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值