4 Replies Latest reply: Jul 19, 2013 2:55 AM by displaythis RSS

    <td class="productItemNotFound">This catalog has no products.</td>

    displaythis Community Member

      Has anyone been able to change the wording of "This catalogue has no products" ?

       

      Found some good references from mario

      http://forums.adobe.com/docs/DOC-1808

       

      But does not address the above !

       

      Call out to clever JS folks

        • 1. Re: <td class="productItemNotFound">This catalog has no products.</td>
          thetrickster888 Community Member

          Hey man--

           

          You can do this with a simple Regular Expression and some jQuery that looks for all text within your site or a certain element and replaces it with your own text.

           

          Here's the javascript you can add to the end of your page near the closing </body> tag or in another javascript file you're already referencing. It must be included after jQuery is loaded on the page. You can include it in the HEAD of your page template if you wish but it must follow the jQuery library reference.

           

          I'm using a site that has US (English) as the culture/language so my "catalogue" is spelled "catalog".. Just update the code below to match your version of catalogue. Also, I'm searcing the whole "body" element but you can be more specific if you wish. You can change the references to "body" to something else like "#content" or ".shop-layout" or whatever container has your text somewhere as child text node.

           

          (function($){
              $(document).ready(function() {
                  var noProductsMessage = "Your no products message";
                  // You can use HTML markup if you escape quotes with a backslash 
                  // or if you use single quotes in HTML markup
                  var noSubCatalogMessage = "Your no subcatalogs message";
                  
                 // Update "This catalog has no products." message
                 $("body").html(
                     $("body").html()
                     // Update "This catalog has no products." message
                     .replace(/this catalog has no products\./gi, noProductsMessage)
          
                     // Update "This catalog has no sub-catalogs." message
                     .replace(/this catalog has no sub-catalogs\./gi, noSubCatalogMessage)
                 ); 
              });
          })(jQuery);
          

           

          You'll notice the .replace() function uses the Regular expression.. you can update what's in between the /  and \./gi to match the text you want to replace.  It doesn't matter about capital letters since this RegEx works with all cases.  You'll also notice I'm escaping the period: \.

           

          Periods are special characters in RegEx that means "any character" so if you just use /this catalog has no products./gi it will still match the period but i'm telling this regex to specifically match a period not any character.

           

          You can replace the variables with your messages and I added one for the "no sub-catalogs" message too since you'll likely want that as well. If you don't want to use it-- comment out that line by throwing a // in front of that line of js.

           

          Best of luck. Here's the fiddle of it in action so you can play around with it and update catalog to catalogue if you need to: http://jsfiddle.net/thetrickster/k35qV/

          • 2. Re: <td class="productItemNotFound">This catalog has no products.</td>
            displaythis Community Member

            Is it a bord - is it a plane - No its Super Trickster888. I will read in detail tomorrow -eyes closing

             

            Thanks again

            • 4. Re: <td class="productItemNotFound">This catalog has no products.</td>
              displaythis Community Member

              Sorry its was late - its the superman say - is it a bird ! is it a plane !...