Joni-Jo
Постоялец
- Регистрация
- 23 Янв 2014
- Сообщения
- 57
- Реакции
- 8
Ребят,кто у курсе,как понимать этот кусок кода(BrainyFilter Ultimate 5.0.5 )
Данный кусок кода делает 2 операции:
1я: В файле: catalog/model/catalog/product.php ищет строчку:
Код:
public function getProducts($data = array()) {
Код:
/**
* Custom getProducts() method added by Brainy Filter extension
*/
public function getProducts($data = array())
{
if (!isset($data['filter_bfilter'])) {
return $this->getProductsOriginal($data);
}
$settings = $this->config->get('brainyfilter_layout_basic');
if (isset($settings['global']['subcategories_fix']) && $settings['global']['subcategories_fix']) {
$data['filter_sub_category'] = true;
}
$this->load->model('module/brainyfilter');
$model = new ModelModuleBrainyFilter($this->registry);
$model->setData($data);
$sql = $model->prepareQueryForCategory();
$query = $this->db->query($sql);
$product_data = array();
foreach ($query->rows as $result) {
$product_data[$result['product_id']] = $this->getProduct($result['product_id']);
}
return $product_data;
}
/**
* It is the original getProducts() method, which was renamed by Brainy Filter modification.
* A custom getProduct() method was added instead.
* Disable the Brainy Filter OCMOD modification in order to reset the method.
* Note: disabling of Brainy Filter modification will break the work of Brainy Filter extension.
*/
public function getProductsOriginal($data = array()) {
2я операция: добавляет после строчки:
Код:
public function getTotalProducts($data = array()) {
Код:
/**
* Custom getTotalProducts() method added by Brainy Filter extension
*/
public function getTotalProducts($data = array())
{
if (!isset($data['filter_bfilter'])) {
return $this->getTotalProductsOriginal($data);
}
$settings = $this->config->get('brainyfilter_layout_basic');
if (isset($settings['global']['subcategories_fix']) && $settings['global']['subcategories_fix']) {
$data['filter_sub_category'] = true;
}
$this->load->model('module/brainyfilter');
$model = new ModelModuleBrainyFilter($this->registry);
$model->setData($data);
$sql = $model->prepareQueryForTotal();
$query = $this->db->query($sql);
return $query->row['total'];
}
/**
* It is the original getTotalProducts() method, which was renamed by Brainy Filter modification.
* A custom getTotalProducts() method was added instead.
* Disable the Brainy Filter OCMOD modification in order to reset the method.
* Note: disabling of Brainy Filter modification will break the work of Brainy Filter extension.
*/
public function getTotalProductsOriginal($data = array()) {