使用sugarCRM 6.5+在自定义模块上启用全局搜索

时间:2013-11-11 23:42:18

标签: php sugarcrm

我一直在寻找,似乎无法找到解决方案。 我在灯堆上运行6.5.15 CE,我在模块构建器中创建了2个自定义模块,并在工作室中编辑它们。 客户和订单,订单模块显示为客户模块的子面板。我有全局搜索工作与客户模块,但不是订单模块。 首先,我尝试了一个示例,声明创建了以下页面/custom/Extension/modules/cb_orders/ext/Vardefs/customGlobalSearchFields.php但是没有用,所以我在自定义/ modules / cb_orders / EXT中添加了模块和字段名称/Vardefs/vardefs.php

<?php
// define custom fields to be included in the search algorithm!
$dictionary['cb_orders']['unified_search'] = true;
$dictionary['cb_orders']['unified_search_default_enabled'] = true;
// order number
$dictionary['cb_orders']['fields']['cb_order_number']['rname'] = 'cb_order_number';
$dictionary['cb_orders']['fields']['cb_order_number']['vname'] = 'LBL_CB_ORDER_NUMBER';
$dictionary['cb_orders']['fields']['cb_order_number']['type'] = 'TextField';
$dictionary['cb_orders']['fields']['cb_order_number']['dbType'] = 'varchar';
$dictionary['cb_orders']['fields']['cb_order_number']['table'] = 'cb_orders';
$dictionary['cb_orders']['fields']['cb_order_number']['unified_search_default_enabled'] = true;
//$dictionary['cb_orders']['unified_search'] = true;
// tracking number
$dictionary['cb_orders']['fields']['cb_shipping_tracking_number']['rname'] =    'cb_shipping_tracking_number';
$dictionary['cb_orders']['fields']['cb_shipping_tracking_number']['vname'] = 'LBL_CB_SHIPPING_TRACKING_NUMBER';
$dictionary['cb_orders']['fields']['cb_shipping_tracking_number']['type'] = 'TextField';
$dictionary['cb_orders']['fields']['cb_shipping_tracking_number']['dbType'] = 'varchar';
$dictionary['cb_orders']['fields']['cb_shipping_tracking_number']['table'] = 'cb_orders';
$dictionary['cb_orders']['fields']['cb_shipping_tracking_number']['unified_search_default_enabled'] = true;
//$dictionary['cb_orders']['unified_search'] = true;
// order description
$dictionary['cb_orders']['fields']['order_description']['rname'] = 'order_description';
$dictionary['cb_orders']['fields']['order_description']['vname'] = 'LBL_ORDER_DESCRIPTION';
$dictionary['cb_orders']['fields']['order_description']['type'] = 'TextField';
$dictionary['cb_orders']['fields']['order_description']['dbType'] = 'varchar';
$dictionary['cb_orders']['fields']['order_description']['table'] = 'cb_orders';
$dictionary['cb_orders']['fields']['order_description']['unified_search_default_enabled'] = true;
//$dictionary['cb_orders']['unified_search'] = true;
// shipping company used
$dictionary['cb_orders']['fields']['cb_orders_shipping_company']['rname'] = 'cb_orders_shipping_company';
$dictionary['cb_orders']['fields']['cb_orders_shipping_company']['vname'] = 'LBL_CB_ORDERS_SHIPPING_COMPANY';
$dictionary['cb_orders']['fields']['cb_orders_shipping_company']['type'] = 'TextField';
$dictionary['cb_orders']['fields']['cb_orders_shipping_company']['dbType'] = 'varchar';
$dictionary['cb_orders']['fields']['cb_orders_shipping_company']['table'] = 'cb_orders';
$dictionary['cb_orders']['fields']['cb_orders_shipping_company']['unified_search_default_enabled'] = true;
//$dictionary['cb_orders']['unified_search'] = true;
// which cart the order came from
$dictionary['cb_orders']['fields']['cb_referrer_c']['rname'] = 'cb_referrer_c';
$dictionary['cb_orders']['fields']['cb_referrer_c']['vname'] = 'LBL_CB_REFERRER';
$dictionary['cb_orders']['fields']['cb_referrer_c']['type'] = 'TextField';
$dictionary['cb_orders']['fields']['cb_referrer_c']['dbType'] = 'varchar';
$dictionary['cb_orders']['fields']['cb_referrer_c']['table'] = 'cb_orders';
$dictionary['cb_orders']['fields']['cb_referrer_c']['unified_search_default_enabled'] = true;
//$dictionary['cb_orders']['unified_search'] = true;
// date and time ordered
$dictionary['cb_orders']['fields']['date_time_ordered_c']['rname'] = 'date_time_ordered_c';
$dictionary['cb_orders']['fields']['date_time_ordered_c']['vname'] = 'LBL_DATE_TIME_ORDERED';
$dictionary['cb_orders']['fields']['date_time_ordered_c']['type'] = 'TextField';
$dictionary['cb_orders']['fields']['date_time_ordered_c']['dbType'] = 'varchar';
$dictionary['cb_orders']['fields']['date_time_ordered_c']['table'] = 'cb_orders_cstm';
$dictionary['cb_orders']['fields']['date_time_ordered_c']['unified_search_default_enabled'] = true;
//$dictionary['cb_orders']['unified_search'] = true;
// last four of social
$dictionary['cb_orders']['fields']['cb_lastfour_c']['rname'] = 'cb_lastfour_c';
$dictionary['cb_orders']['fields']['cb_lastfour_c']['vname'] = 'LBL_CB_LASTFOUR';
$dictionary['cb_orders']['fields']['cb_lastfour_c']['type'] = 'TextField';
$dictionary['cb_orders']['fields']['cb_lastfour_c']['dbType'] = 'varchar';
$dictionary['cb_orders']['fields']['cb_lastfour_c']['table'] = 'cb_orders_cstm';
$dictionary['cb_orders']['fields']['cb_lastfour_c']['unified_search_default_enabled'] = true;
//$dictionary['cb_orders']['unified_search'] = true;

文件和custom / modules / cb_orders / metadata / searchfields.php文件,如糖论坛上的示例所示。

$searchFields['cb_orders']['cb_order_number'] = array('query_type' => 'default');
$searchFields['cb_orders']['cb_shipping_tracking_number'] = array('query_type' => 'default');
$searchFields['cb_orders']['order_description'] = array('query_type' => 'default');
$searchFields['cb_orders']['cb_orders_shipping_company'] = array('query_type' => 'default');
$searchFields['cb_orders']['cb_referrer_c'] = array('query_type' => 'default');
$searchFields['cb_orders']['date_time_ordered_c'] = array('query_type' => 'default');

重建后,我似乎仍然无法搜索该模块。

这可能是因为一对多关系(一个客户到多个订单)造成的吗?

2 个答案:

答案 0 :(得分:2)

我不知道你有没有这个工作,但我注意到你有,作为你的道路

custom/modules/cb_orders/metadata/searchfields.php

什么时候应该

custom/modules/cb_orders/metadata/SearchFields.php

(SearchFields.php中的大写S和F)

至于第一条路径

custom/Extension/modules/cb_orders/ext/Vardefs/customGlobalSearchFields.php

您可以使用任何文件名,它不必是vardefs.php 检查

custom/modules/cb_orders/Ext/Vardefs/vardefs.ext.php 

文件以确认在修复和重建中捕获的添加内容,无论文件名是什么。

你有没有让这个工作而不需要admin -> Global Search -> Drag&Drop

答案 1 :(得分:1)

我还必须删除/cache/modules/unified_search_modules.php以使其正常工作。删除后,搜索后会再次生成。