ShopWT官网-php多用户商城系统-在路上
标题:
ShoWT 使用 - ShoWT B2B2C最新版 让所有店铺能使用所有分类不一个个绑定
[打印本页]
作者:
希望
时间:
2016-9-7 15:58
标题:
ShoWT 使用 - ShoWT B2B2C最新版 让所有店铺能使用所有分类不一个个绑定
本帖最后由 希望 于 2016-9-7 16:03 编辑
是不是觉得只有自营店才能使用所有分类,其他店铺得一个个申请每种分类太麻烦了,现在就让我们改一改程序:
让所有店铺能使用所有分类不在需要绑定分类
【温馨提示:修改之前先备份,如果出错了可以还原】
找到文件:
data\model\goods_class.model.php
/**
* 取得店铺绑定的分类
*
* @param number $store_id 店铺id
* @param number $pid 父级分类id
* @param number $deep 深度
* @return array 二维数组
*/
public function getGoodsClass($store_id, $pid = 0, $deep = 1) {
// 读取商品分类
$gc_list = $this->getGoodsClassListByParentId($pid);
// 如果不是自营店铺或者自营店铺未绑定全部商品类目,读取绑定分类
if (!checkPlatformStoreBindingAllGoodsClass()) {
$gc_list = array_under_reset($gc_list, 'gc_id');
$model_storebindclass = Model('store_bind_class');
$gcid_array = $model_storebindclass->getStoreBindClassList(array(
'store_id' => $store_id,
'state' => array('in', array(1, 2)),
), '', "class_{$deep} asc", "distinct class_{$deep}");
if (!empty($gcid_array)) {
$tmp_gc_list = array();
foreach ($gcid_array as $value) {
if (isset($gc_list[$value["class_{$deep}"]])) {
$tmp_gc_list[] = $gc_list[$value["class_{$deep}"]];
}
}
$gc_list = $tmp_gc_list;
} else {
return array();
}
}
return $gc_list;
}
复制代码
修改为:
/**
* 取得店铺绑定的分类
*
* @param number $store_id 店铺id
* @param number $pid 父级分类id
* @param number $deep 深度
* @return array 二维数组
*/
public function getGoodsClass($store_id, $pid = 0, $deep = 1) {
// 读取商品分类
$gc_list = $this->getGoodsClassListByParentId($pid);
// 如果不是自营店铺或者自营店铺未绑定全部商品类目,读取绑定分类
/*
if (!checkPlatformStoreBindingAllGoodsClass()) {
$gc_list = array_under_reset($gc_list, 'gc_id');
$model_storebindclass = Model('store_bind_class');
$gcid_array = $model_storebindclass->getStoreBindClassList(array(
'store_id' => $store_id,
'state' => array('in', array(1, 2)),
), '', "class_{$deep} asc", "distinct class_{$deep}");
if (!empty($gcid_array)) {
$tmp_gc_list = array();
foreach ($gcid_array as $value) {
if (isset($gc_list[$value["class_{$deep}"]])) {
$tmp_gc_list[] = $gc_list[$value["class_{$deep}"]];
}
}
$gc_list = $tmp_gc_list;
} else {
return array();
}
}*/
return $gc_list;
}
复制代码
shop\control\store_goods_add.php
寻找:
public function add_step_twoOp
方法里面的:
// 如果不是自营店铺或者自营店铺未绑定全部商品类目,读取绑定分类
if (!checkPlatformStoreBindingAllGoodsClass()) {
$where['class_1|class_2|class_3'] = $gc_id;
$where['store_id'] = $_SESSION['store_id'];
$rs = Model('store_bind_class')->getStoreBindClassInfo($where);
if (empty($rs)) {
showMessage(L('store_goods_index_again_choose_category2'));
}
}
复制代码
改成:
// 如果不是自营店铺或者自营店铺未绑定全部商品类目,读取绑定分类
/*
if (!checkPlatformStoreBindingAllGoodsClass()) {
$where['class_1|class_2|class_3'] = $gc_id;
$where['store_id'] = $_SESSION['store_id'];
$rs = Model('store_bind_class')->getStoreBindClassInfo($where);
if (empty($rs)) {
showMessage(L('store_goods_index_again_choose_category2'));
}
}
*/
复制代码
\shop\control\store_goods_online.php
寻找:public function edit_save_goodsOp()
// 三方店铺验证是否绑定了该分类
if (!checkPlatformStore()) {
$where = array();
$where['class_1|class_2|class_3'] = $gc_id;
$where['store_id'] = $_SESSION['store_id'];
$rs = Model('store_bind_class')->getStoreBindClassInfo($where);
if (empty($rs)) {
showDialog(L('store_goods_index_again_choose_category2'));
}
}
复制代码
修改为:
// 三方店铺验证是否绑定了该分类
/*
if (!checkPlatformStore()) {
$where = array();
$where['class_1|class_2|class_3'] = $gc_id;
$where['store_id'] = $_SESSION['store_id'];
$rs = Model('store_bind_class')->getStoreBindClassInfo($where);
if (empty($rs)) {
showDialog(L('store_goods_index_again_choose_category2'));
}
}
*/
复制代码
复制代码
作者:
shopwt
时间:
2016-9-7 19:33
感谢提供教程,不过V5.0.1已支持了,跟你上面的方案有些不同,看需要的人看情况来,已打补丁的用户不用此方案。
欢迎光临 ShopWT官网-php多用户商城系统-在路上 (https://bbs.shopwt.com/)
Powered by Discuz! X3.4