Exemple #1
0
 public function delete()
 {
     if ($this->show->itemID) {
         $oProperty = new Catalog_Property();
         if (!$oProperty->delete($this->show->itemID)) {
             throw new Exception(lang('в каталоге есть товар..'));
         }
     }
     redirect(BASE_PATH . 'admin/catalog/property');
 }
Exemple #2
0
 public function delete()
 {
     if ($this->show->itemID) {
         $Cat = new Catalog();
         $prop = new Catalog_Property();
         if ($Cat->isEmptyCategory($this->show->itemID) && $prop->isEmptyProperty($this->show->itemID)) {
             $oCategory = new Catalog_Category();
             $oCategory->delete($this->show->itemID);
         }
     }
     redirect(BASE_PATH . 'admin/catalog/category');
 }
Exemple #3
0
 public function edit()
 {
     $oCatalog = new Catalog();
     $prop = new Catalog_Property();
     if ($this->show->itemID) {
         $row = $oCatalog->getById($this->show->itemID);
         $this->show->categoryID = $row['CategoryID'];
         $this->show->propertyID = $row['PropertyID'];
     } else {
         $this->show->brandID = $this->post['BrandID'];
         $this->show->categoryID = $this->post['CategoryID'];
     }
     $this->show->propertyList = $prop->getList($this->show->categoryID);
     setcookie("brandID", $this->show->brandID, null, '/');
     $this->show->status = $oCatalog->getStatusList();
     if (!empty($this->post['Save'])) {
         if ($this->show->itemID) {
             $oCatalogID = $oCatalog->update($this->post, $this->show->itemID);
         } else {
             $oCatalogID = $oCatalog->insert($this->post);
         }
         if ($oCatalogID) {
             redirect(BASE_PATH . 'admin/catalog/');
         }
     }
     if ($this->show->itemID) {
         $this->show->item = $oCatalog->getByID($this->show->itemID);
         $this->show->breadcrumbs[] = array('url' => BASE_PATH . 'admin/catalog/' . $this->show->itemID, 'title' => $this->show->item['Title']);
     } else {
         $this->show->item = $oCatalog->get();
         $this->show->breadcrumbs[] = array('url' => BASE_PATH . 'admin/catalog/' . $this->show->itemID, 'title' => 'Создание');
         $oCategory = new Catalog_Category();
         $this->show->categoryList = $oCategory->getList($this->show->brandID);
         $oBrand = new Catalog_Brand();
         $this->show->brandList = $oBrand->getList();
     }
     if (!empty($this->post['Save'])) {
         $this->show->item->merge($this->post);
     }
 }
Exemple #4
0
 public function category()
 {
     /**/
     if (!$this->show->itemID) {
         redirect(BASE_PATH . 'catalog');
     }
     if (isset($_GET['filter'])) {
         $this->show->filterID = $_GET['filter'];
         setcookie('filter', $_GET['filter'], NULL, '/');
     } else {
         // если фильтр не меняли
         if (isset($_COOKIE['category'])) {
             if ($_COOKIE['category'] == $this->show->itemID) {
                 if (isset($_COOKIE['filter'])) {
                     $this->show->filterID = $_COOKIE['filter'];
                 } else {
                     $this->show->filterID = 0;
                 }
             } else {
                 $this->show->filterID = 0;
                 setcookie('category', $this->show->itemID, NULL, '/');
                 setcookie('filter', 0, NULL, '/');
             }
         } else {
             $this->show->filterID = 0;
             setcookie('category', $this->show->itemID, NULL, '/');
             setcookie('filter', 0, NULL, '/');
         }
     }
     $this->show->item = $this->oCatalogCategory->getById($this->show->itemID);
     $this->show->breadcrumbs[] = array('PageURL' => BASE_PATH . 'catalog/category/' . $this->show->item['CategoryID'], 'Title' => $this->show->item['Title']);
     $oCatalog = new Catalog();
     $this->show->itemList = $oCatalog->getListForPublic($this->show->itemID, $this->show->filterID);
     $this->show->categoryID = $this->show->itemID;
     $this->show->categoryList = $this->oCatalogCategory->getList($this->show->item['BrandID']);
     $this->show->brand = $this->oCatalogBrand->getById($this->show->item['BrandID']);
     $prop = new Catalog_Property();
     $this->show->propertyList = $prop->getList($this->show->categoryID);
 }