phpcmsV9内容排序不能同步推荐位解决代码
问题:
此问题涉及到PHPCMSV9的大部分版本,发现在的有 phpcms_v9.2.3_UTF8、phpcms_v9.3.3_UTF8,就用了这两个 其他没有测试,相必应该都有,解决办法都是一样的。
phpcmsv9 把内容推送到推荐位后,更改内容的排序,但推荐位不能同步更新,这样前台的显示顺序就不能按照我们要求的排序,下面是解决的代码:
修改文件路径:phpcms\modules\content\content.php 大约437行
/**
* 排序
*/
public function listorder() {
if(isset($_GET['dosubmit'])) {
$catid = intval($_GET['catid']);
if(!$catid) showmessage(L('missing_part_parameters'));
$modelid = $this->categorys[$catid]['modelid'];
$this->db->set_model($modelid);
foreach($_POST['listorders'] as $id => $listorder) {
$this->db->update(array('listorder'=>$listorder),array('id'=>$id));
//更改推荐排序开始,这里要增加的内容开始
$r = $this->db->get_one(array('id'=>$id));
if($r['posids'])
{
$awzsr_db_data = pc_base::load_model('position_data_model');
$awzsr_db_config = pc_base::load_config('database');
$awzsr_tablepre = $awzsr_db_config['default']['tablepre'];
$awzsr_dbtable_name = $tablepre."position_data";
$awzsr_db_data->update(array('listorder'=>$listorder),array('id'=>$id,modelid=>$modelid));
}
//更改推荐排序结束,这里是增加的内容结束
}
showmessage(L('operation_success'));
} else {
showmessage(L('operation_failure'));
}
}
|
