/** * Парсинг товаров на страницах категорий * @param [type] $brand_links [description] */ private function parse_categories($brand_links) { $i = 0; $this->products = array(); foreach ($brand_links as $key_type => $link) { $product_names = array(); $this->web_driver->get(self::URL_BASE . $link); $page_category = new Page_Category($this->web_driver); $category_products = $page_category->get_products(); foreach ($category_products as $key_prod => $product) { $product_names[] = $product->getText(); } // if($key_type !== "sun") { // $product_names = array_splice($product_names, -2); // } foreach ($product_names as $key_name => $name) { // if(!in_array($name, array("P 8597", "P 8613"))) { // continue; // } // if ($i % 1 == 0 && $i > 0) { // echo '<pre>'; // echo count($products); // print_r($products); // echo '</pre>'; // $page_category= $this->do_relogin($link); // } $page_product = $page_category->click_product_by_link_text($name); $name_code = str_replace(' ', '_', trim($name)); $item_title = str_replace(' ', '', trim($name)); $this->products[$name_code]['brand'] = $this->brands[$this->brand]; $this->products[$name_code]['item_title'] = $item_title; $this->products[$name_code]['item_name'] = $name; $this->products[$name_code]['type'] = $this->type; $this->products[$name_code]['price'] = $page_product->get_price(); $this->products[$name_code]['main_img'] = $page_product->get_main_img(); $this->products[$name_code]['variations'] = $page_product->get_variations($name); $page_category = $page_product->navigate_back(); // if($i){ // echo '<pre>'; // print_r($this->products); // echo '</pre>'; // die('??'); // return; // } $i++; } } }
print $Page->Html(); break; case 'feature': $Page = new Page_Feature(''); print $Page->Html(); break; case 'color': $Page = new Page_Color(''); print $Page->Html(); break; case 'type': $Page = new Page_Type(''); print $Page->Html(); break; case 'category': $Page = new Page_Category(''); print $Page->Html(); break; case 'style': $Page = new Page_Style(''); print $Page->Html(); break; case 'brand': $Page = new Page_Brand(''); print $Page->Html(); break; case 'banners': $Page = new Page_Banners(''); print $Page->Html(); break; }