E-Junkie Forum http://www.e-junkie.com/bb/ E-Junkie Forum RSS en-us Copyright 2013, 19.5 Degrees. All rights reserved. webmaster@e-junkie.com webmaster@e-junkie.com Fri, 22 Feb 2013 16:01:32 GMT Wed, 22 May 2013 13:15:31 GMT 681 E-JUNKIE 5 E-Junkie Forum http://www.e-junkie.com/bb/ http://www.e-junkie.com/ej/logo.gif 290 104 Post #28 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 Fri, 22 Feb 2013 16:01:32 GMT E-junkieGuruYes, as we have explained previously here, the minicart does not appear in a page until the main cart has already been viewed once from that page. You or a developer you'd hire may be able to write some custom javascript to solve that problem. We only present this minicart code as-is, as an unofficial, unsupported hack that our Lead Developer whipped up as a fun side project many years ago but hasn't touched since.

I can force the mini cart to appear in the page using this code in the body tag :

<body onload="document.getElementById('mylink').click(); document.getElementById('EJEJC_overlay').style.display = 'none'; document.getElementById('EJEJC_window').style.display = 'none'; setTimeout(function(){document.getElementById('EJEJC_closeWindowButton').click();},1000);">

But i get the same as some other user reported.. Always 0.00 for the cart total.
The item total is displayed correctly.

Anyway this body tag hack should work and show the mini cart on page load.
You may just need to increase the set timeout a little. I am testing on a very fast connection.


edit: i should point out that the id in the code above "mylink" is an id i added to my view cart button.
So essentially on page load, the button is being clicked automatically by the script.
We then hide the overlay and cart window while we get the data we need.
Then after the timeout we close the cart window, with another automated click.]]>
E-junkie Discussions; doobox
Post #27 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 Tue, 16 Aug 2011 02:52:32 GMT E-junkie Discussions; E-junkieGuru Post #26 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 Fri, 12 Aug 2011 05:00:00 GMT E-junkie Discussions; bunkbedking Post #25 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 Tue, 9 Aug 2011 01:25:54 GMT
items=EJEJC_cartsize();

Thus, your version of the code should look like this:

<script type="text/javascript">
<!--
function EJEJC_lc(th) { return false;}
function EJEJC_config() {
EJEJC_POSTCALL=true;
EJEJC_OPACITY = 30;
EJEJC_HEIGHT = 500;
EJEJC_WIDTH = 750;
EJEJC_BRDRCOLOR = "#00f";
EJEJC_CDAYS = 61;
}
function EJEJC_shown() {
jQuery("#state1").attr("innerHTML", "Enter <b>SHIPPING ZIP CODE</b>");
items=EJEJC_cartsize();
if (items== null) {items = 0};
jQuery("#itemsInCart").attr("innerHTML",
items+" Items<BR/>$"+EJEJC_cartamt().toFixed(2)+" total");
}
// -->
</script>]]>
E-junkie Discussions; E-junkieGuru
Post #24 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 Mon, 8 Aug 2011 21:52:01 GMT
see

http://bunkbedking.com/more-bunk-beds-rustic

- no mini cart - but code is as above

What am I doing wrong?

also, do you have a link to a web site where it is working so I can see it in action?]]>
E-junkie Discussions; bunkbedking
Post #23 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 Mon, 8 Aug 2011 20:46:08 GMT
<script type="text/javascript">
<!--
function EJEJC_lc(th) { return false;}
function EJEJC_config() {
EJEJC_POSTCALL=true;
EJEJC_OPACITY = 30;
EJEJC_HEIGHT = 500;
EJEJC_WIDTH = 750;
EJEJC_BRDRCOLOR = "#00f";
EJEJC_CDAYS = 61;
}
function EJEJC_shown() {
jQuery("#state1").attr("innerHTML", "Enter <b>SHIPPING ZIP CODE<\/b>");
if (items== null) {items = 0};
jQuery("#itemsInCart").attr("innerHTML",
items+" Items<BR/>$"+EJEJC_cartamt().toFixed(2)+" total");
}
// -->
</script>

Then just place this in your page wherever you want the minicart to appear:

<div id="itemsInCart"></div>]]>
E-junkie Discussions; E-junkieGuru
Post #22 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 Sat, 6 Aug 2011 22:11:11 GMT
I have this code

<script type="text/javascript">
<!--
function EJEJC_lc(th) { return false;}
function EJEJC_config() {
EJEJC_POSTCALL=true;
EJEJC_OPACITY = 30;
EJEJC_HEIGHT = 500;
EJEJC_WIDTH = 750;
EJEJC_BRDRCOLOR = "#00f";
EJEJC_CDAYS = 61;
}
function EJEJC_shown() {
jQuery("#state1").attr("innerHTML", "Enter <b>SHIPPING ZIP CODE<\/b>");
}
// -->
</script>

not sure how to integrate the mini card code ?]]>
E-junkie Discussions; bunkbedking
Post #21 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 Tue, 26 Jul 2011 21:11:00 GMT
function EJEJC_config() {
EJEJC_POSTCALL=true;
}
function EJEJC_shown() {
items=EJEJC_cartsize();
if (items== null) {items = 0};
jQuery("#itemsInCart").attr("innerHTML",
items+" Items<BR/>$"+EJEJC_cartamt().toFixed(2)+" total");
}

Then just place this in your page wherever you want the minicart to appear:

<div id="itemsInCart"></div>

Now, if anyone's worked out how to get that minicart DIV to display on page load, rather than only appearing after the main cart has been viewed, feel free to share the approach you devised here.]]>
E-junkie Discussions; E-junkieGuru
Post #20 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 Wed, 4 May 2011 22:05:57 GMT http://www.e-junkie.com/ej/developer-directory.htm]]> E-junkie Discussions; E-junkieGuru Post #19 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 Wed, 4 May 2011 20:50:31 GMT how to automatically initialize the mini cart on page load...
too bad my javascript knowledge ends exactly there :(]]>
E-junkie Discussions; robleger
Post #18 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 Sun, 20 Feb 2011 23:24:07 GMT E-junkie Discussions; E-junkieGuru Post #17 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 Sat, 19 Feb 2011 03:26:37 GMT E-junkieGuruIf you're handy with JavaScript, our Lead Developer says you can use the functions EJEJC_cartsize(); and EJEJC_cartamt(); at will, to get the number of items and the cart total respectively. The amount currently does not reflect discounts but that'll be fixed shortly.

can you check with you DEV guy as those functions quoted are returning errors and only available after EJEJC_shown has been run - has he got example code?

thanks

Jez]]>
E-junkie Discussions; Jezd
Post #16 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 Wed, 29 Dec 2010 00:58:05 GMT
function EJEJC_config() { EJEJC_POSTCALL=true; }
function EJEJC_shown() {
items=EJEJC_cartsize();
if (items== null) {items = 0};
document.getElementById('itemsInCart').innerHTML=items+" Items <BR/>£"+EJEJC_cartamt().toFixed(2)+" total";
}

This gets rid of null value and helps currency format, results of an emply cart :-

0 Items
£0.00 total

Still struggling to get html values on initial page load.

Jez]]>
E-junkie Discussions; Jezd
Post #15 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 Fri, 10 Dec 2010 02:49:43 GMT E-junkie Discussions; E-junkieGuru Post #14 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 Wed, 8 Dec 2010 20:56:08 GMT
I am sure there must be a method for doing this.

Cheers

Jez

E-junkieGuruI did say it was an unofficial hack. :^)

I don't know of any way to display the itemsInCart div contents automatically before the cart is rendered, but I might guess there could be some way to do that with JavaScript?

I'll assign this to the attention of our Lead Developer, in case he has a solution to offer.
]]>
E-junkie Discussions; Jezd
Post #13 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 Wed, 20 Jan 2010 22:26:50 GMT E-junkie Discussions; nobo Post #12 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 Wed, 20 Jan 2010 06:21:15 GMT
Any help would be greatly appreciated.]]>
E-junkie Discussions; blacklabel
Post #11 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 Wed, 24 Jun 2009 22:13:58 GMT E-junkie Discussions; nobo Post #10 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 Wed, 24 Jun 2009 22:03:02 GMT E-junkie Discussions; E-junkieGuru Post #9 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 http://www.e-junkie.com/bb/topic/3086/pg/1#post22821 Wed, 24 Jun 2009 21:43:25 GMT I'm using a fat.free.cart and it's working fine itself. When adding your hack minicart shows always $0
thank you
nobo]]>
E-junkie Discussions; nobo