big changes, sorry

This commit is contained in:
2025-05-27 12:22:52 +03:00
parent bb12fe5ca7
commit bcee61a817
7 changed files with 371 additions and 98 deletions

View File

@@ -214,11 +214,16 @@ class RobotVacuumYMLGenerator:
if not list(self.categories):
raise ValueError("No categories added to the YML feed.")
# Add offers for each product
for product in products:
# ✅ Фильтрация товаров дороже 300 злотых
filtered_products = [
product
for product in products
if product.get("prices", {}).get("mainPrice", 0) > 300
]
for product in filtered_products:
self.add_offer(product)
# Write the XML tree
tree = ET.ElementTree(self.root)
tree.write(output_yml, encoding="UTF-8", xml_declaration=True)
print(f"YML feed generated: {output_yml}")