[FIX] website_sale_aplicoop: Arreglar botón Home Delivery en shop (añadir/remover producto de entrega al carrito)
This commit is contained in:
parent
4a668b3240
commit
130a5ff6c4
3 changed files with 79 additions and 52 deletions
|
|
@ -1463,6 +1463,18 @@ class AplicoopWebsiteSale(WebsiteSale):
|
|||
session_key = f"eskaera_{order_id}"
|
||||
cart = request.session.get(session_key, {})
|
||||
|
||||
# Get delivery product from group_order (configured per group order)
|
||||
delivery_product = group_order.delivery_product_id
|
||||
delivery_product_id = delivery_product.id if delivery_product else None
|
||||
# Get translated product name based on current language
|
||||
if delivery_product:
|
||||
delivery_product_translated = delivery_product.with_context(
|
||||
lang=request.env.lang
|
||||
)
|
||||
delivery_product_name = delivery_product_translated.name
|
||||
else:
|
||||
delivery_product_name = "Home Delivery"
|
||||
|
||||
# Get translated labels for JavaScript (same as checkout)
|
||||
labels = self.get_checkout_labels()
|
||||
|
||||
|
|
@ -1482,6 +1494,11 @@ class AplicoopWebsiteSale(WebsiteSale):
|
|||
"product_supplier_info": product_supplier_info,
|
||||
"product_price_info": product_price_info,
|
||||
"product_display_info": product_display_info,
|
||||
"delivery_product_id": delivery_product_id,
|
||||
"delivery_product_name": delivery_product_name,
|
||||
"delivery_product_price": (
|
||||
delivery_product.list_price if delivery_product else 5.74
|
||||
),
|
||||
"labels": labels,
|
||||
"labels_json": json.dumps(labels, ensure_ascii=False),
|
||||
"lazy_loading_enabled": lazy_loading_enabled,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue