/* * Copyright 2025 Criptomart * License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl) */ (function () { "use strict"; // Objeto global para gestión de carrito window.groupOrderShop = { orderId: null, cart: {}, labels: {}, // Will be loaded from HTML data attributes init: function () { console.log("[groupOrderShop] Initializing..."); var self = this; // Get order ID first (needed by i18nManager and other functions) var confirmBtn = document.getElementById("confirm-order-btn"); var cartContainer = document.getElementById("cart-items-container"); var orderIdElement = confirmBtn || cartContainer; if (!orderIdElement) { console.log("No elements found to get order ID"); return false; } // Get the order ID from the data attribute or from the URL this.orderId = orderIdElement.getAttribute("data-order-id"); if (!this.orderId) { var urlMatch = window.location.pathname.match(/\/eskaera\/(\d+)/); this.orderId = urlMatch ? urlMatch[1] : null; } if (!this.orderId) { console.error("Order ID not found"); if (cartContainer) { cartContainer.innerHTML = '
' + (labels.empty_cart || "This order's cart is empty.") + "
"; return; } var html = '