Announcement

Collapse
No announcement yet.

Highlight Searched for Product

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

    Highlight Searched for Product

    I am trying, in Ver 8, to highlight the product that has been selected for a search result page.
    We were doing this in ver 7 uisng a little bit of Java script

    Code:
    <script language=JavaScript>
    <!--
    if ( location.href.search(/&PN=.*#NETQUOTEVAR:PRODUCTANCHOR/) > -1 ) 
      {
      document.write('<tr bgcolor="white">');
      }
    else
      {
      document.write('<tr>');
      }
    // -->
    </script>
    <noscript><tr></noscript>
    But can not get it to work in ver 8 - I know the netquotevar etc have all gone and I guess I should be able to adapt the above code or to use a Block statement.

    I did try and replace the NETQUOTEVAR:PRODUCTANCHOR with ProductReference but it did not seem to work. Should it?

    How can I therefore find/extract the # (anchor) text from the url to compare against the ProductReference in Ver 8.

    I would guess any fix for ver 8 would also apply to 9 and 10 now.
    David Cunningham

    www.truska.com
    -----------------------------
    ECommerce (SellerDeck) & Web Design, Hosting, Search Engine Optimisation, Social Media and Remote Backup (Truska Backup)

    #2
    Not enough info! Where do you use the JavaScript? Search results? Product layout? Somewhere else?
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Guessing that you have multi products per page and want to highlight the one linked to from the Search results, the try this.

      Edit your Product Layout(s) and put at the top:
      Code:
      <div id="prod_<actinic:variable name="EncodedProductAnchor" />">
      and at the bottom put:
      Code:
      </div>
      In your Overall Layout, at the bottom, just above the </body> tag put:
      Code:
      <script type="text/javascript">
      var prodid = document.getElementById('prod_' + location.hash.substring(1));
      if ( prodid ) prodid.style.backgroundColor = '#cccccc';
      </script>
      Norman - www.drillpine.biz
      Edinburgh, U K / Bitez, Turkey

      Comment


        #4
        Norman

        You are exactly right in what you assume I am doing - I will try this out later when back in office and let you know - In the meantime Thank you...
        David Cunningham

        www.truska.com
        -----------------------------
        ECommerce (SellerDeck) & Web Design, Hosting, Search Engine Optimisation, Social Media and Remote Backup (Truska Backup)

        Comment


          #5
          Norman - Thanks for that but I am having a problem making it work.

          Did what you suggested and when it did not work I played about and tried to break it down a bit but my limited technical skills could not get it resolved.

          There is no style or bgcolor setting inside any of the table settings for the product to override the div in any way.

          Is the backgroundcolor style meant to override/insert it self into the <TR> and or <TD> tags.
          When I show the value of <actinic:variable name="EncodedProductAnchor" /> it is always the current product.

          I have a test url with a few products on it at
          http://microaid.truska.co.uk/acatalog/index.html
          and your suggested code is implemented on this- a good search to test it on is "acer laptop"

          Not sure what/where I am going wrong with this as it all looks so simple.

          Any advise appreciated

          Thanks
          David Cunningham

          www.truska.com
          -----------------------------
          ECommerce (SellerDeck) & Web Design, Hosting, Search Engine Optimisation, Social Media and Remote Backup (Truska Backup)

          Comment


            #6
            Your product layouts are old style table based ones and are a mess. Invalidly nested TD and TR tags. Here's a bit of generated code indented for readability:
            Code:
            <table border="0" cellpadding="0" cellspacing="0" width="570">
            	<tr>
            		<td valign="top">
            			<div id="prod_a1132973"> 
            				<tr>
            					<td width="50" rowspan="2">
            					</td>
            					<td valign="TOP" align="LEFT" colspan="2">
            						Encoded Product Anchor = a1132973
            						<br>
            						<a name="a1132973"><span class="actregular"><b>Midrange CAspire e Prestige Line</b></span></a>
            						<br>
            						<span class="actxsmall"> Ref: 1132973<br> P9.0514C.A13&nbsp;</span>
            						<br>
            						<span class="actxsmall"></span>
            						<br>
            						<b><b>
            						<br />
            						<span class="actregular">Price:</span><span class="actregular"> €26.90</span><span class="actxxsmall"> (€32.55 Including VAT at 21%)</span></b></b>
            						<br>
            						<span class="actxsmall">   </span><span class="actxsmall"></span><span class="actxsmall"></span>
            					</td>
            					<td align="LEFT" colspan="2">
            						<span class="actxsmall"><Actinic:CartError_List/><input type="hidden" name="Q_1132973"  value="1" />
            						<br>
            						<p>
            						<input type="submit" value="Add To Cart" name="_1132973" /></span>
            					</td>
            				</tr>
            			</div>
            		</td>
            	</tr>
            	<tr>
            		<td valign="top">
            The TR's marked in red are invalid. TR's can only follow TABLE or /TR.

            Also you cannot have TD's in sequence (highlighted in blue). TD must match with /TD before you start another TD.

            Once you've fixed that you should delete the <div id="prod_<actinic:variable name="EncodedProductAnchor" />"> and the </div>.

            Then locate the code:
            Code:
            <td valign="top">
            and amend it to be
            Code:
            <td id="prod_<actinic:variable name="EncodedProductAnchor" />" valign="top">
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment


              #7
              I'm also wondering if you accidentally deleted a TABLE and /TABLE when you put in the DIV and /DIV. Replacing DIV and /DIV with TABLE and /TABLE might create clean HTML.

              E.g.
              Code:
              <table border="0" cellpadding="0" cellspacing="0" width="570">
              	<tr>
              		<td valign="top">
              			<table id="prod_a1132973"> 
              				<tr>
              					<td width="50" rowspan="2">
              					</td>
              					<td valign="TOP" align="LEFT" colspan="2">
              						Encoded Product Anchor = a1132973
              						<br>
              						<a name="a1132973"><span class="actregular"><b>Midrange CAspire e Prestige Line</b></span></a>
              						<br>
              						<span class="actxsmall"> Ref: 1132973<br> P9.0514C.A13&nbsp;</span>
              						<br>
              						<span class="actxsmall"></span>
              						<br>
              						<b><b>
              						<br />
              						<span class="actregular">Price:</span><span class="actregular"> €26.90</span><span class="actxxsmall"> (€32.55 Including VAT at 21%)</span></b></b>
              						<br>
              						<span class="actxsmall">   </span><span class="actxsmall"></span><span class="actxsmall"></span>
              					</td>
              					<td align="LEFT" colspan="2">
              						<span class="actxsmall"><Actinic:CartError_List/><input type="hidden" name="Q_1132973"  value="1" />
              						<br>
              						<p>
              						<input type="submit" value="Add To Cart" name="_1132973" /></span>
              					</td>
              				</tr>
              			</table>
              		</td>
              	</tr>
              	<tr>
              		<td valign="top">
              Looks valid HTML and also contains the ID code needed for the highlight to work.
              Norman - www.drillpine.biz
              Edinburgh, U K / Bitez, Turkey

              Comment


                #8
                Norman

                Thanks - the code is all ver 7 and probably earlier - I have just got involved and the client had, but had not user, a ver 8 license so I upgraded him and introduced a new theme.
                With this - and quite a few other odd happenings, I am nearly regretting it - but I quote him a price and guess I now have to deliver.....

                We have had serious other issues today involving not accepting cvv nunbers which have taken priority so I hope to get to this soon, once other issues resolved.... So thanks for your rapid reply - I will get to dealing with this as son as I can - will update you on the result - I think I now know where I am going...
                David Cunningham

                www.truska.com
                -----------------------------
                ECommerce (SellerDeck) & Web Design, Hosting, Search Engine Optimisation, Social Media and Remote Backup (Truska Backup)

                Comment


                  #9
                  Norman

                  Working ion test site - great and thanks

                  Yes the code was up the left a bit and checking back to ver 7 it was also bad but it looks like I did not help it. Although with what was there in v7 it still would not have worked is my guess.

                  Important thing it seems to be OK now and I will apply it to live site later today - there or well over 25k products on site and updates take over an hour so we gather up a few changes before updating each time.

                  Actinic is only tested to support 20k products - have you experience of larger sites - it is part of the equation of the next step for this client Actinic v10 or a bespoke/an other system? and he wants to add images to about 70% of the products thus making it even bigger - any guidance from others experience most welcome - would love to keep him on Actinic if it is not going to cots more in support and hassle to do so...

                  Again Thanks for your help in this one - I really should have seen the problems first time myself...
                  David Cunningham

                  www.truska.com
                  -----------------------------
                  ECommerce (SellerDeck) & Web Design, Hosting, Search Engine Optimisation, Social Media and Remote Backup (Truska Backup)

                  Comment

                  Working...
                  X