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,40 +1,42 @@
<?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 class="d-flex align-items-center mb-3"> <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="bg-warning-light p-2 rounded-circle me-3"> <div class="d-flex align-items-center mb-3">
<i class="fa fa-shopping-basket text-warning fs-5"></i> <div class="bg-warning-light p-2 rounded-circle me-3">
<i class="fa fa-shopping-basket text-warning fs-5"></i>
</div>
<h4 class="mb-0 fw-bold">How would you like your order?</h4>
</div> </div>
<h4 class="mb-0 fw-bold">How would you like your order?</h4>
</div>
<div class="d-flex flex-wrap gap-2 gap-md-3">
<!-- Pickup Option -->
<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"/>
<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>
<div class="fw-bold h6 mb-1">Pickup</div>
<div class="x-small text-muted">Ready in 15-20 mins</div>
</div>
</label>
<!-- Delivery Option --> <div class="d-flex flex-wrap gap-2 gap-md-3">
<label class="service-option position-relative flex-fill cursor-pointer m-0"> <!-- Pickup Option -->
<input type="radio" name="fulfilment_type" value="delivery" class="d-none" t-att-checked="'checked' if website_sale_order.fulfilment_type == 'delivery' else None"/> <label class="service-option position-relative flex-fill cursor-pointer m-0">
<div class="service-card p-3 rounded-3 border text-center transition-all h-100 d-flex flex-column justify-content-center"> <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"/>
<i class="fa fa-truck mb-2 text-primary"></i> <div class="service-card p-3 rounded-3 border text-center transition-all h-100 d-flex flex-column justify-content-center">
<div class="fw-bold h6 mb-1">Delivery</div> <i class="fa fa-shopping-bag mb-2 text-warning"></i>
<div class="x-small text-muted">Estimated 30-45 mins</div> <div class="fw-bold h6 mb-1">Pickup</div>
</div> <div class="x-small text-muted">Ready in 15-20 mins</div>
</label> </div>
</div> </label>
<div class="mt-3 small text-danger d-none" id="service_mode_error"> <!-- Delivery Option -->
<i class="fa fa-exclamation-circle me-1"></i> Please select Pickup or Delivery to continue. <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 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">
<i class="fa fa-truck mb-2 text-primary"></i>
<div class="fw-bold h6 mb-1">Delivery</div>
<div class="x-small text-muted">Estimated 30-45 mins</div>
</div>
</label>
</div>
<div class="mt-3 small text-danger d-none" id="service_mode_error">
<i class="fa fa-exclamation-circle me-1"></i> Please select Pickup or Delivery to continue.
</div>
</div> </div>
</div> </div>
</xpath> </xpath>