取得Magento的所有发票 [英] Get all invoices in Magento

查看:58
本文介绍了取得Magento的所有发票的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何得到所有的发票收集?

How do I get all the invoices collection?

我知道,把所有的订单是:

I know that to get all the orders is:

 $orders = Mage::getModel(sales/order)->getCollection();

但是,我似乎找不到与发票相对应的发票(不是销售/发票).抱歉,这是一个愚蠢的问题.

However I can't seem to find the equivalent with invoice (it's not sales/invoice). Sorry if it's a dumb question.

推荐答案

您需要使用:

$orders = Mage::getModel("sales/order_invoice")->getCollection();

有关的解释:

当您要访问我块/模型/资源/帮手/等在Magento:

When you want to access i block/model/resource/helper/etc in magento :

  • 第一,您选择合适的方法来访问它:为一个模型

  • first, you choose the right method to access it : Mage::getModel for a model

第二,你必须告诉Magento的您要访问这"模块.这样做,随着参数串的第一部分:

second, you must tell magento "which" module you want to access. You do that with the first part of the parameter string :

Mage :: getModel("<​​strong>销售/order_invoice")

Mage::getModel("sales/order_invoice")

此字符串引用您要访问的类型或资源的XML节点.在你的情况下,用于访问Mage_Sales模块的模式:看看在Mage_Sales的config.xml,你会看到节点使用(用于模型和resourceModels):

This string refers to the XML node of the type or resource you want to access. In your case, for accessing a model of the Mage_Sales module : take a look at the Mage_Sales's config.xml, you'll see the node to use (used for models and resourceModels) :

[...]
<models>
    <sales><!-- <----- THIS NODE -->
        <class>Mage_Sales_Model</class>
         <resourceModel>sales_resource</resourceModel>
     </sales>
     [...]

  • 最后一部分,您需要添加对所需文件的完全访问权限,并在需要时添加文件夹.在你的情况下,在Mage_Sales模块的模型文件夹(以上XML配置告诉我们,这个文件夹是),你会看到一个文件中的文件夹:那么你的路径是order_invoice"并全面COMMANDE访问你的模型是:
  • 法师:: getModel( 销售/的 order_invoice ")

    这篇关于取得Magento的所有发票的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆