public function getCategoryDropOptions() { $category_list = array('' => trans('webshoppack::common.select_option')); $c_data = ProductCategory::where('status', '=', 'active')->orderBy('category_left')->get(array('id', 'category_name', 'category_level')); foreach ($c_data as $row) { if ($row['category_level'] != 0) { $category_list[$row['id']] = $row['category_level'] ? str_repeat(' ', self::MAX_CATEGORY_SPACING * $row['category_level']) . $row['category_name'] : $row['category_name']; } } return $category_list; }
public function deleteExistingImageFiles($reference_id) { $existing_images = ProductCategory::where('id', '=', $reference_id)->first(); if (count($existing_images) > 0 && $existing_images['image_name'] != '') { $data_arr = array('image_name' => '', 'image_ext' => '', 'image_height' => '', 'image_width' => ''); $affectedRows = ProductCategory::whereRaw('id = ?', array($reference_id))->update($data_arr); $this->deleteImageFiles($existing_images['image_name'], $existing_images['image_ext'], \Config::get("webshoppack::product_category_image_folder")); } }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { // if ($this->isAdminRequest()) { $productcategory = ProductCategory::find($id); $parents = array('' => 'Select a Parent (if applicable)') + ProductCategory::where('parent_category', '=', 0)->where('id', '!=', $id)->lists('title', 'id'); return View::make('admin.products.edit')->with('productcategory', $productcategory)->with('productcategories', $parents); } }