Exemplo n.º 1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     require_once 'App\\Libraries\\simple_html_dom.php';
     $model = new ProductInfo();
     $url = $this->option('url');
     $html = file_get_html($url);
     //$this->info($html);
     $title = $html->find('span[id=productTitle]', 0)->innertext;
     $this->info($title);
     $model->name = $title;
     $type = $html->find('span[class=selection]', 0)->innertext;
     $this->info(ltrim($type));
     $model->type = ltrim($type);
     $model->type_detail = '0000';
     $price = $html->find('span[id=priceblock_ourprice]', 0)->innertext;
     $price = $this->getRealPrice($price);
     $model->price = $price;
     $this->info($price);
     $model->trans_fee = '0';
     $status = $html->find('div[id=dynamicDeliveryMessage_feature_div]', 0)->find('span', 0)->innertext;
     $this->info($status);
     $model->status = $status;
     $model->url = $url;
     $model->save();
 }
 public function getProductVariantComboSelectImg()
 {
     $input = Input::all();
     $pid = $input['pid'];
     $piid = $input['piid'];
     $ProductInfo = ProductInfo::where('id', '=', $piid)->where('product_status', '=', '9')->get();
     foreach ($ProductInfo as $info) {
         $name = $info->product_name;
         $store_name = $info->store->store_name;
     }
     $listFiles = [];
     $files = \File::files('assets/img/store/' . $store_name . '/product/' . $pid);
     foreach ($files as $path) {
         $listFiles[] = pathinfo($path);
     }
     return $listFiles;
 }