PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.16
Yatra – Travel Booking & Tour Operator Software v3.0.16
3.0.16 3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 All 84 releases
← All changes | assets/js/trip.js +14 -6 3.0.15 → 3.0.16 View file →
@@ -3896,8 +3896,9 @@
3896 3896 // Check for traveler-based pricing first
3897 3897 const categoryInputs = this.section.querySelectorAll(`.yatra-availability-category[data-item="${itemIndex}"]`);
3898 3898 let totalPrice = 0;
3899 3899 let totalTravelers = 0;
3900 + let totalGroups = 0; // per-group categories: number of group prices charged
3900 3901
3901 3902 if (categoryInputs.length > 0) {
3902 3903 // Traveler-based pricing: sum up each category's price * quantity (respecting pricing mode)
3903 3904 categoryInputs.forEach((input) => {
@@ -3909,11 +3910,11 @@
3909 3910 const maxPax = parseInt((row ? row.getAttribute('data-max-pax') : null) || input.getAttribute('data-max-pax')) || 0;
3910 3911
3911 3912 if (pricingMode === 'per_group') {
3912 3913 if (quantity > 0) {
3913 - totalPrice += (groupOverflow === 'per_block' && maxPax > 0)
3914 - ? price * Math.ceil(quantity / maxPax)
3915 - : price;
3914 + const blocks = (groupOverflow === 'per_block' && maxPax > 0) ? Math.ceil(quantity / maxPax) : 1;
3915 + totalPrice += price * blocks;
3916 + totalGroups += blocks;
3916 3917 }
3917 3918 } else {
3918 3919 totalPrice += quantity * price;
3919 3920 }
@@ -3941,14 +3942,21 @@
3941 3942 } else {
3942 3943 totalAmountElement.textContent = String(finalPrice.toFixed(2));
3943 3944 }
3944 3945
3945 - // Header "per person" must match chargable average (row totals + group discount), not static PHP.
3946 + // Header price must match the chargeable amount (row totals + group discount), not static PHP.
3947 + // Its unit follows the card's price label: "per person" → average per traveller;
3948 + // "per group" → the price per group actually charged (never divided by headcount,
3949 + // which would turn a flat $1,100 group price into "$550 per group" for two travellers).
3946 3950 const cardRoot = this.section.querySelector('.yatra-availability-card[data-item="' + itemIndex + '"]');
3947 - const headerSaleEl = cardRoot ? cardRoot.querySelector('.yatra-card-header-price .yatra-sale-price') : null;
3951 + const headerPriceWrap = cardRoot ? cardRoot.querySelector('.yatra-card-header-price') : null;
3952 + const headerSaleEl = headerPriceWrap ? headerPriceWrap.querySelector('.yatra-sale-price') : null;
3948 3953 if (headerSaleEl) {
3954 + const headerUnit = headerPriceWrap.getAttribute('data-price-unit') || 'per_person';
3949 3955 let perPerson = 0;
3950 - if (totalTravelers > 0) {
3956 + if (headerUnit === 'per_group') {
3957 + perPerson = totalGroups > 0 ? finalPrice / totalGroups : (totalPrice > 0 ? totalPrice : 0);
3958 + } else if (totalTravelers > 0) {
3951 3959 perPerson = finalPrice / totalTravelers;
3952 3960 } else if (totalPrice > 0) {
3953 3961 perPerson = totalPrice;
3954 3962 }