Ejemplo n.º 1
0
 public function parseProductDetails(XPathHelper $xph)
 {
     $record = reset($xph->xpSubQueries("//div[@id='productDesc']", array('product.name' => "//div[@class='RSTL_RightTitle_Product']", 'product.price_retail' => "//div[@id='rightSideWrapper']/div[@class='RSTR_TopRetail_Product']", 'product.price_listed' => "//div[@id='rightSideWrapper']/div[@class='RSTR_TopValue_Product']/div[@class='pOurPriceM']", 'product.price_sale' => "//div[@id='rightSideWrapper']/div[@class='RSTR_TopValue_Product']/div[@class='pSalePrice']", 'product.url' => "//link[@rel='canonical']/@href")));
     $record['product.numeric_details[]'] = $xph->queryValue("//div[@id='productDesc']//div[@id='RSTL_Right_Product']/div[@class='RSTL_RightCount_Product']/div", -1);
     $record['product.rating'] = $xph->queryValue("//span[@class='BVRRNumber BVRRRatingNumber']");
     return $record;
 }
Ejemplo n.º 2
0
 public function parseProductDetails(XPathHelper $xph)
 {
     $record = reset($xph->xpSubQueries("//div[@id='ProductDetails']//div[@class='BlockContent']", array('product.name' => 'h2', 'product.price_retail' => "div[@class='ProductMain']/div[@class='ProductDetailsGrid']/div[@class='DetailRow RetailPrice']/div[@class='Value']", 'product.price_listed' => "div[@class='ProductMain']/div[@class='ProductDetailsGrid']/div[@class='DetailRow PriceRow']/div[@class='Value']/em[@class='ProductPrice VariationProductPrice']", 'product.sku' => "div[@class='ProductMain']/div[@class='ProductDetailsGrid']/div[@class='DetailRow ProductSKU']/div[@class='Value']")));
     $record['product.description'] = $xph->queryValue("//div[@id='ProductDescription']/div[@class='ProductDescriptionContainer']");
     /** TODO: parse additional data fields for weight, quantity, brand,rating..
      *	//div[@id='ProductDetails']//div[@class='BlockContent']/div[@class='ProductMain']/div[@class='ProductDetailsGrid']/div[@class='DetailRow']
      *	will return a list of div[@class='Label'] and div[@class='Value'] children 
      */
     return $record;
 }
 public function parseProductDetails(XPathHelper $xph)
 {
     //broken page with error message
     if (substr($xph->queryValue("//div[@class='itemPageWrapper']/text()[5]"), 0, 9) === 'Exception') {
         return array();
     }
     $result = array();
     //Discontinued items have no price.
     if ($xph->queryValue("//div[@id='unluckyInfo']/div[@id='apology']/h2") === "We're Sorry, We No Longer Carry This Item") {
         $result = $this->array_merge_first_record($result, $xph->xpSubQueries("//div[@id='unluckyInfo']/div[@id='apology']", array('product.sku_and_upc' => "//div[@class='itemDataCode']")));
         return $result;
     }
     //regular items
     $result = $this->array_merge_first_record($result, $xph->xpSubQueries("//div[@class='imgBorderBgNew']", array('product.sku' => "//div[@class='itemDataCode'][span]", 'product.upc' => "//div[@class='itemDataCode'][not(span)]")));
     //TRICK: putting array arround collapseLabelValuePairs() to make it compatible with array_merge_first_record()
     $result = $this->array_merge_first_record($result, array($this->collapseLabelValuePairs($xph->xpSubQueries("//div[@id='tabInfoContent']/table/tbody/tr/td/table/tbody/tr/td/div[@class='itemData']", array('label' => 'b', 'value' => 'text()')))));
     $result = $this->array_merge_first_record($result, $xph->xpSubQueries("//div[@id='tabPricingContent']/table/tbody/tr/td/div[@class='pricingDisplay']", array('product.price_retail' => "table/tbody/tr/td/div[@class='retailPrice']", 'product.price_listed' => "table/tbody/tr/td/div[@class='salePrice']|table/tbody/tr/td/div[@class='specialPrice']")));
     $result['product.url'] = $xph->getUrl();
     return $result;
 }
Ejemplo n.º 4
0
 public function parseOfferSellerListPagination(XPathHelper $xph)
 {
     return $xph->queryValue("//span[@id='online-pagination']/a[contains(.,'Next')]/@href");
 }
Ejemplo n.º 5
0
 public function parseOfferMerchantListPagination(XPathHelper $xph)
 {
     return $xph->queryValue("//ul[@class='a-pagination']/li[@class='a-last']/a/@href");
 }