добрый день!
столкнулся с проблемой, на движок MaxyStore Версия 1.5.5.1 поставил шаблон Moneymaker_v.1.1.2
в поиске выдаёт ошибку: Fatal error: Cannot redeclare ControllerProductSearch::ajax() in /home/u320968676/public_html/vqmod/vqcache/vq2-catalog_controller_product_search.php on line 600
сам код php файла с 600й строки:
public function ajax() {
$data = array();
if( isset($this->request->get['keyword']) ) {
function custom_escape_string($inp) {
if(is_array($inp))
return array_map(__METHOD__, $inp);
if(!empty($inp) && is_string($inp)) {
return str_replace(array('\\', "\0", "\n", "\r", "'", '"', "\x1a"), array('\\\\', '\\0', '\\n', '\\r', "\\'", '\\"', '\\Z'), $inp);
}
return $inp;
}
$keywords = custom_escape_string( $this->request->get['keyword'] );
if( strlen($keywords) >= 3 ) {
$parts = $keywords;
$add = '';
$add .= ' AND ((LOWER(pd.name) LIKE "%' . $this->db->escape($parts) . '%")';
$add .= ' OR (LOWER(p.sku) LIKE "%' . $this->db->escape($parts) . '%")';
$add .= ' OR (LOWER(p.model) LIKE "%' . $this->db->escape($parts) . '%"))';
$add = substr( $add, 4 );
$sql = 'SELECT DISTINCT pd.product_id, pd.name FROM ' . DB_PREFIX . 'product_description AS pd ';
$sql .= 'LEFT JOIN ' . DB_PREFIX . 'product AS p ON p.product_id = pd.product_id ';
$sql .= 'LEFT JOIN ' . DB_PREFIX . 'product_to_store AS p2s ON p2s.product_id = pd.product_id ';
$sql .= 'WHERE ' . $add . ' AND p.status = 1 ';
$sql .= 'AND pd.language_id = ' . (int)$this->config->get('config_language_id');
$sql .= ' AND p2s.store_id = ' . (int)$this->config->get('config_store_id');
$sql .= ' ORDER BY p.sort_order ASC, LOWER(pd.name) ASC, LOWER(p.model) ASC';
$sql .= ' LIMIT 8';
$res = $this->db->query( $sql );
if( $res ) {
$data = ( isset($res->rows) ) ? $res->rows : $res->row;
$basehref = 'product/product&keyword=' . $this->request->get['keyword'] . '&product_id=';
foreach( $data as $key => $values ) {
$data[$key] = array(
'name' => htmlspecialchars_decode($values['name'], ENT_QUOTES),
'href' => $basehref . $values['product_id']
//'href' => $this->url->link($basehref . $values['product_id'])
);
}
}
}
}
echo json_encode( $data );
}
спасибо заранее за помощь!