Announcement

Collapse
No announcement yet.

Images of other products in section

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

    Images of other products in section

    Hi there,
    I have a quandry...

    I am trying to put a list of images on my detail page of other products within the same section as the particular product (I have attached an image to illustrate) Is there a way to do this using the Act_section_Tree.js arrays or any simpler way?

    Thanks in advance

    Garry

    Link to Image

    PS: I have the store set up so that there's a "page of Thumbnail section links" so each product has a page of its own (P24 of advanced user guide)

    #2
    Has anyone any ideas on this as I've been pulling my hair out about it all weekend...?

    Please help a (now) balding and rapidly ageing web designer

    Comment


      #3
      This is a tricky bit of JavaScript that I'm not inclined to write. However this is one approach to take:-

      In your Product Template add some recursive JavaScript that searches the section_tree structure for the .pChild[1].sURL matching the current page name (parsed from location.href()). Now search that level of the tree for all .sImage values and document.write them into your product page.

      Norman
      Norman - www.drillpine.biz
      Edinburgh, U K / Bitez, Turkey

      Comment


        #4
        Thanks Norman,

        I'd half guessed at the logic around the problem, but being a javascript ludite I'm unable to write it. I'm at present working on amending a Act_section_tree.js file to include just the products I need. It's a very bad work around, as when the store changes I'll have to hand code again, however, as there's not too many products in the store it could work for now.

        Having just checked it seems to be working, so I'll post my findings.

        Meanwhile if anyone is able to shed more light on this, it would be most appreciated.

        Garry

        Comment


          #5
          Mmmmmmmmmm

          After another day pondering this one, I'm getting towards a workaround that requires less hard coding.

          The javascript I'm amending runs on an array of ar[i] where it loops through the sections, writing to the page until it finds the end. Now, I've given the variable [i] a definite value based on the section ID of the parent section (this can be worked out by looking at the Act_Section_Tree.js file), I passed this from actinic to each page via a CUSTOMVAR ( I called it ACTSECTID ) so where the 'loop' starts

          for (var i=1;1<=ar.length;i++)

          I substituted

          var=CUTOMVAR:ACTSECTID

          Set up this variable on each product section and it seems to work.

          I hope my rambling's given someone, somewhere, something to go at.

          I'll try and post an updated revision later as I refine this.

          Garry

          Comment


            #6
            Final findings unless anyone can refine this

            Here's the final javascript I amended;
            <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
            <!--
            function SectionList(ar)
            {
            var col = 1;
            var strIDs = '';
            var i=CUSTOMVAR:ACTSECTID
            {
            if (ar[i].sURL !=null)
            {
            strIDs += '';
            {
            if (ar[i].pChild)
            {
            for (var j=1;j<=ar[i].pChild.length;j++)
            {
            if (j <= ar[i].pChild.length)
            {
            strIDs += '<a href=' + ar[i].pChild[j].sURL + '><img src="' + ar[i].pChild[j].sImage + '"alt="'+ ar[i].pChild[j].sName + '" width=' + ar[i].pChild[j].nImageWidth + ' height=' + ar[i].pChild[j].nImageHeight + ' border=0></a>';
            }
            }
            }
            }
            if ( col == 1 )
            {
            strIDs += '';
            col++;
            }
            else
            {
            strIDs += '';
            col = 1;
            }
            }
            }
            if ( col == 1 ) strIDs += '';
            return strIDs + '';
            }
            //-->
            </SCRIPT>

            I amended it from the 'Creating a Section List (With Sub-Sections) in 2 Columns' on page 40 of the AUG. I know it's very messy but as I said I'm a javascript ludite and many of the changes I made gave errors, so I just stripped out the bits that mad the table in the strIDs. If anyone can refine this code it will be appreciated.

            I hope this thread helps and that someone may be able to come up with a better solution in future.

            Regards Garry

            Comment

            Working...
            X