implement unified checkout address form with delivery/pickup selection and Uber fee display logic

This commit is contained in:
Alaguraj0361 2026-04-08 11:31:38 +05:30
parent 798a7839e5
commit 467181c4af

View File

@ -219,4 +219,71 @@
</script> </script>
</xpath> </xpath>
</template> </template>
<!-- 4. CHECKOUT INJECTION: Final Safe method for Odoo 17 Selection Page -->
<template id="chennora_checkout_safe_overrides" inherit_id="website_sale.checkout" name="Chennora Checkout Safe Overrides">
<xpath expr="." position="inside">
<script type="text/javascript">
(function() {
function applyCheckoutFixes() {
// 1. Rename Wizard Step 2 (Shipping -> Address)
const wizardSteps = document.querySelectorAll('.progress-wizard-step, .o_wizard_step, .breadcrumb-item');
wizardSteps.forEach(step => {
if (step.textContent.trim().toLowerCase().includes('shipping')) {
const target = step.querySelector('span, a') || step;
target.textContent = 'Address';
}
});
// 2. Find and remove the Shipping section AND its address cards
const allHeaders = [...document.querySelectorAll('h2, h3, h4, h5')];
const shippingHeader = allHeaders.find(h => h.textContent.trim().toLowerCase() === 'shipping');
if (shippingHeader) {
// Find the container for shipping addresses (usually follows the header or is in a sibling div)
shippingHeader.style.display = 'none';
shippingHeader.classList.add('d-none');
// Often Odoo 17 puts addresses in a 'row' following the header
let nextEl = shippingHeader.nextElementSibling;
if (nextEl) {
nextEl.style.display = 'none';
nextEl.classList.add('d-none');
}
// If they are side-by-side in columns, hide the shipping column
const shippingCol = shippingHeader.closest('.col-lg-6');
if (shippingCol) {
shippingCol.style.display = 'none';
shippingCol.classList.add('d-none');
}
}
// 3. Force Billing section to be full width
const billingHeader = allHeaders.find(h => h.textContent.trim().toLowerCase() === 'billing');
if (billingHeader) {
const billingCol = billingHeader.closest('.col-lg-6');
if (billingCol) {
billingCol.classList.remove('col-lg-6');
billingCol.classList.add('col-lg-12', 'w-100');
billingCol.style.flex = '0 0 100%';
billingCol.style.maxWidth = '100%';
}
}
// 4. Hide secondary 'Shipping' add address buttons
document.querySelectorAll('a[href*="/shop/address"]').forEach(btn => {
if (btn.textContent.toLowerCase().includes('shipping')) {
const card = btn.closest('.col-lg-6') || btn.closest('.card') || btn.parentElement;
card.style.display = 'none';
}
});
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', applyCheckoutFixes); else applyCheckoutFixes();
// Handle dynamic Odoo updates
document.addEventListener('website_sale_ready', applyCheckoutFixes);
})();
</script>
</xpath>
</template>
</odoo> </odoo>