文档章节

Get last order or items of customer in magento

2007lf
 2007lf
发布于 2015/02/12 15:33
字数 57
阅读 11
收藏 0
$_customer = Mage::getSingleton('customer/session')->getCustomer();
$orders = Mage::getResourceModel('sales/order_collection')
    ->addFieldToSelect('*')
    ->addFieldToFilter('customer_id', $_customer->getId())
    ->addAttributeToSort('created_at', 'DESC')
    ->setPageSize(1);
$items = Mage::getModel('sales/order')->getCollection()
    ->addFieldToSelect('*')
    ->join(array('item' => 'sales/order_item'), 'main_table.entity_id = item.order_id')
    ->addFieldToFilter('customer_id', $_customer->getId())
    ->addAttributeToSort('item.created_at', 'DESC')
    ->setPageSize(1);
var_dump($items->getData());die();


© 著作权归作者所有

共有 人打赏支持
上一篇: magento 搜索
下一篇: js copy
2007lf
粉丝 8
博文 200
码字总数 43608
作品 0
合肥
程序员
私信 提问
Magento 企业版 1.8 发布

该版本新特性包括: Increase Conversion and Customer Retention with the new email marketing reminder modules Deliver even more Relevant Results to Improve the Customer-Browsing E......

红薯
2010/04/15
2.2K
2
Magento 2.0 Alipay Cross-Border Mobile Payment Extension - Magento 2.0 支付宝跨境支付手机版

Overview Accept payments in Magento 2 using the Alipay Cross-border Mobile Payment Gateway. Advanced & deeply integrated by Alipaymate.com (Certified Alipay Open Platform Develo......

Alipaymate
2015/12/27
143
0
Magento 1.9 Alipay Cross-border Website Payment Extension Vesion 6.0 Released - Support Repay

Overview Accept payments in Magento 1.6 ~ 1.9 using the Alipay Cross-border Website Payment Gateway. Advanced & deeply integrated by Alipaymate.com (Certified Alipay Open Platfo......

Alipaymate
2016/01/19
111
0
Magento 2.0 - Alipay Cross-Border Website Payment Extension

Overview Accept payments in Magento 2 using the Alipay Cross-border Website Payment Gateway. Advanced & deeply integrated by Alipaymate.com (Certified Alipay Open Platform Devel......

Alipaymate
2015/12/25
213
1
Magento Add Fee or Discount to Order Totals

In this tutorial, we will see how to add new line item to magento order totals. What this means is that, how to add an additional Fee or Discount, or any kind of charge to order......

2007lf
2015/08/27
0
0

没有更多内容

加载失败,请刷新页面

加载更多

Apache日志不记录访问静态文件,访问日志切割,静态元素过期时间设置

Apache配置不记录访问静态文件的日志 网站大多元素为静态文件,如图片、css、js等,这些元素可以不用记录 vhost原始配置 <VirtualHost *:80> ServerAdmin test@163.com DocumentRoo...

野雪球
今天
1
0
聊聊storm的ICommitterTridentSpout

序 本文主要研究一下storm的ICommitterTridentSpout ICommitterTridentSpout storm-core-1.2.2-sources.jar!/org/apache/storm/trident/spout/ICommitterTridentSpout.java public interface......

go4it
今天
2
0
Ubuntu常用操作

查看端口号 netstat -anp |grep 端口号 查看已使用端口情况 netstat -nultp(此处不用加端口号) netstat -anp |grep 82查看82端口的使用情况 查找被占用的端口: netstat -tln netstat -tl...

hc321
昨天
1
0
网站cdn的静态资源突然访问变的缓慢,问题排查流程

1.首先我查看了一下是否自己的网络问题,通过对比其他资源的访问速度和下载速度,确认不是 2.通过ping 和 tracert 判断cdn域名能否正常访问,(最后回想感觉这一步可以省略,因为每次最终能访...

小海bug
昨天
3
0
Mybatis 学习笔记四 MyBatis-Plus插件

Mybatis 学习笔记四 MyBatis-Plus插件 maven依赖 <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus</artifactId> <ve......

晨猫
昨天
6
0

没有更多内容

加载失败,请刷新页面

加载更多

返回顶部
顶部