hacking the shopping cart text

winnjewettwinnjewett Registered Users Posts: 329 Major grins
I have a little bit of news for those interested in changing the text of their shopping cart. I have developed a small bit of javascript that allows you to manipulate the text in any way you wish. Here is an example: http://photography.brilliantphoton.com/gallery/449917/1/18131235

javascript:
     	function changeCart(){
     		if (is_ie == true){
     			num1 = 1;
     			num2 = 3;
     			num3 = 5;
     		}
     		else{
     			num1 = 3;
     			num2 = 7;
     			num3 = 11;
     		}
 	 document.getElementById('cartadd').parentNode.parentNode.childNodes[num1].childNodes[0].innerHTML='Order A Print';
  	 document.getElementById('cartadd').parentNode.parentNode.childNodes[num2].childNodes[0].innerHTML='Order A Few<br>Different Prints';
 	 document.getElementById('cartadd').parentNode.parentNode.childNodes[num3].childNodes[0].innerHTML='View Orders';
     	    document.getElementById('cartadd').parentNode.parentNode.childNodes[num1].style.textAlign='left';
     	    document.getElementById('cartadd').parentNode.parentNode.childNodes[num2].style.textAlign='left';
     	    document.getElementById('cartadd').parentNode.parentNode.childNodes[num3].style.textAlign='left';
     	}
     
*note: there shouldn't be a space between 'pare' and 'ntNode'. I'm not sure why it's displaying this way.

Body code:
<body onload="changeCart(); return true;">
Enjoy!
-w

Comments

  • winnjewettwinnjewett Registered Users Posts: 329 Major grins
    edited April 7, 2005
    Additionally, you can use this code to remove the Batch Add to cart, which I believe isn't applicable to the type of photos I will sell. This feature is incredibly usefull for friends and family sharing entire albums, but when a pro is trying to sell one or two prints, the 'batch add to cart' just adds confusion, IMO.

    -w
     	function changeCart(){
     		if (is_ie == true){
     			text1 = 1;
     			img2 = 2;
     			text2 = 3;
     			text3 = 5;
     		}
     		else{
     			text1 = 3;
     			img2 = 5;
     			text2 = 7;
     			text3 = 11;
     		}
     	    document.getElementById('cartadd').parentNode.parentNode.childNodes[text1].childNodes[0].innerHTML='Order Prints &amp; Gifts';
     		document.getElementById('cartadd').parentNode.parentNode.childNodes[text2].innerHTML='';;
     		document.getElementById('cartadd').parentNode.parentNode.childNodes[img2].innerHTML='';
     	    document.getElementById('cartadd').parentNode.parentNode.childNodes[text3].childNodes[0].innerHTML='View Orders';
     	    document.getElementById('cartadd').parentNode.parentNode.childNodes[text1].style.textAlign='left';
     	    document.getElementById('cartadd').parentNode.parentNode.childNodes[text3].style.textAlign='left';
     	}
    
    *again, if there is a space put in the middle of 'parentNode', it doesn't belong.
Sign In or Register to comment.