function show() { array_push($this->data['js_functions'], array('name' => 'products_show_init', 'data' => FALSE)); $product_categories = new Product_category(); $product_categories->get_full_info(); $this->data['dm_product_categories'] = $product_categories; $this->template->load('/admin/templates/main_template', '/admin/products/show', $this->data); }
public function products_by_type($category_name = '', $type_name = '', $type_id = false) { if (!$type_id) { echo 'return false'; } array_push($this->data['js_functions'], array('name' => 'home_products_init', 'data' => FALSE)); $product_categories = new Product_category(); $product_type = new Product_types(); #Vse categorii $product_categories->get_full_info(); $product_type_selected->get_full_info($type_id); $product_category_selected->get_by_related($product_type)->get(); $product_type_selected->product->get_full_info(); $this->data['dm_product_categories'] = $product_category; $this->data['dm_product_types'] = $product_type; $this->data['dm_product_category_selected'] = $product_category_selected; $this->data['dm_product_type_selected'] = $product_type_selected; $this->data['dm_products'] = $product_type_selected->product; $this->template->load('/templates/main_template', 'homepage', $this->data); }
public function show($product_id, $product_name = '') { if (!$product_id) { echo 'product_show return false'; } array_push($this->data['js_functions'], array('name' => 'home_prodcut_show_init', 'data' => FALSE)); #! $product_category_selected = new Product_category(); $product_type_selected = new Product_type(); $product_selected = new Product(); $nutrition_categories = new Nutrition_category(); #! $product_selected->get_full_info($product_id); $product_selected->nutrition->get_full_info(); #$product_selected->nutrition->convert_to_mera(2); $product_type_selected->get_full_info($product_selected->product_type_id); $product_type_selected->product->get_full_info(); $product_category_selected->get_full_info($product_type_selected->product_category_id); $nutrition_categories->get_full_info(); #! $meras_available = array('100 gramms'); foreach ($product_selected->mera as $mera) { $meras_available[$mera->join_seq] = $mera->join_name . ' ( ' . $mera->join_value . ' )'; } #! $this->data['meras_available'] = $meras_available; $this->data['dm_product_category_selected'] = $product_category_selected; $this->data['dm_product_type_selected'] = $product_type_selected; $this->data['dm_product_selected'] = $product_selected; $this->data['dm_nutrition_categories'] = $nutrition_categories; #nutritions by selected product $this->data['dm_nutritions'] = $product_selected->nutrition; $this->data['dm_products'] = $product_type_selected->product; array_push($this->data['crumbs'], array('name' => 'home', 'link' => $this->linker->home_page_link())); array_push($this->data['crumbs'], array('name' => $product_selected->join_name, 'link' => false)); #! $this->template->load('/templates/main_template', '/products/product_show', $this->data); }
function edit($id = false) { $this->load->library('form_validation'); # Js function from main.js which loads by default array_push($this->data['js_functions'], array('name' => 'product_categories_edit_init', 'data' => FALSE)); $languages = new Language(); $product_category = new Product_category(); $languages->get_iterated(); $product_category->get_full_info($id); //if form validates if ($this->form_validation->run('product_category')) { if ($this->save_object_name($product_category)) { $this->data['form_success'] = 'Категория добавлена'; } else { $this->data['form_error'] = $product_category->error->string; } } else { $this->data['form_error'] = validation_errors(); } $this->data['dm_languages'] = $languages; $this->data['current_language'] = 1; $this->data['dm_product_category'] = $product_category; $this->template->load('/admin/templates/main_template', '/admin/product_categories/edit', $this->data); }
function get_product_types_list() { $category_id = (int) $this->input->post('category_id'); if (!$category_id and !is_numeric($type_id)) { echo 'return false'; } $product_category = new Product_category(); $products = new Product(); $product_category->get_full_info($category_id); $product_category->product_type->get_full_info(); $this->data['dm_product_types'] = $product_category->product_type; $this->load->view('admin/products/sub/show_types_list', $this->data); }