Exemplo n.º 1
0
 /**
  * Metoda pobiera dane o produkcie i zapisuje je do bazy danych
  */
 public function getProductData()
 {
     $html = parent::loadPage($this->url);
     $this->setProductName($html);
     $this->data["products"] = array();
     $this->data["products"]["description"] = $html->find(".full-description", 0)->innertext();
     $this->data["products"]["name"] = $this->getProductName();
     $this->data["products"]["product_specs"] = addslashes($this->getProductSpecs($html));
     $this->data["products"]["product_urls"] = $this->url;
     $this->saveData($this->data);
 }
Exemplo n.º 2
0
 /**
  * Metoda wyszukuje produkt na stronie
  */
 public function findProduct()
 {
     $element = parent::loadPage($this->url);
     $products = $element->find("#promo-list ul");
     if (is_array($products) && count($products) > 0) {
         $options = array();
         foreach ($products as $product) {
             $name = $product->find("li.name a", 0)->text();
             $ocena = $product->find("div.note a", 0);
             if (is_object($ocena)) {
                 $ocena = $ocena->text();
             } else {
                 $ocena = "0 opinni";
             }
             $href = $product->find("li.name a", 0)->href;
             $options[] = "<option value='" . $href . "'>" . $name . "<br/>" . strip_tags($ocena) . "</option>";
         }
         return $options;
     } else {
         $products = $element->find("h1.name", 0);
         if (is_object($products)) {
             return $element->find("meta", 2)->content;
         } else {
             return "";
         }
     }
     return "";
 }