mam problem otóż kiedyś prosiłam kogoś o napisanie pewnego skryptu.
Dziś ten skrypt zaczął robić błędy - nie zapisuje cen powyżej 1000 zł
Owa funkcja skanuje ceny z witryny i zapisuje je do bazy.
Strona która jest skanowana ma zapisane ceny namber_format($liczba, 2 ',' , ' ')
Gdy tylko pojawi się np cena: 1 234,56 zapisuje ją jako 1.
Możecie mi pomóc poprawić ten skrypt?
public function getProductDetail($html, $info, $request) { $dom = @DOMDocument::loadHTML($html); $xpath = new DOMXPath($dom); $code = trim((string) $xpath->evaluate("//div[@id='st_product-show_success_frame_info']//ul[1]/li[2]/text()")->item(0)->nodeValue); $product['code'] = $code; // $product['url'] = trim($url); $product['name'] = trim($xpath->evaluate("//div[@id='st_product-show_success_frame_info']//ul[1]/li[1]/h1")->item(0)->nodeValue); $product['category'] = trim($xpath->evaluate("//div[@id='st_product-show_success_frame_info']//ul[1]/li[3]/text()")->item(0)->nodeValue); $product['short_desc'] = trim($xpath->evaluate("//div[@id='st_product-show_success_short_description']")->item(0)->nodeValue); //save info as html content $domInfo = new DOMDocument(); $node = $xpath->evaluate("//div[@id='st_application-st_product-product_description']")->item(0); $domInfo->appendChild($domInfo->importNode($node, true)); $name5_html = $domInfo->saveHTML(); $charAt = stripos($name5_html,'>'); $product['html_desc'] = $name5_html; $product['price'] = 0; $name6 = $xpath->evaluate("//span[@id='st_product_options-price-brutto']"); if($name6->length) { } }
Próbowałam wstawić w kilku miejscach
i niestety nie daje to pożądanego efektu.