add a service mode selector for pickup or delivery options to the website cart page.

This commit is contained in:
Alaguraj0361 2026-03-20 16:12:31 +05:30
parent 73ef8df4b7
commit 5531400dc3

View File

@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<template id="cart_service_mode" inherit_id="website_sale.cart" name="Service Mode Selector" priority="1000"> <template id="cart_service_mode" inherit_id="website_sale.cart" name="Service Mode Selector" priority="1000">
<!-- Target the very top of the cart container for maximum compatibility --> <!-- Ultra-robust XPath: Target the very top of the entire shop checkout container -->
<xpath expr="//div[contains(@class, 'oe_cart')]/*[1]" position="before"> <xpath expr="//div[contains(@class, 'oe_website_sale')]" position="before" optional="1">
<div id="service_mode_selector" class="mb-4 bg-white p-3 p-md-4 rounded-4 shadow-sm border" style="border-left: 5px solid #FECD4F !important;" t-if="website_sale_order"> <div class="container container-fluid mt-4">
<div id="service_mode_selector" class="mb-4 bg-white p-3 p-md-4 rounded-4 shadow-sm border" style="border-left: 5px solid #FECD4F !important;">
<div class="d-flex align-items-center mb-3"> <div class="d-flex align-items-center mb-3">
<div class="bg-warning-light p-2 rounded-circle me-3"> <div class="bg-warning-light p-2 rounded-circle me-3">
<i class="fa fa-shopping-basket text-warning fs-5"></i> <i class="fa fa-shopping-basket text-warning fs-5"></i>
@ -14,7 +15,7 @@
<div class="d-flex flex-wrap gap-2 gap-md-3"> <div class="d-flex flex-wrap gap-2 gap-md-3">
<!-- Pickup Option --> <!-- Pickup Option -->
<label class="service-option position-relative flex-fill cursor-pointer m-0"> <label class="service-option position-relative flex-fill cursor-pointer m-0">
<input type="radio" name="fulfilment_type" value="pickup" class="d-none" t-att-checked="'checked' if website_sale_order.fulfilment_type == 'pickup' else None"/> <input type="radio" name="fulfilment_type" value="pickup" class="d-none" t-att-checked="'checked' if website_sale_order and website_sale_order.fulfilment_type == 'pickup' else None"/>
<div class="service-card p-3 rounded-3 border text-center transition-all h-100 d-flex flex-column justify-content-center"> <div class="service-card p-3 rounded-3 border text-center transition-all h-100 d-flex flex-column justify-content-center">
<i class="fa fa-shopping-bag mb-2 text-warning"></i> <i class="fa fa-shopping-bag mb-2 text-warning"></i>
<div class="fw-bold h6 mb-1">Pickup</div> <div class="fw-bold h6 mb-1">Pickup</div>
@ -24,7 +25,7 @@
<!-- Delivery Option --> <!-- Delivery Option -->
<label class="service-option position-relative flex-fill cursor-pointer m-0"> <label class="service-option position-relative flex-fill cursor-pointer m-0">
<input type="radio" name="fulfilment_type" value="delivery" class="d-none" t-att-checked="'checked' if website_sale_order.fulfilment_type == 'delivery' else None"/> <input type="radio" name="fulfilment_type" value="delivery" class="d-none" t-att-checked="'checked' if website_sale_order and website_sale_order.fulfilment_type == 'delivery' else None"/>
<div class="service-card p-3 rounded-3 border text-center transition-all h-100 d-flex flex-column justify-content-center"> <div class="service-card p-3 rounded-3 border text-center transition-all h-100 d-flex flex-column justify-content-center">
<i class="fa fa-truck mb-2 text-primary"></i> <i class="fa fa-truck mb-2 text-primary"></i>
<div class="fw-bold h6 mb-1">Delivery</div> <div class="fw-bold h6 mb-1">Delivery</div>
@ -37,6 +38,7 @@
<i class="fa fa-exclamation-circle me-1"></i> Please select Pickup or Delivery to continue. <i class="fa fa-exclamation-circle me-1"></i> Please select Pickup or Delivery to continue.
</div> </div>
</div> </div>
</div>
</xpath> </xpath>
</template> </template>
</odoo> </odoo>