您的位置:首页 > 其它

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

2014-09-05 15:03 267 查看

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)
┊喜欢打印举报

已投稿到:

排行榜
前一篇:magento创建每日特惠页面
后一篇:Magento 常用方法
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: