@@ -141,16 +141,7 @@ private function parseProductPage(string $content): PartDetailDTO
141141 $ mass = (float ) $ massStr * 1000 ;
142142
143143 //Parse purchase info
144- $ purchaseInfo = new PurchaseInfoDTO (
145- 'Pollin ' ,
146- $ orderId ,
147- [
148- new PriceDTO (1 , $ dom ->filter ('meta[property="product:price:amount"] ' )->attr ('content ' ), $ dom ->filter ('meta[property="product:price:currency"] ' )->attr ('content ' ))
149- ],
150- $ productPageUrl
151- );
152-
153-
144+ $ purchaseInfo = new PurchaseInfoDTO ('Pollin ' , $ orderId , $ this ->parsePrices ($ dom ), $ productPageUrl );
154145
155146 return new PartDetailDTO (
156147 provider_key: $ this ->getProviderKey (),
@@ -221,6 +212,25 @@ private function parseNotes(Crawler $dom): string
221212 return $ dom ->filter ('div.product-detail-top-features ' )->html () . '<br><br> ' . $ dom ->filter ('div.product-detail-description-text ' )->html ();
222213 }
223214
215+ private function parsePrices (Crawler $ dom ): array
216+ {
217+ //TODO: Properly handle multiple prices, for now we just look at the price for one piece
218+
219+ //We assume the currency is always the same
220+ $ currency = $ dom ->filter ('meta[property="product:price:currency"] ' )->attr ('content ' );
221+
222+ //If there is meta[property=highPrice] then use this as the price
223+ if ($ dom ->filter ('meta[itemprop="highPrice"] ' )->count () > 0 ) {
224+ $ price = $ dom ->filter ('meta[itemprop="highPrice"] ' )->attr ('content ' );
225+ } else {
226+ $ price = $ dom ->filter ('meta[property="product:price:amount"] ' )->attr ('content ' );
227+ }
228+
229+ return [
230+ new PriceDTO (1.0 , $ price , $ currency )
231+ ];
232+ }
233+
224234 public function getCapabilities (): array
225235 {
226236 return [
0 commit comments