1function easystore_formatPrice(priceStr = '') { 2 if (priceStr) { 3 return priceStr.replace(/ /g, ' '); 4 } 5 return priceStr; 6} 7 8function easystore_getQuantityMaximum(item = {}) { 9 const enabled = (value) => value === true || value === 1 || value === '1' || value === 'true'; 10 const limits = []; 11 const maximum = Number(item.max_sell_qty); 12 const stock = Number(item.inventory_amount); 13 14 if (enabled(item.is_sell_quantity) && Number.isFinite(maximum) && maximum > 0) { 15 limits.push(Math.floor(maximum)); 16 } 17 if (enabled(item.is_tracking_inventory) && !enabled(item.enable_out_of_stock_sell)) { 18 limits.push(Number.isFinite(stock) ? Math.max(0, Math.floor(stock)) : 0); 19 } 20 21 return limits.length ? Math.min(...limits) : 9999; 22} 23 24function easystore_getQuantityInputMessage(value, maximum) { 25 const quantity = Number(value); 26 if (String(value).trim() === '' || !Number.isFinite(quantity) || !Number.isInteger(quantity) || quantity < 1) { 27 return Joomla.Text._('COM_EASYSTORE_QUANTITY_INVALID'); 28 } 29 if (quantity > maximum) { 30 return Joomla.Text._('COM_EASYSTORE_MAX_ORDER_QTY').replace('{maxQty}', maximum); 31 } 32 return ''; 33}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.