Browse Source

Added more information to the checkout summary to include size/style in it if available. Removed total_weight from OrdersBlock to avoid conflicts with previous orders in index.md.

db.py - fixed issue with wrong product_id check

schema.py - removed total_weight from BLock schema

serializer.py - added style/size to the summary of the order.
slow_tiger 1 year ago
parent
commit
9b2d0e875d
3 changed files with 7 additions and 5 deletions
  1. 1 1
      app/db.py
  2. 0 1
      app/schema.py
  3. 6 3
      app/serializer.py

+ 1 - 1
app/db.py

@@ -281,7 +281,7 @@ def prepare_order_info(
             for meta in products_meta:
                 cart_product_id = meta.product_id
 
-                if cart_product_id == k:
+                if cart_product_id == v.product_id:
                     item = CartOrderInfo(
                         code=meta.code,
                         title=meta.title,

+ 0 - 1
app/schema.py

@@ -290,7 +290,6 @@ class OrdersBlock(BaseModel):
     items: list[OrdersBlockItem]
     currency: str
     subtotal: int
-    total_weight: int
     shipping: float
     total: float
     shipping_info: OrdersBlockShippingInfo

+ 6 - 3
app/serializer.py

@@ -206,9 +206,12 @@ def format_order_items(items: list[CartOrderInfo | dict[str, str | int]]) -> str
         
         item_title = i.title
          
-        if i.options.size and i.options.style:
-            item_title = f"{item_title} ({i.options.style.capitalize()} / Size {i.options.size.upper()})"
-             
+        if i.options.style:
+            item_title += f" - {i.options.style.capitalize()}"
+
+        if i.options.size:
+            item_title += f" Size {i.options.size.upper()}"
+
         item = (
             f"  - code: '{i.code}'\n"
             f"    title: '{item_title}'\n"