<div dir="ltr">Hi,<div><br></div><div>Performing the above explained code of translating alphabets of list-view search to chinese characters is too hard.</div><div><br></div><div>This list-view search is been handled through List.php of module, by passing parameter search_value as alphabet that has been selected in list-view.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 1, 2015 at 12:59 PM, sunny <span dir="ltr"><<a href="mailto:1250572980@qq.com" target="_blank">1250572980@qq.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>because chinese use hieroglyphic,for example '李' ,which can spell 'Li','陈' spell 'chen',chinese use character </div><div>GBK,not utf-8,here have a code get the first <span style="background-color:rgb(250,250,250);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace;font-size:12px;line-height:18px">getFirstCharter,</span></div><div><span style="background-color:rgb(250,250,250);font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace;font-size:12px;line-height:18px"><div> /**</div><div> * 取汉字的第一个字的首字母</div><div> * @param type $str</div><div> * @return string|null</div><div> */</div><div> public function _getFirstCharter($str){</div><div><span style="white-space:pre-wrap"> </span>if(empty($str)){return '';}</div><div><span style="white-space:pre-wrap"> </span>$fchar=ord($str{0});</div><div><span style="white-space:pre-wrap"> </span>if($fchar>=ord('A')&&$fchar<=ord('z')) return strtoupper($str{0});</div><div><span style="white-space:pre-wrap"> </span>$s1=iconv('UTF-8','gb2312',$str);</div><div><span style="white-space:pre-wrap"> </span>$s2=iconv('gb2312','UTF-8',$s1);</div><div><span style="white-space:pre-wrap"> </span>$s=$s2==$str?$s1:$str;</div><div><span style="white-space:pre-wrap"> </span>$asc=ord($s{0})*256+ord($s{1})-65536;</div><div><span style="white-space:pre-wrap"> </span>if($asc>=-20319&&$asc<=-20284) return 'A';</div><div><span style="white-space:pre-wrap"> </span>if($asc>=-20283&&$asc<=-19776) return 'B';</div><div><span style="white-space:pre-wrap"> </span>if($asc>=-19775&&$asc<=-19219) return 'C';</div><div><span style="white-space:pre-wrap"> </span>if($asc>=-19218&&$asc<=-18711) return 'D';</div><div><span style="white-space:pre-wrap"> </span>if($asc>=-18710&&$asc<=-18527) return 'E';</div><div><span style="white-space:pre-wrap"> </span>if($asc>=-18526&&$asc<=-18240) return 'F';</div><div><span style="white-space:pre-wrap"> </span>if($asc>=-18239&&$asc<=-17923) return 'G';</div><div><span style="white-space:pre-wrap"> </span>if($asc>=-17922&&$asc<=-17418) return 'H';</div><div><span style="white-space:pre-wrap"> </span>if($asc>=-17417&&$asc<=-16475) return 'J';</div><div><span style="white-space:pre-wrap"> </span>if($asc>=-16474&&$asc<=-16213) return 'K';</div><div><span style="white-space:pre-wrap"> </span>if($asc>=-16212&&$asc<=-15641) return 'L';</div><div><span style="white-space:pre-wrap"> </span>if($asc>=-15640&&$asc<=-15166) return 'M';</div><div><span style="white-space:pre-wrap"> </span>if($asc>=-15165&&$asc<=-14923) return 'N';</div><div><span style="white-space:pre-wrap"> </span>if($asc>=-14922&&$asc<=-14915) return 'O';</div><div><span style="white-space:pre-wrap"> </span>if($asc>=-14914&&$asc<=-14631) return 'P';</div><div><span style="white-space:pre-wrap"> </span>if($asc>=-14630&&$asc<=-14150) return 'Q';</div><div><span style="white-space:pre-wrap"> </span>if($asc>=-14149&&$asc<=-14091) return 'R';</div><div><span style="white-space:pre-wrap"> </span>if($asc>=-14090&&$asc<=-13319) return 'S';</div><div><span style="white-space:pre-wrap"> </span>if($asc>=-13318&&$asc<=-12839) return 'T';</div><div><span style="white-space:pre-wrap"> </span>if($asc>=-12838&&$asc<=-12557) return 'W';</div><div><span style="white-space:pre-wrap"> </span>if($asc>=-12556&&$asc<=-11848) return 'X';</div><div><span style="white-space:pre-wrap"> </span>if($asc>=-11847&&$asc<=-11056) return 'Y';</div><div><span style="white-space:pre-wrap"> </span>if($asc>=-11055&&$asc<=-10247) return 'Z';</div><div><span style="white-space:pre-wrap"> </span>return null;</div><div> }</div><div><br></div><div>and how to use</div><div><br></div><div><div> //门店名称</div><div> $shopData = $this->_shopNamesArray; </div><div> </div><div> //根据门店名称第一个汉字的首字母正序排序</div><div> $settles = $result['data'];</div><div> </div><div> $settlesRes = array();</div><div> foreach ($settles as $sett) {</div><div> $sname = $shopData[$sett['sid']];</div><div> $sett['sname'] = $sname; </div><div> $snameFirstChar = $this->_getFirstCharter($sname); //取出门店的第一个汉字的首字母</div><div> $settlesRes[$snameFirstChar] = $sett;//以这个首字母作为key</div><div> } </div><div> ksort($settlesRes); //对数据进行ksort排序,以key的值升序排序</div><div> </div></div></span></div><div><div>_shopNamesArray</div><div><br></div><div><div>Array</div><div>(</div><div> [0] => Array</div><div> (</div><div> [sid] => 2885842</div><div> [recetcstoredpay] => 24000</div><div> [recetclprinciple] => 23465</div><div> [paytcstoredpay] => 5455</div><div> [paytclprinciple] => 34900</div><div> [sname] => 百宴餐饮---便宜坊烤鸭店</div><div> )</div><div><br></div><div> [1] => Array</div><div> (</div><div> [sid] => 3644191</div><div> [recetcstoredpay] => 89200</div><div> [recetclprinciple] => 406930</div><div> [paytcstoredpay] => 4090</div><div> [paytclprinciple] => 97800</div><div> [sname] => 大长秋餐饮中心</div><div> )</div><div><br></div><div> [2] => Array</div><div> (</div><div> [sid] => 5229673</div><div> [recetcstoredpay] => 26000</div><div> [recetclprinciple] => 45930</div><div> [paytcstoredpay] => 24795</div><div> [paytclprinciple] => 121800</div><div> [sname] => 大众点评网</div><div> )</div><div><br></div><div> [3] => Array</div><div> (</div><div> [sid] => 3715927</div><div> [recetcstoredpay] => 13600</div><div> [recetclprinciple] => 56930</div><div> [paytcstoredpay] => 5710</div><div> [paytclprinciple] => 37800</div><div> [sname] => 江东北路店</div><div> )</div><div><br></div><div> [4] => Array</div><div> (</div><div> [sid] => 3671092</div><div> [recetcstoredpay] => 1280</div><div> [recetclprinciple] => 46930</div><div> [paytcstoredpay] => 128090</div><div> [paytclprinciple] => 149800</div><div> [sname] => 金凤区新馆</div><div> )</div><div><br></div><div> [5] => Array</div><div> (</div><div> [sid] => 1858783</div><div> [recetcstoredpay] => 2040</div><div> [recetclprinciple] => 4465</div><div> [paytcstoredpay] => 245</div><div> [paytclprinciple] => 4900</div><div> [sname] => 浙江西子宾馆</div><div> )</div><div><br></div><div> [6] => Array</div><div> (</div><div> [sid] => 16832117</div><div> [recetcstoredpay] => 81600</div><div> [recetclprinciple] => 470930</div><div> [paytcstoredpay] => 506090</div><div> [paytclprinciple] => 8000</div><div> [sname] => 欢乐谷店</div><div> )</div><div><br></div><div>)</div></div><div><br></div><div><br></div><div style="font-size:12px;font-family:Arial Narrow;padding:2px 0 2px 0">------------------ 原始邮件 ------------------</div><div style="font-size:12px;background:#efefef;padding:8px"><div><b>发件人:</b> "Uma S";<<a href="mailto:uma.s@vtiger.com" target="_blank">uma.s@vtiger.com</a>>;</div><div><b>发送时间:</b> 2015年6月1日(星期一) 中午1:21</div><div><b>收件人:</b> "vtigercrm-developers"<<a href="mailto:vtigercrm-developers@lists.vtigercrm.com" target="_blank">vtigercrm-developers@lists.vtigercrm.com</a>>; </div><div></div><div><b>主题:</b> Re: [Vtigercrm-developers] How to support the chinese sort</div></div><div><div class="h5"><div><br></div><div dir="ltr">Hi,<div><br></div><div>Sorting in list-view should work irrespective of language translations right? Can you please let us know what's the issue you are facing with chinese characters?</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 1, 2015 at 7:55 AM, sunny <span dir="ltr"><<a href="mailto:1250572980@qq.com" target="_blank">1250572980@qq.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><br></div><div>We want to support the chinese sort in the list view,following:</div><div>when click the red Letter,the CRM system can sort by alphabet.</div><div>because our chinese use the same letters for the chinese ,or we can translate the chinese to the english letters,but I do not know this sort how to set up,or where to set up ,or which php file control the sort?</div><div><img src="cid:09096252@4050D10D.D5096C55" style="width:638px;min-height:194px"></div><br>_______________________________________________<br>
<a href="http://www.vtiger.com/" target="_blank">http://www.vtiger.com/</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div><div dir="ltr">With<br>Best Regards<br>Uma.S<br><div>Vtiger Team</div></div></div>
</div></div></div></div><br>_______________________________________________<br>
<a href="http://www.vtiger.com/" target="_blank">http://www.vtiger.com/</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr">With<br>Best Regards<br>Uma.S<br><div>Vtiger Team</div></div></div>
</div>