Trek XML field düzeltme - productLink ve doğru fiyat formatı
Browse files
smart_warehouse_with_price.py
CHANGED
@@ -66,18 +66,22 @@ def get_product_price_and_link(product_name, variant=None):
|
|
66 |
try:
|
67 |
price_float = float(price)
|
68 |
if price_float > 200000:
|
69 |
-
|
|
|
70 |
elif price_float > 30000:
|
71 |
-
|
|
|
72 |
elif price_float > 10000:
|
73 |
-
|
|
|
74 |
else:
|
75 |
-
|
|
|
76 |
except:
|
77 |
price = f"{price} TL"
|
78 |
|
79 |
-
# Extract link
|
80 |
-
link_elem = best_match.find('
|
81 |
link = link_elem.text if link_elem is not None and link_elem.text else None
|
82 |
|
83 |
return price, link
|
|
|
66 |
try:
|
67 |
price_float = float(price)
|
68 |
if price_float > 200000:
|
69 |
+
rounded = round(price_float / 5000) * 5000
|
70 |
+
price = f"{int(rounded):,}".replace(',', '.') + " TL"
|
71 |
elif price_float > 30000:
|
72 |
+
rounded = round(price_float / 1000) * 1000
|
73 |
+
price = f"{int(rounded):,}".replace(',', '.') + " TL"
|
74 |
elif price_float > 10000:
|
75 |
+
rounded = round(price_float / 100) * 100
|
76 |
+
price = f"{int(rounded):,}".replace(',', '.') + " TL"
|
77 |
else:
|
78 |
+
rounded = round(price_float / 10) * 10
|
79 |
+
price = f"{int(rounded):,}".replace(',', '.') + " TL"
|
80 |
except:
|
81 |
price = f"{price} TL"
|
82 |
|
83 |
+
# Extract link (field name is productLink, not productUrl!)
|
84 |
+
link_elem = best_match.find('productLink')
|
85 |
link = link_elem.text if link_elem is not None and link_elem.text else None
|
86 |
|
87 |
return price, link
|