Announcement

Collapse
No announcement yet.

a freebie: recently viewed items.

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

    a freebie: recently viewed items.

    please be aware that i diddnt really write this, its just common ecommerce code hacked into actinic.

    any changes/improvements would be greatly appreciated

    HTML Code:
    Gabriel Crowe's recently viewed items script
    that was stolen from the web somewhere =>
    
    
    this css goes in your main template header
    (or another appropriate external place)
    =========================================================
    	<style type="text/css">
    		.recently {text-align:center;width:100%;margin:5px;}
    		.recentlyheader {	font-size: 14px; font-weight: bold; text-align: left;color: <actinic:variable name="TextColor" />;	margin: 5px;	padding: 5px;	border-bottom-width: 1px;	border-bottom-style: dotted;	border-bottom-color: <actinic:variable name="Palette3" />;}
    		.recently img {text-decoration:none;width:100px;height:100px;} 
    		.recently a{text-decoration:none;color:<actinic:variable name="TextColor" />;}
    		.viewed{margin-left:0px;float:left;text-align:center;width:130px;}
    		.viewed a:hover{background-color:<actinic:variable name="BGColor" />;}
    		.viewed img {padding:10px;border:2px solid <actinic:variable name="Palette2" />;}
    		.viewed img:hover {background-color:<actinic:variable name="BGColor" />;border:2px solid <actinic:variable name="Palette3" />;}
    	</style>
    =========================================================
    
    
    
    this part goes in the product layout, at the bottom.
    =========================================================
    	<script type="text/javascript">
    		//  Set current item as p0
    			proIMAGE='<actinic:variable name="ProductImageFileName" />';
    			var temp = new String('<Actinic:Variable Name="ProductName"/>');
    			proNAME = temp.replace(/[^a-zA-Z 0-9]+/g,'');
    			var p0=('<div class="viewed"><a href="'+document.URL+'"><img src=\''+proIMAGE+'\' width=75 height=75 /><br/>'+proNAME+'</a></div>');
    		// test to see if p0 is not equal to null and that it does not match any of the other products
    		// p1, p2, p3, or p4 - if all cases are true, set and rotate the cookies. 
    			var p1=getCookie("p1");
    			var p2=getCookie("p2");
    			var p3=getCookie("p3");
    			var p4=getCookie("p4");
    		if(p0 !=null && p0 != p1 && p0 != p2 && p0 != p3 && p0 !=p4){
    			setCookie("p1",p0)
    			setCookie("p2",p1)
    			setCookie("p3",p2)
    			setCookie("p4",p3)
    		}
    	</script>
    =========================================================
    
    
    this part goes at the end of the section that contains products.
    ==================================================================
    <div class="recently">
    	<script type="text/javascript">
    		if (p0){
    		}
    		else {var p0=null;
    		}
    			var p1=getCookie("p1");
    			var p2=getCookie("p2");
    			var p3=getCookie("p3");
    			var p4=getCookie("p4");
    		if(p1){document.write('<div class="recentlyheader">Recently Viewed Items:</div>');}
    		if (p1 !=null) {document.write(p1)}
    		if (p2) {document.write(p2)}
    		if (p3) {document.write(p3)}
    		if (p4) {document.write(p4)}
    
    	</script>
    </div>
    <div style="clear:both;"></div>			
    ==================================================================
    
    
    
    please note that the locations of these items could be out, and that i DID NOT WRITE THIS.
    original from: http://www.jesseo.com/Recently-Viewed-Products.txt
    
    i merely adapted it for Actinic.
    
    Good luck, may the force be with you, always.
    
    - GC
    	http://interact-studio.co.uk/
    Attached Files

    #2
    You take this in your stride fella, well done... again.
    Football Heaven

    For all kinds of football souvenirs and memorabilia.

    Comment


      #3
      demo:

      http://www.asylumunlimited.co.uk/acatalog/Books.html

      the shop is a bit messy, but there are products in there someplace. lol.

      Comment


        #4
        wow...thats not for viewing with a hangover, is it? (not that I have one...just saying, is all LOL)

        Nice one on the code thingie though...
        Can always rely on Gabe to come up with something for every occasion!
        Tracey

        Comment


          #5
          I have an idea, I'll give you a shout later dawg.
          Football Heaven

          For all kinds of football souvenirs and memorabilia.

          Comment


            #6
            kthx colours fixed.

            Comment


              #7
              A couple of notes:

              1) actiniccore.js already contains functions getCookie() and setCookie() that are used by the Cart Summary. I'm not sure if you're intentionally replacing them or not. Probably not as setCookie has a different number of arguments.

              2) The lines
              Code:
              			var temp = new String('<Actinic:Variable Name="ProductName"/>');
              			proNAME = temp.replace(/[^a-zA-Z 0-9]+/g,'');
              may need tweaking to deal with all the { type stuff Actinic uses for special characters.
              Norman - www.drillpine.biz
              Edinburgh, U K / Bitez, Turkey

              Comment


                #8
                Gabe you done it again - outstanding sir

                Hey like the menu

                D

                Comment


                  #9
                  Sorry i'm having a whoosh moment, what the hell are we looking at?

                  Comment


                    #10
                    Originally posted by NormanRouxel
                    A couple of notes:

                    1) actiniccore.js already contains functions getCookie() and setCookie() that are used by the Cart Summary. I'm not sure if you're intentionally replacing them or not. Probably not as setCookie has a different number of arguments.

                    2) The lines
                    Code:
                    			var temp = new String('<Actinic:Variable Name="ProductName"/>');
                    			proNAME = temp.replace(/[^a-zA-Z 0-9]+/g,'');
                    may need tweaking to deal with all the { type stuff Actinic uses for special characters.

                    its just a lazy initial attempt to strip out all the fluff from a variable. only letters and numbers should get through. though it could be a lot better. i'm open to cleaner suggestions.

                    Comment


                      #11
                      Originally posted by NormanRouxel
                      A couple of notes:

                      1) actiniccore.js already contains functions getCookie() and setCookie() that are used by the Cart Summary. I'm not sure if you're intentionally replacing them or not. Probably not as setCookie has a different number of arguments.

                      2) The lines
                      Code:
                      			var temp = new String('<Actinic:Variable Name="ProductName"/>');
                      			proNAME = temp.replace(/[^a-zA-Z 0-9]+/g,'');
                      may need tweaking to deal with all the { type stuff Actinic uses for special characters.
                      Norman/Gabe
                      Is this going to interfere with the general workings of the cart / checkout then?
                      Chris
                      Chris Adams

                      Comment


                        #12
                        Originally posted by leehack
                        Sorry i'm having a whoosh moment, what the hell are we looking at?
                        'products you recently viewed'

                        you can see it working by browsing for products and seeing them appear in the footer of the products on the demo site.

                        Comment


                          #13
                          Is this going to interfere with the general workings of the cart / checkout then?
                          if someone could confirm renaming the function, or using the built in one. i dont think that it will interfere.

                          you could only test it, couldnt you?

                          Comment


                            #14
                            absolutely - what i have now compared to what i had at the beginning of the day is great, so i shall test it when i have the time.
                            again (again!), thanks ;]
                            Chris Adams

                            Comment


                              #15
                              Ah gotcha, it fills out at the bottom if i add to cart on a product, i think i'm having a whoosh moment again....I should go get some sleep i think.

                              Comment

                              Working...
                              X