通过magento中的模型进行迭代 [英] Iterating through a model in magento
本文介绍了通过magento中的模型进行迭代的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法使用以下功能:
Mage::getModel('sales/order');
我尝试过,但是没有返回结果:
I attempted this, however it returned no results:
$res=Mage::getModel('sales/order');
$orderId=$res->getOrderId();
echo '<pre>';
print_r($orderId);
推荐答案
我猜res
的意思是资源,所以我将进行逻辑上的飞跃,并假设您的意思是查询资源集合.
I guess by res
you mean resource so I'll make a leap of logic and assume you mean to query a resource collection.
echo '<pre>';
$resource = Mage::getModel('sales/order')->getCollection();
foreach ($resource as $order) {
echo $order->getId(), "\n";
}
echo '</pre>';
这篇关于通过magento中的模型进行迭代的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文