Announcement

Collapse
No announcement yet.

Custom link to show current section

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

    Custom link to show current section

    Hi,

    I've had a good look through the forum but can't find anyone trying to do this so sorry if it has in fact been asked before...

    I am using the bulleted list output for the top level section list as per p. 38 of the AUG and I want to signify which top level section of the store the user is in. I'll do this by either removing the link entirely or changing the style for it.

    I reckon I can cope with hacking the bullet list javascript to achieve the above - but the problem is I need to know what top level section I'm in first! If I can tell this then I should be able to check for a match and change my link accordingly.

    I've poked around but can't seem to find a NETQUOTEVAR that tells me the top level section - any ideas, or am I barking up the wrong tree entirely?

    Thanks in advance.

    #2
    Solved!

    Think I've got round this - so far so good anyway! Here's how I did it in case anyone wants to achieve something similar:

    1. you need to set a CUSTOMVAR in Actinic, Advanced -> Custom Properties. I have called mine 'SECTIONWHERE'. Give it a type of 'text'

    2. got to each of your top level catalogue pages and add the CUSTOMVAR in the Properties tab. Make the value the same as your section name, tick 'searchable' and 'use as CUSTOMVAR'

    3. Add this customised version of the bulleted list (p.38 AUG) into Act_Primary.html

    Code:
    <!--@act NETQUOTEVAR:TOPLEVELSECTIONS_RAW -->
    <script language = JavaScript>
    <!--
    function BulletList(pItem) {
    	//set up vars
    	var strIDs = '<ul>';
    	var whereAmI = 'CUSTOMVAR:SECTIONWHERE';
    	
    		//make up our list items
    		for (var i = 1; i <= pItem.length; i++) {
    			//if the section name is the same as var whereAmI, chang the styling of the list element
    			if (pItem[i].sName == whereAmI) {
    			strIDs += '<li class=\"on\"><a href=' + pItem[i].sURL + '>'+ pItem[i].sName + '</a></li>\n';
    			} else {
    			strIDs += '<li><a href=' + pItem[i].sURL + '>'+ pItem[i].sName + '</a></li>\n';
    			}
    		}
    	//finish off the unordered list code
    	strIDs += '</ul>'
    
    	//print an alert - for debug, uncomment at will
    	//alert (strIDs)
    	
    	//write the unorderd list to the browser
    	return (strIDs);
    }
    -->
    </script>
    4. Set up your 'on' class in actinic.css, for example:
    Code:
    .on {
    background-color: #FF0000;
    color: #FFFFFF;
    }
    5. Check and test!

    Comment

    Working...
    X