Announcement

Collapse
No announcement yet.

Editing var sImageURL in recentproductssupport.js

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Editing var sImageURL in recentproductssupport.js

    This is a very big site and client uses Sage integration. All the product images are on the server on the Sage directory eg:
    Code:
    \\ABC-6\SageData\company.000\ACCDATA\IMAGES\whatevertheimage.jpg
    Whilst this affects the offline preview when the site is uploaded al the images correctly get carried up to the acatalog folder.

    However in recentproductssupport.js the javascript defines the recently viewed product image as this:
    Code:
    var sImageURL = aRecentItem.sThumb.indexOf("file:///") == 0 ? aRecentItem.sThumb
    : catalogDir + aRecentItem.sThumb; // add catalog path to Image
    such that in the live site the image does not display and if you inspect element the image location is: //ABC-6/SageData/company.000/ACCDATA/IMAGES/whatevertheimage.jpg

    How can I edit 'aRecentItem.sThumb.indexOf("file:///")' so that it gives the image filename as just whatevertheimage.jpg? This would then - with the catalog path added to Image as in the script - display correctly on the live site.

    Thank you
    Jonathan Chappell
    Website Designer
    SellerDeck Website Designer
    Actinic to SellerDeck upgrades
    Graphicz Limited - www.graphicz.co.uk

    #2
    A link to the live site would be useful so we can see what's actually happening.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Hi Norman - Thank you

      https://www.webeg.uk/ajs/index.html

      I will delete this once we have got what we need
      Jonathan Chappell
      Website Designer
      SellerDeck Website Designer
      Actinic to SellerDeck upgrades
      Graphicz Limited - www.graphicz.co.uk

      Comment


        #4
        Missing product images on nearly everything. E.g. https://www.webeg.uk/ajs/acatalog/Ot...are-Parts.html all images missing.
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          Yes because they are all referenced from Sage so don't come over in the snap so are not on my test site.

          However on his live site whilst all the images upload corectly to acatalog and display proper;y, the recent products javascript still use the full link as entered in product details.

          Additional complication is that he is turning off recent products on his live site until I have a solution - so cannot show you!

          Image from live site:

          Click image for larger version

Name:	recentviewedlivesite.jpg
Views:	144
Size:	227.7 KB
ID:	553797
          Jonathan Chappell
          Website Designer
          SellerDeck Website Designer
          Actinic to SellerDeck upgrades
          Graphicz Limited - www.graphicz.co.uk

          Comment


            #6
            Try this:

            In layout Save Recent Product Details - Product Image
            Replace both occurrences of:
            Code:
            echo str_replace('\\', '/', '<actinic:variable encoding="perl" name="ProductImageFileName" selectable="false" />');
            With:
            Code:
            echo basename('<actinic:variable encoding="perl" name="ProductImageFileName" selectable="false" />');
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment


              #7
              Thank you Norman - I haven't made it work yet. I will try on the live site.

              In an earlier version of the site I found this:

              Code:
              $filename = '<actinic:variable encoding="perl" name="ProductImageFileName" selectable="false" />';
              echo pathinfo($filename)['filename']; // "file"
              echo '.';
              echo pathinfo($filename)['extension']; // "ext"

              Is this one of your solutions?
              Jonathan Chappell
              Website Designer
              SellerDeck Website Designer
              Actinic to SellerDeck upgrades
              Graphicz Limited - www.graphicz.co.uk

              Comment


                #8
                Not from me by the look of it. The basename function does the same thing in 1 statement instead of 4 lines.
                Norman - www.drillpine.biz
                Edinburgh, U K / Bitez, Turkey

                Comment


                  #9
                  Your solution does work - of course! I was prey to a Sellerdeck oddity. Whatever I changed the "Save Recent Product Details - Product Image" to and refreshed the recent products still had the erroneous image link.

                  I disabled Recent Products in Marketing, Recent Products and refreshed. I did Ctrl+F5 and still the recent products were displayed with the the erroneous image link.

                  I viewed in a different browser that had not viewed the site and there were no recent products. I enabled recent products and refreshed and did Ctrl+F5 in this new browser and recent products started to appear with the corrected image URL.

                  Thank you!

                  Sellerdeck seems to 'hang on' to recent products data and doesn't let go through site and browser refresh!
                  Jonathan Chappell
                  Website Designer
                  SellerDeck Website Designer
                  Actinic to SellerDeck upgrades
                  Graphicz Limited - www.graphicz.co.uk

                  Comment


                    #10
                    This is because 'Recently Viewed' are held in a Cookie so as long as the Cookie exists so will the recent products. This from the AUG:

                    This is set in layout Recent Products List – Configuration Details'
                    To change the length of time for which the list is remembered, find the following statement:
                    var nKeepRecentHours = 12;
                    and change '12' to the length of time you want, in hours.
                    Jonathan Chappell
                    Website Designer
                    SellerDeck Website Designer
                    Actinic to SellerDeck upgrades
                    Graphicz Limited - www.graphicz.co.uk

                    Comment


                      #11
                      You can either delete the cookie or view some products to push the old ones out.
                      Norman - www.drillpine.biz
                      Edinburgh, U K / Bitez, Turkey

                      Comment


                        #12
                        Here is a replacement for layout Save Recent Product Details - Product Image that should also allow for local preview of these network images.
                        Code:
                        <actinic:block if="%3cactinic%3avariable%20name%3d%22IsProductVisible%22%20%2f%3e%20%26%26%20%28%3cactinic%3avariable%20name%3d%22ProductImageFileName%22%20%2f%3e%20%21%3d%20%22%22%29" >
                        	<script type="text/javascript">
                        		SaveRecentProduct('<actinic:block if="%3cactinic%3avariable%20name%3d%22IsDuplicateIndexed%22%20%2f%3e"><actinic:variable name="ProductID" encoding="perl" selectable="false" /></actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22IsDuplicateIndexed%22%20%2f%3e%20%3d%3d%20false"><actinic:variable name="ProductReference" encoding="perl" selectable="false" /></actinic:block>', '<actinic:variable name="ProductName" encoding="perl" selectable="false" />',
                        			<actinic:block php="true" encoding="perl" selectable="false">
                        				echo trim('\'<actinic:block type="PriceList"><actinic:block if="%3cactinic%3avariable%20name%3d%22ListIndex%22%20%2f%3e%20%3d%3d%201"><actinic:block if="%3cactinic%3avariable%20name%3d%22RecentProductsShowIncTax%22%20%2f%3e"><actinic:variable name="PreFormattedPrice" value="Product Price Including Tax" /></actinic:block><actinic:block if="%21%20%3cactinic%3avariable%20name%3d%22RecentProductsShowIncTax%22%20%2f%3e" ><actinic:variable name="PreFormattedPrice" value="Product Price Excluding Tax" /></actinic:block></actinic:block></actinic:block>\',\'');
                        				$pimg = '<actinic:variable encoding="perl" name="ProductImageFileName" selectable="false" />';
                        				echo ( (<Actinic:Variable Name="IsPreviewMode" selectable="false" /> ?  preg_replace('/^\/\/\/*/', 'file://///', str_replace('\\', '/', $pimg)) : basename($pimg)) );
                        			</actinic:block>');	
                        	</script>
                        </actinic:block>
                        Last edited by NormanRouxel; 05-Mar-2021, 06:57 PM. Reason: Updated for robustness
                        Norman - www.drillpine.biz
                        Edinburgh, U K / Bitez, Turkey

                        Comment


                          #13
                          And for completeness (in case SellerDeck want to make this a permanent fix) here are the new versions of :

                          Save Recent Product Details - Extended Info Image
                          Code:
                          <actinic:block if="%3cactinic%3avariable%20name%3d%22IsProductVisible%22%20%2f%3e%20%26%26%20%28%3cactinic%3avariable%20name%3d%22ProductImageFileName%22%20%2f%3e%20%21%3d%20%22%22%29" >
                          	<script type="text/javascript">
                          		SaveRecentProduct('<actinic:block if="%3cactinic%3avariable%20name%3d%22IsDuplicateIndexed%22%20%2f%3e"><actinic:variable name="ProductID" encoding="perl" selectable="false" /></actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22IsDuplicateIndexed%22%20%2f%3e%20%3d%3d%20false"><actinic:variable name="ProductReference" encoding="perl" selectable="false" /></actinic:block>', '<actinic:variable name="ProductName" encoding="perl" selectable="false" />',
                          			<actinic:block php="true" encoding="perl" selectable="false">
                          				echo trim('\'<actinic:block type="PriceList"><actinic:block if="%3cactinic%3avariable%20name%3d%22ListIndex%22%20%2f%3e%20%3d%3d%201"><actinic:block if="%3cactinic%3avariable%20name%3d%22RecentProductsShowIncTax%22%20%2f%3e"><actinic:variable name="PreFormattedPrice" value="Product Price Including Tax" /></actinic:block><actinic:block if="%21%20%3cactinic%3avariable%20name%3d%22RecentProductsShowIncTax%22%20%2f%3e" ><actinic:variable name="PreFormattedPrice" value="Product Price Excluding Tax" /></actinic:block></actinic:block></actinic:block>\',\'');
                          				$pimg = '<actinic:variable name="ExtendedInfoImage" encoding="perl" selectable="false" />';
                          				echo ( (<Actinic:Variable Name="IsPreviewMode" selectable="false" /> ?  preg_replace('/^\/\/\/*/', 'file://///', str_replace('\\', '/', $pimg)) : basename($pimg)) );
                          			</actinic:block>');	
                          	</script>
                          </actinic:block>

                          Save Recent Product Details - Thumbnail Image
                          Code:
                          <actinic:block if="%3cactinic%3avariable%20name%3d%22IsProductVisible%22%20%2f%3e%20%26%26%20%28%3cactinic%3avariable%20name%3d%22ProductImageFileName%22%20%2f%3e%20%21%3d%20%22%22%29" >
                          	<script type="text/javascript">
                          		SaveRecentProduct('<actinic:block if="%3cactinic%3avariable%20name%3d%22IsDuplicateIndexed%22%20%2f%3e"><actinic:variable name="ProductID" encoding="perl" selectable="false" /></actinic:block><actinic:block if="%3cactinic%3avariable%20name%3d%22IsDuplicateIndexed%22%20%2f%3e%20%3d%3d%20false"><actinic:variable name="ProductReference" encoding="perl" selectable="false" /></actinic:block>', '<actinic:variable name="ProductName" encoding="perl" selectable="false" />',
                          			<actinic:block php="true" encoding="perl" selectable="false">
                          				echo trim('\'<actinic:block type="PriceList"><actinic:block if="%3cactinic%3avariable%20name%3d%22ListIndex%22%20%2f%3e%20%3d%3d%201"><actinic:block if="%3cactinic%3avariable%20name%3d%22RecentProductsShowIncTax%22%20%2f%3e"><actinic:variable name="PreFormattedPrice" value="Product Price Including Tax" /></actinic:block><actinic:block if="%21%20%3cactinic%3avariable%20name%3d%22RecentProductsShowIncTax%22%20%2f%3e" ><actinic:variable name="PreFormattedPrice" value="Product Price Excluding Tax" /></actinic:block></actinic:block></actinic:block>\',\'');
                          				$pimg = '<actinic:variable name="ProductThumbnailImageFileName" encoding="perl" selectable="false" />';
                          				echo ( (<Actinic:Variable Name="IsPreviewMode" selectable="false" /> ?  preg_replace('/^\/\/\/*/', 'file://///', str_replace('\\', '/', $pimg)) : basename($pimg)) );
                          			</actinic:block>');	
                          	</script>
                          </actinic:block>
                          Last edited by NormanRouxel; 05-Mar-2021, 06:58 PM. Reason: Updated for robustness
                          Norman - www.drillpine.biz
                          Edinburgh, U K / Bitez, Turkey

                          Comment


                            #14
                            Thank you Norman. Best wishes.
                            Jonathan Chappell
                            Website Designer
                            SellerDeck Website Designer
                            Actinic to SellerDeck upgrades
                            Graphicz Limited - www.graphicz.co.uk

                            Comment

                            Working...
                            X