magento2 如何查询当前已支付的最后一个订单的订单id 或说流水号?
//建议改成__construct注入的方式 $objectManager = MagentoFrameworkAppObjectManager::getInstance(); $lastItem = $objectManager->get('MagentoSalesModelOrder') ->getCollection() ->addFieldToFilter('customer_id',$customerId) //用于筛选客户,$customerId是客户id,若果不需要筛选客户的话可以去掉这一行 ->setOrder('entity_id','DESC') ->setPageSize(1);