[Vtigercrm-developers] getting a list of products

Hamono, Chris (DPC) Chris.Hamono at sa.gov.au
Wed Mar 19 05:10:17 GMT 2014


Hi

My module acts as a webservice amongst other tasks. It is designed to integrate with both drupal and moodle.

I had wondered if it was an authentication issue. While testing I have not made any attempts to authenticate.

The module needs to remotely manage contact creation, product listing and account listing, preferably filtered on the custom fields also it must do a few other functions like be run as cronjob to do  housekeeping and uses an event to push some details to another website when an account is paid or a new product is created.

Therefore it makes sense to create a separate module rather than just use webservices. Unfortunately the api is very opaque to the new user many includes are called as required rather than in the head of the file making it even more obtuse. But of course that's a worthy trade off for efficiency.

Working out which functions to call and which files to include is a pain.


Chris


From: vtigercrm-developers-bounces at lists.vtigercrm.com [mailto:vtigercrm-developers-bounces at lists.vtigercrm.com] On Behalf Of Uma S
Sent: Tuesday, 18 March 2014 6:29 PM
To: vtigercrm-developers at lists.vtigercrm.com
Subject: Re: [Vtigercrm-developers] getting a list of products

Hi Chirs,

I need a bit of clarification on your request. Are you trying to get list-view records within crm? or from outside external script?. If its from external script that's not possible because, while getting records we are looking for user privileges which is not available outside crm.

On Tue, Mar 18, 2014 at 9:05 AM, Hamono, Chris (DPC) <Chris.Hamono at sa.gov.au<mailto:Chris.Hamono at sa.gov.au>> wrote:
Hi Uma

Thank you for this.
Can you tell me what files I need to include to create the listview

I have tried including the following..
require_once('include/utils/CommonUtils.php');
require_once('include/utils/ListViewUtils.php');
require_once('modules/Vtiger/models/ListView.php'); <== script quits here with no errors

$listViewModel = Vtiger_ListView_Model::getInstance('Products', 47); //&viewname=47

Is there some documentation on what files I need to include?

The module acts as a simple webservice so I will want to authenticate against a user with limited roles. So how do I do authentication?

Chris


From: vtigercrm-developers-bounces at lists.vtigercrm.com<mailto:vtigercrm-developers-bounces at lists.vtigercrm.com> [mailto:vtigercrm-developers-bounces at lists.vtigercrm.com<mailto:vtigercrm-developers-bounces at lists.vtigercrm.com>] On Behalf Of Uma S
Sent: Monday, 17 March 2014 4:06 PM
To: vtigercrm-developers at lists.vtigercrm.com<mailto:vtigercrm-developers at lists.vtigercrm.com>
Subject: Re: [Vtigercrm-developers] getting a list of products

Hi Chris,

Their is a way to achieve your requirement.

 1.  Please create a filter with all custom-fields that you would like get in list-view.
 2.  Now create a list-view model of a module (products), by passing moduleName and filter-id.
 3.  Then on this list-view model you can call getListViewEntries() api to get entries of list-view with all custom fields.
Regards
Uma S
Vtiger Team

On Mon, Mar 17, 2014 at 4:32 AM, Hamono, Chris (DPC) <Chris.Hamono at sa.gov.au<mailto:Chris.Hamono at sa.gov.au>> wrote:
In answer to my own question.

I don't know what the official ways is to get  a list including custom fields but this is what I have discovered...

When a custom field is made it adds a new column to the table vtiger_ Modulenamecf in my case vtiger_ productcf. The field name is something along the lines of cf_### where ### = some number, for me this was cf_716.

This is recorded in the vtiger_fields  table, the important fields for my purpose are "column name" "tablename" and "fieldlabel" these contain the information required to map the mysterious cf_### column name to the custom field.

I assume there is a method that will do all of this for you but as far as I can find to get a list of products I will have to find all the custom fields using vtiger_fields manually build a sql statement to include those fields and then run that query.


Chris



From: vtigercrm-developers-bounces at lists.vtigercrm.com<mailto:vtigercrm-developers-bounces at lists.vtigercrm.com> [mailto:vtigercrm-developers-bounces at lists.vtigercrm.com<mailto:vtigercrm-developers-bounces at lists.vtigercrm.com>] On Behalf Of Hamono, Chris (DPC)
Sent: Friday, 14 March 2014 11:26 AM
To: vtigercrm-developers at lists.vtigercrm.com<mailto:vtigercrm-developers at lists.vtigercrm.com>
Subject: [Vtigercrm-developers] getting a list of products

Hi All

I am hoping someone can help me

I am developing a module to integrate vtiger with drupal for a bespoke system. I have a need to get a list of products complete with custom fields. I also need to filter this list by range (limit) and by product type

What is the recommended way to query a module for a list. I have tried to look through the source code but its very obtuse and haven't yet found what I need.

Any assistance would be appreciated

Chris




_______________________________________________
http://www.vtiger.com/



--
With
Best Regards
Uma.S
Vtiger Team

_______________________________________________
http://www.vtiger.com/



--
With
Best Regards
Uma.S
Vtiger Team
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.vtigercrm.com/pipermail/vtigercrm-developers/attachments/20140319/c9092de4/attachment-0001.html>


More information about the vtigercrm-developers mailing list