全部
常见问题
产品动态
精选推荐

手把手教你:给后台商品管理页面增加拼音首字母搜索功能

管理 管理 编辑 删除
首先感谢Crmeb官方提供的开源商城源码,也希望大家多支持官方,使用时请购买商业授权。

废话不多说,进入正题:

1.打开数据库找到商品表 store_product,新增字段first_letter,varchar类型

2.网站根目录下新建extend扩展文件夹,将获取拼音首字母的php类放入

3.找到app/admin/controller/store/storeproduct.php这个文件,打开后找到save方法和update方法,增加如下语句:$data['first_letter'] = \Pinyin\Pinyin::convertInitalPinyin($data['store_name']);

4.找到app/admin/model/store/storeproduct.php这个文件,打开后找到getModelObject方法,111行处,更改为 [size=9pt]$model [/size][size=9pt]= [/size][size=9pt]$model[/size][size=9pt]->where([/size][size=9pt]'p.store_name|p.keyword|p.id|p.first_letter'[/size][size=9pt],[/size][size=9pt]'LIKE'[/size][size=9pt],[/size][size=9pt]"%[/size][size=9pt]$where[/size][size=9pt][store_name][/size][size=9pt]%"[/size][size=9pt]);[/size]

[size=9pt]

[/size]

至此全部完成,后台新添商品或者编辑商品的时候,即可自动生成商品名称的拼音首字母,特殊符号数字原样保留

上图看效果

3722

3723

生成拼音首字母的php类文件可进qq群(群号:175694856)下载。另外有需要二开的朋友也可以加我的qq哦:82260123

手把手教你:给后台商品管理页面增加拼音首字母搜索功能 手把手教你:给后台商品管理页面增加拼音首字母搜索功能 手把手教你:给后台商品管理页面增加拼音首字母搜索功能 手把手教你:给后台商品管理页面增加拼音首字母搜索功能

ByteGlad 最后编辑于2022-10-21 11:47:59

快捷回复
回复({{post_count}}) {{!is_user ? '我的回复' :'全部回复'}}
回复从新到旧

{{item.user_info.nickname ? item.user_info.nickname : item.user_name}} 作者 管理员 企业

{{item.floor}}# 同步到gitee 已同步到gitee {{item.is_suggest==1? '取消推荐': '推荐'}}
{{item.floor}}#
{{item.user_info.title}}
附件

{{itemf.name}}

{{item.created_at}}  {{item.ip_address}}
{{item.like_count}}
{{item.showReply ? '取消回复' : '回复'}}
删除
回复
回复

{{itemc.user_info.nickname}}

{{itemc.user_name}}

作者 管理员 企业

回复 {{itemc.comment_user_info.nickname}}

附件

{{itemf.name}}

{{itemc.created_at}}   {{itemc.ip_address}}
{{itemc.like_count}}
{{itemc.showReply ? '取消回复' : '回复'}}
删除
回复
回复
查看更多
回复
回复
2336
{{like_count}}
{{collect_count}}
添加回复 ({{post_count}})

相关推荐

ByteGlad 作者
暂无简介

回答

1

发布

0

经验

25

快速安全登录

使用微信扫码登录
{{item.label}} {{item.label}} {{item.label}} 板块推荐 常见问题 产品动态 精选推荐 首页头条 首页动态 首页推荐
加精
取 消 确 定
回复
回复
问题:
问题自动获取的帖子内容,不准确时需要手动修改. [获取答案]
答案:
提交
bug 需求 取 消 确 定

快速安全登录

使用微信扫码登录

手机登录

{{codeText}}
{{isQrcode ? '手机登录' : '扫码登录'}}
CRMEB客服

CRMEB咨询热线 咨询热线

400-8888-794

微信扫码咨询

CRMEB开源商城下载 开源下载 CRMEB官方论坛 帮助文档
返回顶部 返回顶部
CRMEB客服