Announcement

Collapse
No announcement yet.

Image path for related products outside Sellerdeck managed from Sage

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

    Image path for related products outside Sellerdeck managed from Sage

    Client uses Sage to manage his products.
    He enters product images as:
    Code:
    //AJS-6/SageData/company.000/ACCDATA/IMAGES/HC125M.jpg
    for example.

    It is the following that appears in the 'related products' image.

    Code:
    <a href="https://www.xxxx-shop.co.uk/cgi-bin/ss000001.pl?PRODREF=HC125M&NOLOGIN=1"><img src="//AJS-6/SageData/company.000/ACCDATA/IMAGES/HC125M.jpg" alt="xxxx" width="75" border="0"></a>
    Images in other marketing lists are displayed correctly.

    Is there some sort of mod rewrite for the 'related product' javascript or htaccess fix to remove the
    Code:
    //AJS-6/SageData/company.000/ACCDATA/IMAGES/
    and just leave the file name so the image displays correctly?

    Thank you!


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

    #2
    Sorry, I have not touched Sage in 15 years since I was asked to help with problems that brought staff to tears trying to figure it all out. Nasty herb that one, all I can say is good luck matey.

    https://docs.microsoft.com/en-us/win...commands/subst

    Comment


      #3
      Tee hee! I am not involved in the vagueries of Sage, it is really asking if anyone can do a mod rewrite or similar within Sellerdeck. Although the client is having troubles dragging orders into Sage as they don't bring the bank account code with them! Fortunately I am leaving that to SD support!
      Jonathan Chappell
      Website Designer
      SellerDeck Website Designer
      Actinic to SellerDeck upgrades
      Graphicz Limited - www.graphicz.co.uk

      Comment


        #4
        I have fixed with thanks to:

        https://www.abeautifulsite.net/php-f...-from-a-string

        Save a copy of:
        '
        'Save Recent Product Details - Product Image'

        for backup.

        Then edit 'Save Recent Product Details - Product Image' thus:

        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">
            <actinic:block if="%3cactinic%3avariable%20name%3d%22IsDuplicateIndexed%22%20%2f%3e" >
                SaveRecentProduct('<actinic:variable name="ProductID" encoding="perl" selectable="false" />', '<actinic:variable name="ProductName" 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>');</actinic:block>', '<actinic:block php="true" encoding="perl" selectable="false">
        $filename = '<actinic:variable encoding="perl" name="ProductImageFileName" selectable="false" />';
        echo pathinfo($filename)['filename']; // "file"
        echo '.';
        echo pathinfo($filename)['extension']; // "ext"
        </actinic:block>');
            </actinic:block>    
            <actinic:block if="%3cactinic%3avariable%20name%3d%22IsDuplicateIndexed%22%20%2f%3e%20%3d%3d%20false" >
                SaveRecentProduct('<actinic:variable name="ProductReference" />', '<actinic:variable name="ProductName" 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>');</actinic:block>', '<actinic:block php="true" encoding="perl" selectable="false">
        $filename = '<actinic:variable encoding="perl" name="ProductImageFileName" selectable="false" />';
        echo pathinfo($filename)['filename']; // "file"
        echo '.';
        echo pathinfo($filename)['extension']; // "ext"
        </actinic:block>');
            </actinic:block>    
            </script>
        </actinic:block>
        Jonathan Chappell
        Website Designer
        SellerDeck Website Designer
        Actinic to SellerDeck upgrades
        Graphicz Limited - www.graphicz.co.uk

        Comment


          #5
          For clarity you change this:

          Code:
          echo str_replace('\\', '/', '<actinic:variable encoding="perl" name="ProductImageFileName" selectable="false" />');
          to this
          Code:
          $filename = '<actinic:variable encoding="perl" name="ProductImageFileName" selectable="false" />';
          echo pathinfo($filename)['filename']; // "file"
          echo '.';
          echo pathinfo($filename)['extension']; // "ext"
          Jonathan Chappell
          Website Designer
          SellerDeck Website Designer
          Actinic to SellerDeck upgrades
          Graphicz Limited - www.graphicz.co.uk

          Comment


            #6
            Much simpler would be to use PHP's basename function which strips everything but the filename and extension out:
            Code:
            <actinic:block php="true">echo basename(str_replace('\\', '/', '<actinic:variable encoding="perl" name="ProductImageFileName" selectable="false" />'));</actinic:block>
            Or forget the surrounding PHP block and use just:
            Code:
            <actinic:variable name="ProductImageFileNameRaw" />
            Or if you want this to work on Preview as well as the live site use:
            Code:
            <actinic:block php="true" encoding="perl" selectable="false">echo ( <actinic:variable name="IsPreviewMode" /> ? str_replace('\\', '/', '<actinic:variable encoding="perl" name="ProductImageFileName" selectable="false" />') : '<actinic:variable name="ProductImageFileNameRaw"encoding="perl" selectable="false" />' );</actinic:block>
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment


              #7
              Wow Norman. Spot on as always! Thank you so much.
              Jonathan Chappell
              Website Designer
              SellerDeck Website Designer
              Actinic to SellerDeck upgrades
              Graphicz Limited - www.graphicz.co.uk

              Comment


                #8
                There is also this in the advanced guide page 27: Stripping Out File Paths from Variables
                Sometimes when a filename variable is used in certain contexts, the entire filepath is displayed online, instead of just the filename.
                In other words, instead of: image.gif ... what actually gets included in the code is:
                C:\My Documements\SellerDeck v11\Sites\Site1\image.gif
                To avoid this, replace the variable in the code e.g.:
                Code:
                <actinic:variable name="VariableName"/>
                ...with the following PHP expression:
                Code:
                <actinic:block php="true">echo basename('<actinic:variablename="VariableName"/>');</actinic:block>

                Comment


                  #9
                  Excellent. Thank you Michael. Looks like I was missing the obvious!
                  Jonathan Chappell
                  Website Designer
                  SellerDeck Website Designer
                  Actinic to SellerDeck upgrades
                  Graphicz Limited - www.graphicz.co.uk

                  Comment

                  Working...
                  X