Пример #1
0
 public function delete_stock()
 {
     $data = $this->data;
     $stockid_Num = $this->input->get('stockid');
     if (empty($data['User']->uid_Num)) {
         echo '操作權限不足';
         return FALSE;
     }
     if (!empty($stockid_Num)) {
         $StockProductShop = new StockProductShop(['stockid_Num' => $stockid_Num]);
         $StockProductShop->delete();
         return TRUE;
     } else {
         echo '處理失敗';
         return FALSE;
     }
 }
Пример #2
0
 public function set_destroy_post()
 {
     $ProductShopList = new ObjList(['db_where_Arr' => ['status' => -1], 'db_where_deletenull_Bln' => TRUE, 'model_name_Str' => 'ProductShop', 'limitstart_Num' => 0, 'limitcount_Num' => 100]);
     foreach ($ProductShopList->obj_Arr as $key => $value_product) {
         $ProductShop = new ProductShop(['productid_Num' => $value_product->productid_Num]);
         $ProductShop->destroy();
         $StockProductShopList = new ObjList(['db_where_Arr' => ['productid_Num' => $ProductShop->productid_Num], 'db_where_deletenull_Bln' => TRUE, 'model_name_Str' => 'StockProductShop', 'limitstart_Num' => 0, 'limitcount_Num' => 100]);
         foreach ($StockProductShopList->obj_Arr as $key => $value_stockproduct) {
             $StockProductShop = new StockProductShop(['stockid_Num' => $value_stockproduct->stockid_Num]);
             $StockProductShop->destroy();
         }
     }
     if (!empty($ProductShopList->obj_Arr)) {
         $this->load->model('Message');
         $this->Message->show(['message' => '銷毀成功', 'url' => 'admin/shop/product/set/set']);
     } else {
         $this->load->model('Message');
         $this->Message->show(['message' => '已無可銷毀的項目', 'url' => 'admin/shop/product/set/set']);
     }
 }
Пример #3
0
 public function copy()
 {
     $data = $this->data;
     //取得公用數據
     $productid_Num = $this->input->get('productid');
     $product2_ProductShop = new ProductShop();
     $product2_ProductShop->construct_db(array('db_where_Arr' => array('productid' => $productid_Num)));
     //建構ProductShopNxstgirl物件,並且更新
     $product_ProductShop = new ProductShop();
     $product_ProductShop->construct(array('name_Str' => $product2_ProductShop->name_Str, 'price_Num' => $product2_ProductShop->price_Num, 'cost_Num' => $product2_ProductShop->cost_Num, 'synopsis_Str' => $product2_ProductShop->synopsis_Str, 'classids_Arr' => $product2_ProductShop->class_ClassMetaList->uniqueids_Arr, 'content_Str' => $product2_ProductShop->content_Html, 'content_specification_Str' => $product2_ProductShop->content_specification_Html, 'precautions_Str' => $product2_ProductShop->precautions_Html, 'warehouseid_Str' => $product2_ProductShop->warehouseid_Str, 'prioritynum_Num' => $product2_ProductShop->prioritynum_Num));
     $product_ProductShop->update();
     $stock_count_Num = count($product2_ProductShop->stock_StockProductShopList->obj_Arr);
     foreach ($product2_ProductShop->stock_StockProductShopList->obj_Arr as $key => $value_StockProductShop) {
         $StockProductShop = new StockProductShop();
         $StockProductShop->construct(['productid_Num' => $product_ProductShop->productid_Num, 'classname1_Str' => $value_StockProductShop->classname1_Str, 'classname2_Str' => $value_StockProductShop->classname2_Str, 'color_rgb_Str' => $value_StockProductShop->color_rgb_Str, 'stocknum_Num' => $value_StockProductShop->stocknum_Num, 'prioritynum_Num' => $stock_count_Num - $key]);
         $StockProductShop->update();
     }
     if ($product_ProductShop->productid_Num !== NULL) {
         $this->load->model('Message');
         $this->Message->show(array('message' => '複製成功,請篩選未上架產品查看', 'url' => 'admin/shop/product/product/tablelist'));
     } else {
         $this->load->model('Message');
         $this->Message->show(array('message' => '複製失敗', 'url' => 'admin/shop/product/product/tablelist'));
     }
 }