Dépannage : Ajout d'un produit à une liste de présélection

Après la migration de WebSphere Commerce version 7 vers HCL Commerce Version 9.0 ou, HCL Commerce Version 9.1 la fonctionnalité de liste de présélection ne fonctionne pas comme prévu.

Problème

Les utilisateurs enregistrés ne peuvent pas ajouter de produits à une liste de présélection dans un environnement de vitrine migré depuis WebSphere Commerce version 7 vers HCL Commerce Version 9.0 ou HCL Commerce Version 9.1.

Solution

Modifiez les fichiers suivants pour corriger ce problème.
    1. Ouvrez le fichier JavaScript workspace/Stores_v7/WebContent/AuroraStorefrontAssetStore/javascript/Widgets/ShoppingList/ShoppingList.js afin de l'éditer.
    2. Localisez la méthode suivante, this.redirectToSignOn = function () :
      this.redirectToSignOn = function() {
      var href = document.location.href;
      var index = href.lastIndexOf("s", 4);
      if (index != -1){
      var newHref = href;
      }else{
      // Loaded with HTTP
      var newHref = href.substring(0,4) + "s" + (href.substring(4));
      }
      if (newHref.indexOf("?") > -1){
      var reloadURL = newHref + "&";
      }else{
      var reloadURL = newHref + "?";
      }
      
      dojo.cookie("WC_DisplaySignInPanel_"+WCParamJS.storeId, "true" , {path:'/'});
      
      var currentURL = location.href;
      if(true==isGuest){
      currentURL = getAbsoluteURL() + "RESTMoveOrderItem?continue=1&createIfEmpty=1&updatePrices=0&deleteIfEmpty=*&fromOrderId=*&toOrderId=.&page=&calculationUsageId=-1&URL="+encodeURIComponent("RESTOrderCalculate?URL="+encodeURIComponent(currentURL));
      }
      
      document.location.href = reloadURL + "myAcctMain=1&storeId="
      + this.storeParams.storeId + "&catalogId=" + this.storeParams.catalogId
      + "&langId=" + this.storeParams.langId + "&URL=" + encodeURIComponent(currentURL);
      
    3. Remplacez cette méthode par la suivante :
      this.redirectToSignOn = function() {
      // 3 scenario's are possible
      /* 
      *   Scenario 1 - Current Page Loaded with HTTP
      *                In this case, the page will be reloaded with HTTPS and globalLogIn panel is opened up.
      *                GlobalLoginJS.updateGlobalLoginSignInContent does this work and uses WC_RedirectToPage_xxx cookie to
      *                identify the page to display after logIn.
      *   Scenario 2 - Current page is loaded with HTTPS and signIn panel is already loaded.
      *                In this case, before displayiong signIn panel, update the URL field value of the signIn panel form.
      *   Scenario 3 - Current page is laoded with HTTPS, but signIn panel is NOT yet loaded.
      *                Ajax call is made to load the panel. Send reload URL as part of the ajax call, based on WC_RedirectToPage_xxx cookie value.
      */
      var currentURL = document.location.href; 
      var widgetId = 'Header_GlobalLogin'; // This widgetId is defined in Header_UI.jspf / GlobalLoginActions.js / UserTimeoutView.jsp 
      dojo.cookie("WC_RedirectToPage_"+WCParamJS.storeId, currentURL , {path:'/'}); 
      GlobalLoginJS.InitHTTPSecure(widgetId);
      };
      
    4. Enregistrez et fermez le fichier.
    1. Ouvrez le fragment de page de la page du serveur Java workspace/Stores_v7/WebContent/Widgets_701/Common/ShoppingList/ShoppingList_UI.jspf pour l'éditer.
    2. Localisez le bloc de code suivant :
      <div role="menuitem" id="<c:out value="${param.parentPage}"/>ShoppingList_0" class="created_list" 
      onfocus="javascript:shoppingListJS<c:out value="${param.parentPage}"/>.focusList(0);"
      onblur="javascript: this.className = 'created_list';"
      onclick="shoppingListJS<c:out value="${param.parentPage}"/>.redirectToSignOn();">
      <a class="tlignore" id="<c:out value="${param.parentPage}"/>ShoppingListLink_0" href="javascript:shoppingListJS<c:out value="${param.parentPage}"/>.redirectToSignOn();"
      onfocus="javascript:shoppingListJS<c:out value="${param.parentPage}"/>.focusListLink(0);"
      role="menuitem" title="<fmt:message key='SL_SIGN_IN_OR_REGISTER_TO_ACCESS_LIST' bundle='${widgetText}' />"><fmt:message key="SL_SIGN_IN_OR_REGISTER" bundle="${widgetText}" /></a>
      </div>
      
    3. Remplacez-le par ce qui suit :
      <div role="menuitem" id="<c:out value="${param.parentPage}"/>ShoppingList_0" class="created_list"
      onfocus="javascript:shoppingListJS<c:out value="${param.parentPage}"/>.focusList(0);"
      onblur="javascript: this.className = 'created_list';">
      <a class="tlignore" id="<c:out value="${param.parentPage}"/>ShoppingListLink_0" onClick="javascript:shoppingListJS<c:out value="${param.parentPage}"/>.redirectToSignOn();"
      onfocus="javascript:shoppingListJS<c:out value="${param.parentPage}"/>.focusListLink(0);"
      role="menuitem" title="<fmt:message key='SL_SIGN_IN_OR_REGISTER_TO_ACCESS_LIST' bundle='${widgetText}' />"><fmt:message key="SL_SIGN_IN_OR_REGISTER" bundle="${widgetText}" /></a>
      </div>
      
    4. Enregistrez et fermez le fichier.
    1. Ouvrez le fichier JavaScript workspace/Stores_v7/WebContent/Widgets_701/com.ibm.commerce.store.widgets.GlobalLogin/javascript/GlobalLogin.js afin de l'éditer.
    2. Localisez la méthode displayPanel:function(widgetId) :
      displayPanel:function(widgetId){
              //check if the sign in panel is loaded. if loaded, toggle the dropdown. Else, trigger a refresh.
              var domAttr = require("dojo/dom-attr");
              var widgetNode = dojo.byId(widgetId);
              if(widgetNode != null){
                      var panelLoaded = domAttr.get(widgetId, "panel-loaded");
                      if(panelLoaded != null && panelLoaded){
                              this.togglePanel(widgetNode);
                      } else {
                              if(!submitRequest()){
                                     return;
                              }
                              cursor_wait();
                              wc.render.updateContext("GlobalLogin_context",{"displayContract":"false", "widgetId" : widgetId});
                      }
              }
      },
      
    3. Remplacez la méthode par la suivante :
      displayPanel:function(widgetId){
              var redirectToPageName = dojo.cookie("WC_RedirectToPage_" + WCParamJS.storeId);
              //check if the sign in panel is loaded. if loaded, toggle the dropdown. Else, trigger a refresh.
              var domAttr = require("dojo/dom-attr");
              var widgetNode = dojo.byId(widgetId);
              if (widgetNode != null) {
              var panelLoaded = domAttr.get(widgetId, "panel-loaded");
              if (panelLoaded != null && panelLoaded) {
                // Change the URL to display after successfull logOn.
              if (redirectToPageName != null && typeof redirectToPageName != "undefined") {
                var globalLogInForm = document.getElementById(widgetId + "_GlobalLogon");
               if (globalLogInForm != null && typeof globalLogInForm != "undefined") {
               globalLogInForm.URL.value = redirectToPageName;
              dojo.cookie("WC_RedirectToPage_" + WCParamJS.storeId, null, {expires: -1, path: "/"});
              }
               }
              this.togglePanel(widgetNode);
              } else if (typeof isOnPasswordUpdateForm === "undefined" || isOnPasswordUpdateForm == false) {
               if (!submitRequest()) { return; }
              cursor_wait();
              wc.render.updateContext("GlobalLogin_context", { displayContract: "false",  widgetId: widgetId, redirectToPageName: redirectToPageName });
               }
              }
      },
      
    4. Enregistrez et fermez le fichier.
    1. Ouvrez le fichier JavaScript workspace/Stores_v7/WebContent/Widgets_701/com.ibm.commerce.store.widgets.GlobalLogin/javascript/GlobalLoginControllers.js afin de l'éditer.
    2. Localisez la première ligne d'instance du code :
      GlobalLoginJS.displayPanel(dojo.byId(widget.id));
    3. Remplacez la ligne par la suivante :
      GlobalLoginJS.displayPanel(widget.id);
    4. Enregistrez et fermez le fichier.
    1. Ouvrez le fragment de page de la page du serveur Java workspace/Stores_v7/WebContent/Widgets_701/Common/ShoppingList/ShoppingList_Data.jspf pour l'éditer.
    2. Localisez le bloc de code suivant :

      <c:set var="search01" value="'"/>
      <c:set var="search02" value='"'/>
      <c:set var="replaceStr01" value="\\\\'"/>
      <c:set var="replaceStr02" value='\\\\"'/>
      
      <c:set var="escapedSingleQuote" value="\\\\'"/>
      
    3. Remplacez-le par le bloc de code suivant :
      <c:set var="search01" value="'"/>
      <c:set var="search02" value='"'/>
      <c:set var="replaceStr01" value="\\\\'"/>
      <c:set var="replaceStr02" value='\\\\"'/>
      <c:set var="replaceStr001" value="&#039;"/>
      <c:set var="escapedSingleQuote" value="\\\\'"/>
      
    4. Localisez la ligne de code suivante :
      <c:set var="catEntryParams" value="{id: '${uniqueID}', name: '${fn:replace(catalogEntryView.name, search01, replaceStr01)}', image: '${fn:replace(shoppingListImage, search01, replaceStr01)}', type: '${type}', components: {${componentItems}}, skus: [${skus}]}"/>
    5. Remplacez la ligne par le code suivant :
      <c:set var="catEntryParams" value="{id: '${uniqueID}', name: '${fn:replace(catalogEntryView.name, search01, replaceStr001)}', image: '${fn:replace(shoppingListImage, search01, replaceStr01)}', type: '${type}', components: {${componentItems}}, skus: [${skus}]}"/>
    6. Enregistrez et fermez le fichier.
  1. Redémarrez Transaction server.