VTiger 6检索销售订单产品详细信息

时间:2014-05-29 03:33:58

标签: php vtiger

在为Vtiger 6(名为Dispatch)创建自定义模块后,我需要能够在每次下达销售订单时自动创建新的Dispatch记录。

我正在使用以下内容扩展SalesOrder_Record_Model(modules / SalesOrder / models / Record.php):

public function save() {

        parent::save();

        Dispatch::NewFromSalesOrder($this);//static method to create the Dispatch new record from the Sales Order

}

到目前为止一切顺利。 当我试图获取销售订单的详细产品信息时,问题就开始了。

来自我的Dispatch课程:

public static function NewFromSalesOrder($so) {

        $data = $so->getData();//gets the general data of the sales order, works fine!

        $products = $so->getProducts();//only gives me pricing and taxes, no product details

        //Also tried but same result 
        $products = getAssociatedProducts();//helper method from (include/utils/EditViewUtils.php)

}

因此,这两种方法只给我定价和税收信息,但没有实际的产品数据,如id / name / list price / comments,这实际上是我唯一需要的Dispatch模块。

在正确输入3个产品后,这是$sales_order->getProducts()的var_dump。

array(1) { [1]=> array(1) { ["final_details"]=> array(18) { ["taxtype"]=> NULL ["discount_type_final"]=> string(10) "percentage" ["hdnSubTotal"]=> string(4) "0.00" ["discount_percentage_final"]=> string(4) "0.00" ["discount_amount_final"]=> string(4) "0.00" ["checked_discount_percentage_final"]=> string(8) " checked" ["style_discount_percentage_final"]=> string(27) " style="visibility:visible"" ["style_discount_amount_final"]=> string(26) " style="visibility:hidden"" ["discountTotal_final"]=> string(4) "0.00" ["taxes"]=> array(3) { [0]=> array(4) { ["taxname"]=> string(4) "tax1" ["taxlabel"]=> string(3) "VAT" ["percentage"]=> string(5) "4.500" ["amount"]=> string(4) "0.00" } [1]=> array(4) { ["taxname"]=> string(4) "tax2" ["taxlabel"]=> string(5) "Sales" ["percentage"]=> string(6) "10.000" ["amount"]=> string(4) "0.00" } [2]=> array(4) { ["taxname"]=> string(4) "tax3" ["taxlabel"]=> string(7) "Service" ["percentage"]=> string(6) "12.500" ["amount"]=> string(4) "0.00" } } ["tax_totalamount"]=> float(0) ["shipping_handling_charge"]=> string(4) "0.00" ["sh_taxes"]=> array(3) { [0]=> array(4) { ["taxname"]=> string(6) "shtax1" ["taxlabel"]=> string(3) "VAT" ["percentage"]=> string(4) "0.00" ["amount"]=> float(0) } [1]=> array(4) { ["taxname"]=> string(6) "shtax2" ["taxlabel"]=> string(5) "Sales" ["percentage"]=> string(4) "0.00" ["amount"]=> float(0) } [2]=> array(4) { ["taxname"]=> string(6) "shtax3" ["taxlabel"]=> string(7) "Service" ["percentage"]=> string(4) "0.00" ["amount"]=> float(0) } } ["shtax_totalamount"]=> string(4) "0.00" ["adjustment"]=> string(4) "0.00" ["grandTotal"]=> string(4) "0.00" ["preTaxTotal"]=> string(4) "0.00" ["totalAfterDiscount"]=> string(4) "0.00" } } }

我错过了什么或者说错了方法吗?是否有其他方法可以检索产品详细信息?

非常感谢任何帮助。

谢谢!

PS我知道我可以直接查询数据库,但Vtiger作为开发人员(文档记录差,设计模式不好等)非常糟糕,即使没有我搞乱查询,所以我宁愿坚持自己的OOP方法

0 个答案:

没有答案