How can i get data from another, preventing using twice same scripts?
For example, im making a simple module which needs to get some datas from category
In this case: Category Description, and total products...
I already made it, named category2:
Code: Select all
$this->load->language('extension/module/category2');
if (isset($this->request->get['path'])) {
$path = '';
$parts = explode('_', (string)$this->request->get['path']);
$category_id = (int)array_pop($parts);
foreach ($parts as $path_id) {
if (!$path) {
$path = (int)$path_id;
} else {
$path .= '_' . (int)$path_id;
}
$category_info = $this->model_catalog_category->getCategory($path_id);
}
} else {
$category_id = 0;
}
$category_info = $this->model_catalog_category->getCategory($category_id);
if ($category_info) {
$data['heading_title'] = $category_info['name'];
$this->document->setDescription($category_info['meta_description']);
$data['description'] = html_entity_decode($category_info['description'], ENT_QUOTES, 'UTF-8');
$filter_data = array(
'filter_category_id' => $category_id,
);
$product_total = $this->model_catalog_product->getTotalProducts($filter_data);
$data['product_total'] = $product_total;
}
return $this->load->view('extension/module/category2', $data);
}
Pleease any help?