'new_danh_gia' => $new_danh_gia, 'arr' => $arr, 'arrGiaBan' => $arrGiaBan ]); } public function download($id) { $model = Product::find()->where(['id' => $id])->one(); $file_names = ArrayHelper::map(ProductImage::find()->andFilterWhere(['product_id'=>$model->id])->all(),'id','image'); //VarDumper::dump($file_names,10,true); exit(); $zipname = time().$model->code.'.zip'; $zip = new \ZipArchive(); $zip->open($zipname, \ZipArchive::CREATE); foreach ($file_names as $file) { $zip->addFile($file); } $zip->close();
]); } public function download($id) { $model = Product::find()->where(['id' => $id])->one(); $file_names = ArrayHelper::map(ProductImage::find()->andFilterWhere(['product_id'=>$model->id])->all(),'id','image'); //VarDumper::dump($file_names,10,true); exit(); $zipname = time().$model->code.'.zip'; $zip = new \ZipArchive(); $zip->open($zipname, \ZipArchive::CREATE); foreach ($file_names as $file) {
} } } if (isset($_GET['attachment'])){ $array = Json::decode(base64_decode($_GET['attachment'])); $this->download($array['objectId']); } $model = $this->findModel($id); $model->updateAttributes(['so_luot_xem'=>$model->so_luot_xem + 1]); $price_range = PriceRange::findAll(['product_id' => $model->id, 'order_type_id' => 1]); // VarDumper::dump($model->priceRange, 10, true); exit;
} /** * Returns all ancestor modules of this controller. * The first module in the array is the outermost one (i.e., the application instance), * while the last is the innermost one. * @return Module[] all ancestor modules that this controller is located within. */ public function getModules() { $modules = [$this->module]; $module = $this->module; while ($module->module !== null) {
require(__DIR__ . '/../vendor/yiisoft/yii2/Yii.php'); $config = require(__DIR__ . '/../config/web.php'); date_default_timezone_set("Asia/Ho_Chi_Minh"); ini_set('max_execution_time', 0); (new yii\web\Application($config))->run();
$_GET = [ 'id' => '142', 'attachment' => 'eyJvYmplY3RJZCI6MTQyfQ==', ];