示例#1
0
 function index()
 {
     if ($_REQUEST['in-cart-product-id']) {
         $cart = new Application_Models_Cart();
         $cart->addToCart($_REQUEST['in-cart-product-id']);
         Lib_SmalCart::getInstance()->setCartData();
         header('Location: /catalog');
         exit;
     }
     $model = new Application_Models_Catalog();
     $Items = $model->getList();
     $this->Items = $Items;
 }
示例#2
0
 function index()
 {
     $model = new Application_Models_Catalog();
     $mod1 = $model->getContent();
     $mod2 = $model->getpageNumber();
     $cat_tree = Lib_Category::getInstance()->getCat_Tree_Catalog();
     $manufacturer_tree = Lib_Manufacturer::getInstance()->getManufacturerTree_Catalog();
     $url = Url::freefromP();
     $clearurl = Url::fullclearUrl();
     $adjective = Url::makeclear($url);
     if (isset($mod1)) {
         $this->mod1 = $mod1;
     }
     if (isset($mod2)) {
         $this->mod2 = $mod2;
     }
     $this->cat_tree = $cat_tree;
     $this->manufacturer_tree = $manufacturer_tree;
     $this->url = $url;
     $this->clearurl = $clearurl;
     $this->adjective = $adjective;
 }
示例#3
0
 function saveeditedproduct()
 {
     parse_str($_POST['str'], $update);
     if ($update['pictures']) {
         $images = explode(',', $update['pictures']);
         foreach ($images as $key => $value) {
             $picture = explode('_', $value);
             if ($picture[0] != 'id' && !is_numeric($picture[1])) {
                 $value2 = 'id_' . $update['id'] . '_' . $value;
             } else {
                 $value2 = $value;
             }
             rename($_SERVER['DOCUMENT_ROOT'] . '/uploads/temporary/' . $value, $_SERVER['DOCUMENT_ROOT'] . '/uploads/' . $value2);
             rename($_SERVER['DOCUMENT_ROOT'] . '/uploads/temporary/thumbnail/' . $value, $_SERVER['DOCUMENT_ROOT'] . '/uploads/thumbnail/' . $value2);
             $images[$key] = $value2;
         }
         $images = serialize($images);
     } else {
         $images = '';
     }
     $model = new Application_Models_Catalog();
     $res = $model->updateProduct($images, $update);
     if ($res) {
         $response = array("msg" => "Товар с id " . $update['id'] . " изменен", "status" => "success");
     } else {
         $response = array("msg" => "Чтото пошло не так", "status" => "danger");
     }
     echo json_encode($response);
     exit;
 }