Announcement

Collapse
No announcement yet.

An easy way of having a multi-column layout.

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

    An easy way of having a multi-column layout.

    Code:
    Auto Multi Columns.   
    This readme will allow you to lay products out in any number of columns.
    The number of columns can be easily altered by setting a Custom Property.
    
    This uses JavaScript but will fail-safe on Non-JavaScript browsers by displaying a single product per row.
    
    INSTRUCTIONS
    
    Replace Act_ProductBody.html with the following:-
    
    
    
    <!-- ProductBody HTML begin -->
    <!-- Insert HTML for the top of the product body -->
    
    <script language=JavaScript>
    <!--
    var currentcol = 0;
    var colwidth = Math.floor(100 / CUSTOMVAR:NUMCOLS);
    // -->
    </script>
    
    <div align="right"><a name="sectiontop">
    NETQUOTEVAR:PARENTSECTIONSTOP
    </a><a name="sectiontop">
    <!-- NETQUOTEVAR:TOPLEVELSECTIONSTOP -->
    NETQUOTEVAR:SECTIONLISTTOP
    NETQUOTEVAR:TOPSECTIONSEPARATOR
    NETQUOTEVAR:CARTERRORLISTXML
    </a>
    NETQUOTEVAR:HIDDENINPUT
    
    <BR>
    
      <TABLE WIDTH="500" COLS="3" BORDER="0" CELLPADDING="10" CELLSPACING="0" ALIGN="CENTER">
    
    	NETQUOTEVAR:PRODUCTBULK
    
    <script language=JavaScript>
    <!--
    if ( currentcol != 0 )
     {
     while ( currentcol++ < CUSTOMVAR:NUMCOLS ) document.write('<td width="' + colwidth + '%"></td>');
     document.write('</tr>');
     }
    // -->
    </script>
      </TABLE>
    </div>
    <DIV ALIGN="RIGHT"><a name="sectionbottom">
    NETQUOTEVAR:SINGLEADD
    </a></DIV>
    <a name="sectionbottom">NETQUOTEVAR:BOTTOMSECTIONSEPARATOR
    NETQUOTEVAR:SECTIONLISTBOTTOM
    <!-- NETQUOTEVAR:TOPLEVELSECTIONSBOTTOM -->
    </a>
    <!-- <DIV ALIGN="CENTER"><a name="sectionbottom">
    NETQUOTEVAR:PARENTSECTIONSBOTTOM
    </a></DIV> -->
    <!-- Insert HTML for the bottom of the product body -->
    <!-- ProductBody HTML end -->
    
    
    
    
    Replace Act_ProductLine.html with the following:
    
    
    
    
    <!-- ProductLine HTML begin -->
    <!-- Insert HTML for the top of the individual product -->
    <!-- NETQUOTEVAR:INCLUDE Act_ProductSeparator.html -->
    NETQUOTEVAR:ENDSEPARATOR
    NETQUOTEVAR:PRODUCTFORMBEGIN
    <script language=JavaScript>
    <!--
    if ( currentcol++ == 0 ) document.write('<tr><td colspan=3><table border=0><tr>');
    document.write('<td width="' + colwidth + '%" valign=top>');
    // -->
    </script>
    <noscript><tr><td width="100%"></noscript>
      <!-- START each product lives in this table - alter below to rearrange items -->
      <table width="100%">
       <tr>
        <td colspan=2>
          <a name="NETQUOTEVAR:PRODUCTANCHOR"><span class="actregular"><b>NETQUOTEVAR:PRODUCTNAME</b></span></a>
          <span class="actxsmall">NETQUOTEVAR:PRODUCTREF
        </td>
       </tr>
       <tr>
        <td valign="TOP" align="CENTER"> NETQUOTEVAR:TEMPLATEBEGINXML NETQUOTEVAR:PRODUCTIMAGE </td>
        <td valign="TOP">  
          NETQUOTEVAR:EXTINFOLINK</span>NETQUOTEVAR:EXTINFOBUTTON
          <br>
          <span class="actxsmall">NETQUOTEVAR:PRODUCTBEGINLINKNETQUOTEVAR:PRODUCTLINKTEXTNETQUOTEVAR:PRODUCTENDLINK
          NETQUOTEVAR:PRICEEXPLANATION </span><br>
          <b>NETQUOTEVAR:PRODUCTPRICE</b>
        </td>
       </tr>
       <tr>
        <td colspan=2>
         NETQUOTEVAR:PRODUCTDESCRIPTION
         <span class="actxsmall">NETQUOTEVAR:OTHERINFOPROMPT </span>
         <span class="actxsmall">NETQUOTEVAR:DATEPROMPT </span>
        </td>
       </tr>
       <tr>
        <td align="LEFT" colspan="2">
         <span class="actxsmall">
         NETQUOTEVAR:CARTERRORXMLNETQUOTEVAR:PRODUCTQUANTITY<br>
         <Actinic:ACTIONS>NETQUOTEVAR:ADDTOCARTBUTTON</Actinic:ACTIONS>
         </span>
         NETQUOTEVAR:TEMPLATEENDXML
        </td>
       </tr>
      </table>
      <!-- END each product lives in this table - alter above to rearrange items -->
     </td>
    NETQUOTEVAR:PRODUCTFORMEND
    <script language=JavaScript>
    <!--
    if ( currentcol >= CUSTOMVAR:NUMCOLS )
      {
      document.write('</tr></table></td></tr>');
      currentcol = 0;
      }
    // -->
    </script>
    <noscript></tr></noscript>
    
     
    NETQUOTEVAR:NEXT
    <!-- Insert HTML for the bottom of the individual product -->
    <!-- ProductLine HTML end -->
    
    
    
    
    Go into Actinic / Advanced / Custom Properties, click the "+" sign 
    and create a property called NUMCOLS of type text.  OK out.
    
    Go Design / Options / Site Defaults / Properties,  click the "+" sign
    and select NUMCOLS.  Set its value to 3 (for 3 columns, 4 for 4 , etc).
    (if using Business uncheck Searchable and check Use as Customvar)
    OK out.
    
    You can set this value on a per Section basis if required by opening the Section, 
    selecting Properties and setting it as above.
    Norman
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    #2
    Thanks Norman, that's brilliant!

    Do you mind if I turn these into templates and put them on the knowledge base?

    Comment


      #3
      Watch for the smiley in the code
      Owner of a broken heart

      Comment


        #4
        Chris,

        You're welcome to post this.

        The smiley that crept in should be replaced by "D:". If you're able to fix this it would help avoid confustion. I've also attached the readme here. New users should use the attached file.

        It should be pretty robust as it will fail gracefully to a single product per row on non-javascript browsers (anyone here on lynx?).

        Also you can have different number of columns on different pages.

        If you save your original Act_ProductLine.html with a different name (or save mine to a different name) you can have some pages using normal product layout.

        Finally, you could even mix some "normal" full width products at the top of the page and then switch to using multi-column for the rest of the page.

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

        Comment


          #5
          The smiley is now removed. For future reference for others reading this thread, there is 'Disable Smilies In This Post' option underneath where you type your message.

          Comment


            #6
            tables thrown out

            I have just tried this layout and at first it worked great. Until I started adding more products and trying different layouts.

            I am still using the default product pages in actinic business until I get the design how I want it.

            I am using layout 12 in clean layouts

            The only editing to I have made is to change the width of the section 4 (sections list) from 110 to 140 and added a single cell column to give a border to this section

            If you add a new product in the basic products section it throws section 4 out. Products with a range of options/optional extras/built with add ons do the same.
            Select items from a list works fine

            I have tried to play about with the table widths in Act_ProductLine.html to no avail

            I wonder if you could shed any light on this

            Comment


              #7
              I have just tried this layout and at first it worked great. Until I started adding more products and trying different layouts.
              You can only use different layouts for the top products in a section. Once you start using multiple columns you must stay with this template for the rest of the products in a section.

              My readme was for changing the entire site to use multi-column layout by changing the default Product Template.

              If you replace Act_ProductLine.html with my code then that will affect all pages on the site that use this template.

              If you want to have some pages using the original Actinic templates then save my template as (say) Multi_Column_ProductLine.html and use that template as the one for all your products in the section you want to display in columns. Restore your Original Act_ProductLine.html from the appropriate Theme folder.

              You can set the template to use for all products in a section by opening a section, click Advanced / Product and setting Default Layout to ( say) Multi_Column_ProductLine.html.

              If you REALLY want to mix multi-column and other templates in the same page then it can be done. In all your other templates put this bit of JavaScript at the top ( just below the comment lines ).

              Code:
              <script language=JavaScript>
              <!--
              if ( currentcol != 0 )
               {
               while ( currentcol++ < CUSTOMVAR:NUMCOLS ) document.write('<td width="' + colwidth + '%"></td>');
               document.write('</tr></table></td></tr>');
               currentcol = 0;
               }
              // -->
              </script>
              If this doesn't help please post a URL so I can take a look.

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

              Comment


                #8
                Ignore the above bit about patching your other product templates. Here's what to do instead.

                If you REALLY want to mix multi-column and other templates in the same page then it can be done. In Act_ProductSeparator.html put this bit of JavaScript at the top ( just below the comment lines ).


                Code:
                <script language=JavaScript>
                <!--
                if ( currentcol != 0 )
                 {
                 while ( currentcol++ < CUSTOMVAR:NUMCOLS ) document.write('<td width="' + colwidth + '%"></td>');
                 document.write('</tr></table></td></tr>');
                 currentcol = 0;
                 }
                // -->
                </script>
                Norman
                Norman - www.drillpine.biz
                Edinburgh, U K / Bitez, Turkey

                Comment


                  #9
                  For anyone reading this thread I've updated the readme to allow for mixing multi-column and normal templates on the same page. I've also fixed a minon bug (new Act_ProductBody.html code).

                  The new readme is attached here.

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

                  Comment


                    #10
                    Hi Norman

                    Thanks for the reply

                    I actually wanted just 2 coloums on every page

                    Any how this is the url so you can take a lot at what is happening

                    http://www.joandcass.co.uk/acatalog/

                    Thanks

                    Jay

                    Comment


                      #11
                      Hi Norman

                      Ignore my last message i now have it to working fine using your latest post

                      Thanks

                      Jay

                      Comment

                      Working...
                      X