Changeset 3459658
- Timestamp:
- 02/12/2026 08:34:33 AM (7 days ago)
- Location:
- printess-editor/trunk
- Files:
-
- 3 edited
-
includes/js/printessWoocommerce.js (modified) (3 diffs)
-
printess.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
printess-editor/trunk/includes/js/printessWoocommerce.js
r3459226 r3459658 531 531 let ret = null; 532 532 const attributeLookup = getAttributeLookup(product, true); 533 const variantSpecificValues = [];534 533 const attributeValuesUsedInVariants = {}; 535 534 if (product.variants) { … … 548 547 }); 549 548 } 550 const mapValue = (name, value) => { 551 let mappedValue = value; 552 let attribute = null; 553 if (attributeLookup[name]) { 554 attribute = attributeLookup[name]; 555 } 556 if (!attribute) { 557 for (const key in attributeLookup) { 558 if (attributeLookup.hasOwnProperty(key)) { 559 if (attributeLookup[key].name === key || attributeLookup[key].key === key) { 560 attribute = attributeLookup[key]; 561 break; 562 } 563 } 564 } 565 if (attribute && attribute.valueKeys && attribute.valueKeys.length > 0) { 566 for (let i = 0; i < attribute.values.length; ++i) { 567 if (attribute.values[i] === value && attribute.valueKeys.length > i) { 568 mappedValue = attribute.valueKeys[i]; 569 break; 570 } 571 } 572 } 573 } 574 return mappedValue; 575 }; 576 for (const name in productOptionValues) { 577 const value = mapValue(name, productOptionValues[name]); 578 if (productOptionValues.hasOwnProperty(name) && attributeLookup[name] && attributeLookup[name].usedForVariants && attributeValuesUsedInVariants[attributeLookup[name].key] && attributeValuesUsedInVariants[attributeLookup[name].key][value]) { 579 if (!attributeLookup[name].valueKeys || attributeLookup[name].valueKeys.includes(value)) { 580 variantSpecificValues.push({ key: attributeLookup[name].key, value: value }); 581 } 582 } 583 } 584 if (product.variants) { 585 let variants = product.variants; 586 variantSpecificValues.forEach((vSv) => { 587 variants = variants.filter((variant) => { 588 return variant.attributes[vSv.key] === vSv.value; 589 }); 590 if (variants.length <= 0 && !ret) { 591 ret = vSv.key; 592 } 593 }); 594 } 595 return ret; 549 for (const optionName in productOptionValues) { 550 if (productOptionValues.hasOwnProperty(optionName)) { 551 for (const attributeName in attributeLookup) { 552 if (attributeLookup.hasOwnProperty(attributeName)) { 553 if (optionName === attributeName || optionName === attributeLookup[attributeName].key) { 554 if (!attributeLookup[attributeName].valueKeys.includes(productOptionValues[optionName])) { 555 return optionName; 556 } 557 } 558 } 559 } 560 } 561 } 562 return null; 596 563 }; 597 564 const updatePrintessValues = function (saveToken, thumbnailUrl, designId, designName) { … … 1320 1287 context.lastSaveSaveToken = saveToken; 1321 1288 const productValues = getCurrentProductOptionValues(settings.product); 1322 const unparsedProductValues = removeAttributePrefix(getCurrentProductOptionValues(settings.product, false));1323 1289 const variant = getCurrentVariant(productValues, settings.product); 1324 const checkForValidVariant = getCurrentVariant(unparsedProductValues, settings.product, false); 1325 if (!checkForValidVariant && settings.product.variants && settings.product.variants.length > 0) { 1326 const invalidVariantOptionName = getInvalidVariantOption(unparsedProductValues, settings.product); 1290 if (settings.product.variants && settings.product.variants.length > 0) { 1291 const invalidVariantOptionName = getInvalidVariantOption(productValues, settings.product); 1327 1292 if (invalidVariantOptionName) { 1328 // alert(printessSettings?.userMessages && printessSettings.userMessages["unableToSaveChangesDueToInvalidVariant"] ? printessSettings.userMessages["unableToSaveChangesDueToInvalidVariant"].replace("{0}", invalidVariantOptionName) : ("Unable to save changes due to invalid value for " + invalidVariantOptionName)); 1329 console.warn(printessSettings?.userMessages && printessSettings.userMessages["unableToSaveChangesDueToInvalidVariant"] ? printessSettings.userMessages["unableToSaveChangesDueToInvalidVariant"].replace("{0}", invalidVariantOptionName) : ("Unable to save changes due to invalid value for " + invalidVariantOptionName)); 1330 //return; 1293 let message = printessSettings?.userMessages && printessSettings.userMessages["unableToSaveChangesDueToInvalidVariant"] ? printessSettings.userMessages["unableToSaveChangesDueToInvalidVariant"].replace("{0}", invalidVariantOptionName) : ("Unable to save changes due to invalid value for " + invalidVariantOptionName); 1294 message += "\r\nSaveToken: " + saveToken; 1295 alert(message); 1296 console.log("Current SaveToken: " + saveToken); 1297 return; 1331 1298 } 1332 1299 } -
printess-editor/trunk/printess.php
r3459226 r3459658 5 5 * Plugin URI: https://printess.com/kb/integrations/woo-commerce/index.html 6 6 * Developer: Bastian Kröger ([email protected]); Alexander Oser ([email protected]) 7 * Version: 1.6.8 07 * Version: 1.6.81 8 8 * Author: Printess 9 9 * Author URI: https://printess.com … … 14 14 * Tested up to: 6.9 15 15 * 16 * Woo: 10000:9240 38dfsfhsf8429842386wdff234sfd16 * Woo: 10000:924040dfsfhsf8429842386wdff234sfd 17 17 * WC requires at least: 5.8 18 18 * WC tested up to: 10.4.3 -
printess-editor/trunk/readme.txt
r3459226 r3459658 5 5 Tested up to: 6.9 6 6 WC Tested up to: 10.4.3 7 Stable tag: 1.6.8 07 Stable tag: 1.6.81 8 8 Requires PHP: 8.1 9 9 License: GPLv2 or later … … 393 393 = 1.6.80 = 394 394 - Extended debug code to test invalid page counts when saving designs on buyer side. 395 396 = 1.6.81 = 397 - Now when saving and invalid product variant options are selected, an error will appear that the current state can not ber saved due to errors 398
Note: See TracChangeset
for help on using the changeset viewer.