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中根据用户的id获取用户的所有订单以及每个订单中的物品 以及物品的相关属性
- magento 根据产品id,获取产品信息
- Magento 根据SKU查询订单信息的SQL语句
- 根据查询的关键字,实现获取百度指定页数的搜索结果的信息(网页地址,标题,摘要,并有排序的说明)
- Ajax特效 根据邮政编码获取地区信息 之二
- 根据GPS获得的经纬度来获取地理位置信息
- 在订单成功页面获取相应的产品信息
- 根据IP获取地址信息的方法(无数据库版)
- 根据新浪微博DEMO,从中取出Oauth认证和简单的获取信息
- 获取所有用户表及根据表Id取得表字段信息
- SharePoint WebService——根据群组名称获取成员信息
- 根据错误码获取错误信息
- Ajax特效 根据邮政编码获取地区信息 之四
- 根据某个部门ID递归获取其下面所有子部门和本部门信息
- 根据订单规则获取订单下一状态功能(B4200410)原理
- SharePoint WebService——根据群组名称获取成员信息
- Ajax特效 根据邮政编码获取地区信息 之三
- 在.NET中根据SQL Server系统表获取数据库管理信息
- 调用豆瓣的接口根据ISBN获取书籍信息
- 如何获取尚未开票信息(包括交货单、销售订单)