Plugin Directory

Changeset 3455477


Ignore:
Timestamp:
02/06/2026 02:51:56 PM (13 days ago)
Author:
printess
Message:
  • Added error message when clicking on save in case ther current product page does not have a valid variant set (e.g. if there are issues with price relevant form fields)
  • Fixed pager inside the customer view of saved designs so that the next page button is also displayed if the current dispalyed page is larger than 1
Location:
printess-editor/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • printess-editor/trunk/includes/js/printessWoocommerce.js

    r3453876 r3455477  
    512512                ret = variants[0];
    513513            }
     514        }
     515        return ret;
     516    };
     517    const getInvalidVariantOption = function (productOptionValues, product) {
     518        let ret = null;
     519        const attributeLookup = getAttributeLookup(product, true);
     520        const variantSpecificValues = [];
     521        const attributeValuesUsedInVariants = {};
     522        if (product.variants) {
     523            product.variants.forEach((variant) => {
     524                if (variant.attributes) {
     525                    for (const key in variant.attributes) {
     526                        if (variant.attributes.hasOwnProperty(key)) {
     527                            if (!attributeValuesUsedInVariants[key]) {
     528                                attributeValuesUsedInVariants[key] = {};
     529                            }
     530                            attributeValuesUsedInVariants[key][variant.attributes[key]] = true;
     531                        }
     532                    }
     533                }
     534                ;
     535            });
     536        }
     537        const mapValue = (name, value) => {
     538            let mappedValue = value;
     539            let attribute = null;
     540            if (attributeLookup[name]) {
     541                attribute = attributeLookup[name];
     542            }
     543            if (!attribute) {
     544                for (const key in attributeLookup) {
     545                    if (attributeLookup.hasOwnProperty(key)) {
     546                        if (attributeLookup[key].name === key || attributeLookup[key].key === key) {
     547                            attribute = attributeLookup[key];
     548                            break;
     549                        }
     550                    }
     551                }
     552                if (attribute && attribute.valueKeys && attribute.valueKeys.length > 0) {
     553                    for (let i = 0; i < attribute.values.length; ++i) {
     554                        if (attribute.values[i] === value && attribute.valueKeys.length > i) {
     555                            mappedValue = attribute.valueKeys[i];
     556                            break;
     557                        }
     558                    }
     559                }
     560            }
     561            return mappedValue;
     562        };
     563        for (const name in productOptionValues) {
     564            const value = mapValue(name, productOptionValues[name]);
     565            if (productOptionValues.hasOwnProperty(name) && attributeLookup[name] && attributeLookup[name].usedForVariants && attributeValuesUsedInVariants[attributeLookup[name].key] && attributeValuesUsedInVariants[attributeLookup[name].key][value]) {
     566                if (!attributeLookup[name].valueKeys || attributeLookup[name].valueKeys.includes(value)) {
     567                    variantSpecificValues.push({ key: attributeLookup[name].key, value: value });
     568                }
     569            }
     570        }
     571        if (product.variants) {
     572            let variants = product.variants;
     573            variantSpecificValues.forEach((vSv) => {
     574                variants = variants.filter((variant) => {
     575                    return variant.attributes[vSv.key] === vSv.value;
     576                });
     577                if (variants.length <= 0 && !ret) {
     578                    ret = vSv.key;
     579                }
     580            });
    514581        }
    515582        return ret;
     
    12411308                const productValues = getCurrentProductOptionValues(settings.product);
    12421309                const variant = getCurrentVariant(productValues, settings.product);
     1310                if (!variant && settings.product.variants && settings.product.variants.length > 0) {
     1311                    const invalidVariantOptionName = getInvalidVariantOption(productValues, settings.product);
     1312                    if (invalidVariantOptionName) {
     1313                        alert(printessSettings?.userMessages && printessSettings.userMessages["unableToSaveChangesDueToInvalidVariant"] ? printessSettings.userMessages["unableToSaveChangesDueToInvalidVariant"].replace("{0}", invalidVariantOptionName) : ("Unable to save changes due to invalid value for " + invalidVariantOptionName));
     1314                        return;
     1315                    }
     1316                }
    12431317                if (printessSettings.editorMode === "admin") {
    12441318                    saveAdminSaveToken(saveToken, thumbnailUrl);
  • printess-editor/trunk/languages/printess-editor.pot

    r3411102 r3455477  
    44"Project-Id-Version: Printess Editor\n"
    55"Report-Msgid-Bugs-To: \n"
    6 "POT-Creation-Date: 2025-12-04 14:59+0000\n"
     6"POT-Creation-Date: 2026-02-06 14:21+0000\n"
    77"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    88"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    2121msgstr ""
    2222
    23 #: printess.php:2207
     23#: printess.php:2216
    2424msgid "account page"
    2525msgstr ""
     
    4747msgstr ""
    4848
    49 #: printess.php:2154
     49#: printess.php:2163
    5050msgid "Approve and send to production."
    5151msgstr ""
     
    5555msgstr ""
    5656
    57 #: printess.php:3484
     57#: printess.php:3493
    5858msgid "Available until"
    5959msgstr ""
     
    7272msgstr ""
    7373
    74 #: printess.php:2828
     74#: printess.php:2837
    7575msgid "Could not find line item or product..."
    7676msgstr ""
    7777
    78 #: printess.php:565 printess.php:2801
     78#: printess.php:573 printess.php:2810
    7979msgid "Customize"
    8080msgstr ""
     
    101101msgstr ""
    102102
    103 #: printess.php:3484 printess.php:3520
     103#: printess.php:3493 printess.php:3529
    104104msgid "Delete"
    105105msgstr ""
     
    109109msgstr ""
    110110
    111 #: printess.php:1772 printess.php:2008 printess.php:2468 printess.php:3768
     111#: printess.php:1781 printess.php:2017 printess.php:2477 printess.php:3777
    112112msgid "Design Name"
    113113msgstr ""
     
    133133msgstr ""
    134134
    135 #: printess.php:3484
     135#: printess.php:3493
    136136msgid "Display name"
    137137msgstr ""
    138138
    139 #: includes/printess-admin-settings.php:1415
    140 #: includes/printess-product-helpers.php:382
     139#: includes/printess-product-helpers.php:382
     140#: includes/printess-admin-settings.php:1415
    141141msgid "Do not use"
    142142msgstr ""
     
    146146msgstr ""
    147147
    148 #: printess.php:3521
     148#: printess.php:3530
    149149msgid "Do you really want to delete the design {0}?"
    150150msgstr ""
     
    164164msgstr ""
    165165
    166 #: printess.php:2249 printess.php:3484 printess.php:3516 printess.php:3571
     166#: printess.php:2258 printess.php:3493 printess.php:3525 printess.php:3580
    167167msgid "Edit"
    168168msgstr ""
    169169
    170 #: printess.php:2089
     170#: printess.php:2098
    171171msgid "Edit Customer Design"
    172172msgstr ""
    173173
    174 #: printess.php:2079
     174#: printess.php:2088
    175175msgid "Edit save token"
    176176msgstr ""
     
    204204msgstr ""
    205205
    206 #: printess.php:2082
     206#: printess.php:2091
    207207msgid "Expires On:"
    208208msgstr ""
    209209
    210 #: printess.php:2170
     210#: printess.php:2179
    211211msgid "Form field"
    212212msgstr ""
     
    228228msgstr ""
    229229
    230 #: printess.php:2067
     230#: printess.php:2076
    231231msgid "Invalid save token"
    232232msgstr ""
    233233
    234 #: printess.php:3085
     234#: printess.php:3094
    235235msgid "Is merge template"
    236236msgstr ""
     
    256256msgstr ""
    257257
    258 #: printess.php:1776
     258#: printess.php:1785
    259259msgid "Line item id"
    260260msgstr ""
    261261
    262 #: printess.php:2107
     262#: printess.php:2116
    263263msgid "Line item id:"
    264264msgstr ""
    265265
    266 #: printess.php:2915
     266#: printess.php:2924
    267267msgid "Loading editor..."
    268268msgstr ""
     
    284284msgstr ""
    285285
    286 #: printess.php:3542
     286#: printess.php:3551
    287287msgid "Next"
    288288msgstr ""
     
    293293msgstr ""
    294294
    295 #: printess.php:3454
     295#: printess.php:3463
    296296msgid "No saved designs yet"
    297297msgstr ""
    298298
    299 #: printess.php:3405
     299#: printess.php:3414
    300300msgid "Not logged in"
    301301msgstr ""
     
    305305msgstr ""
    306306
    307 #: printess.php:1852
     307#: printess.php:1861
    308308msgid "Open"
    309309msgstr ""
    310310
    311 #: printess.php:1767
     311#: printess.php:1776
    312312msgid "Open design"
    313313msgstr ""
     
    325325msgstr ""
    326326
    327 #: printess.php:2037
     327#: printess.php:2046
    328328msgid "Original Save token:"
    329329msgstr ""
     
    363363msgstr ""
    364364
    365 #: printess.php:1741
     365#: printess.php:1750
    366366msgid "Personalized products"
    367367msgstr ""
    368368
    369 #: printess.php:513
     369#: printess.php:520
    370370msgid "Please close this window or tab."
    371371msgstr ""
    372372
    373 #: printess.php:2206
     373#: printess.php:2215
    374374msgid "Please copy & paste the shop and service tokens from your"
    375375msgstr ""
     
    379379msgstr ""
    380380
    381 #: printess.php:510
     381#: printess.php:517
    382382msgid "Please provide a display name."
    383383msgstr ""
     
    387387msgstr ""
    388388
    389 #: printess.php:3538
     389#: printess.php:3547
    390390msgid "Previous"
    391391msgstr ""
     
    399399msgstr ""
    400400
    401 #: printess.php:2116
     401#: printess.php:2125
    402402msgid "Printess Error Details"
    403403msgstr ""
    404404
    405 #: printess.php:2164
     405#: printess.php:2173
    406406msgid "Printess Form Fields"
    407407msgstr ""
    408408
    409 #: printess.php:2122 printess.php:2130 printess.php:2138
     409#: printess.php:2131 printess.php:2139 printess.php:2147
    410410msgid "Printess Production Files"
    411411msgstr ""
     
    416416msgstr ""
    417417
    418 #: printess.php:2156
     418#: printess.php:2165
    419419msgid "Processing."
    420420msgstr ""
    421421
    422 #: printess.php:1756 printess.php:1923
     422#: printess.php:1765 printess.php:1932
    423423msgid "Product"
    424424msgstr ""
    425425
    426 #: printess.php:3484
     426#: printess.php:3493
    427427msgid "Product name"
    428428msgstr ""
    429429
    430 #: printess.php:1824
     430#: printess.php:1833
    431431msgid "Product thumbnail"
    432432msgstr ""
     
    448448msgstr ""
    449449
    450 #: printess.php:2104
     450#: printess.php:2113
    451451msgid "Reproduce item"
    452452msgstr ""
     
    460460msgstr ""
    461461
    462 #: printess.php:2213
     462#: printess.php:2222
    463463msgid "Save Settings"
    464464msgstr ""
    465465
    466 #: printess.php:2053
     466#: printess.php:2062
    467467msgid "Save token:"
    468468msgstr ""
     
    472472msgstr ""
    473473
    474 #: printess.php:3143 printess.php:3473
     474#: printess.php:3152 printess.php:3482
    475475msgid "Saved Designs"
    476476msgstr ""
     
    480480msgstr ""
    481481
    482 #: printess.php:2914
     482#: printess.php:2923
    483483msgid "Saving design and redirecting back to order detail page..."
    484484msgstr ""
    485485
    486 #: printess.php:512
     486#: printess.php:519
    487487msgid "Saving design to your list of saved designs"
    488488msgstr ""
     
    492492msgstr ""
    493493
    494 #: printess.php:3476
     494#: printess.php:3485
    495495msgid "Search"
    496496msgstr ""
    497497
    498 #: printess.php:3474
     498#: printess.php:3483
    499499msgid "Search for name"
    500500msgstr ""
     
    504504msgstr ""
    505505
    506 #: printess.php:1918
     506#: printess.php:1927
    507507msgid "Shipping"
    508508msgstr ""
    509509
    510 #: printess.php:1653 printess.php:1763 printess.php:1928
     510#: printess.php:1662 printess.php:1772 printess.php:1937
    511511msgid "Shipping status"
    512512msgstr ""
     
    541541msgstr ""
    542542
    543 #: printess.php:3085
     543#: printess.php:3094
    544544msgid "Template name"
    545545msgstr ""
    546546
    547 #: printess.php:3086
     547#: printess.php:3095
    548548msgid "Template name or merge template"
    549549msgstr ""
     
    591591msgstr ""
    592592
    593 #: printess.php:511
     593#: printess.php:518
    594594msgid "There was an error while trying to save your design"
    595595msgstr ""
    596596
    597 #: printess.php:2480
     597#: printess.php:2489
    598598msgid "This item was edited. Consider removing it from your cart."
    599599msgstr ""
    600600
    601 #: printess.php:3484
     601#: printess.php:3493
    602602msgid "Thumbnail"
    603603msgstr ""
     
    607607msgstr ""
    608608
    609 #: printess.php:1632 printess.php:1759 printess.php:1925
     609#: printess.php:1641 printess.php:1768 printess.php:1934
    610610msgid "Tracking"
    611611msgstr ""
    612612
    613 #: printess.php:1616 printess.php:1783 printess.php:1938
     613#: printess.php:1625 printess.php:1792 printess.php:1947
    614614msgid "Tracking link"
     615msgstr ""
     616
     617#: printess.php:521
     618msgid "Unable to save changes due to invalid value for {0}."
    615619msgstr ""
    616620
     
    630634msgstr ""
    631635
    632 #: printess.php:1768
     636#: printess.php:1777
    633637msgid "Valid until"
    634638msgstr ""
    635639
    636 #: printess.php:2171
     640#: printess.php:2180
    637641msgid "Value"
    638642msgstr ""
    639643
    640 #: printess.php:1594
     644#: printess.php:1603
    641645msgid "View thumbnail in new window."
    642646msgstr ""
     
    667671msgstr ""
    668672
    669 #: printess.php:3805
     673#: printess.php:3814
    670674msgid ""
    671675"You just added a personalized product without any personalization. Please "
  • printess-editor/trunk/printess.php

    r3453876 r3455477  
    55 * Plugin URI: https://printess.com/kb/integrations/woo-commerce/index.html
    66 * Developer: Bastian Kröger ([email protected]); Alexander Oser ([email protected])
    7  * Version: 1.6.75
     7 * Version: 1.6.76
    88 * Author: Printess
    99 * Author URI: https://printess.com
     
    1414 * Tested up to: 6.9
    1515 *
    16  * Woo: 10000:924032dfsfhsf8429842386wdff234sfd
     16 * Woo: 10000:924033dfsfhsf8429842386wdff234sfd
    1717 * WC requires at least: 5.8
    1818 * WC tested up to: 10.4.3
     
    518518                "saveError": <?php echo wp_json_encode( __( 'There was an error while trying to save your design', 'printess-editor' ) ); ?>,
    519519                "savingDesign": <?php echo wp_json_encode( __( 'Saving design to your list of saved designs', 'printess-editor' ) ); ?>,
    520                 "closeWindow": <?php echo wp_json_encode( __( 'Please close this window or tab.', 'printess-editor' ) ); ?>
     520                "closeWindow": <?php echo wp_json_encode( __( 'Please close this window or tab.', 'printess-editor' ) ); ?>,
     521                "unableToSaveChangesDueToInvalidVariant": <?php echo wp_json_encode( __( 'Unable to save changes due to invalid value for {0}.', 'printess-editor' ) ); ?>
    521522            };
    522523
     
    35473548            <?php } ?>
    35483549
    3549             <?php if ( 1 === $current_page && count( $saved_designs ) === $per_page ) { ?>
     3550            <?php if ( 1 <= $current_page && count( $saved_designs ) >= $per_page ) { ?>
    35503551                <a class="woocommerce-button woocommerce-button--next woocommerce-Button woocommerce-Button--next button wp-element-button printess-Button-next" href="<?php echo esc_attr( $next_url ); ?>"><?php echo esc_html__( 'Next', 'printess-editor' ); ?></a>
    35513552            <?php } ?>
  • printess-editor/trunk/readme.txt

    r3453876 r3455477  
    55Tested up to: 6.9
    66WC Tested up to: 10.4.3
    7 Stable tag: 1.6.75
     7Stable tag: 1.6.76
    88Requires PHP: 8.1
    99License: GPLv2 or later
     
    377377= 1.6.75 =
    378378 - Fixed bug in save dialog that triggered a considerable amount of add design calls on WooCommerce in case the user pressed enter inside the save dialog instead of clicking on the save button. This could result in older versions being saved and double entries inside the list of saved designs on the user account page.
     379
     380 = 1.6.76 =
     381 - Added error message when clicking on save in case ther current product page does not have a valid variant set (e.g. if there are issues with price relevant form fields)
     382 - Fixed pager inside the customer view of saved designs so that the next page button is also displayed if the current dispalyed page is larger than 1
Note: See TracChangeset for help on using the changeset viewer.