[Vtigercrm-developers] Access quote lineitems from custom module

Alan Lord alanslists at gmail.com
Thu Feb 5 16:43:12 GMT 2015


On 05/02/15 15:23, lajeesh k wrote:
> Use getAssociatedProducts function  in include/utils/EditViewUtils.php
>
> $focus = CRMEntity::getInstance($module);
> $focus->id = $recordId;
> $related_products= getAssociatedProducts($module,$focus);

Why?

This is old code. Surely it is better and more "correct" now to use the 
MVC pattern and use the Record model.

In a Quote the Record model extends the Inventory Record model which 
extends the Vtiger Record Model. In the Inventory Record model are all 
the APIs required to retrieve the data in the correct format and with 
the correct permissions.

$recordModel = Vtiger_Record_Model::getInstanceById(crmid, 'Quotes');
$lineItems = $recordModel->getProducts();

HTH

Al




More information about the vtigercrm-developers mailing list