PDA

View Full Version : Displaying Cart Details outside of Actinic?


businesscore
08-Mar-2004, 01:22 PM
Hi,

I've got Actinic running inside an IFRAME inside a TABLE.

I need to display the number of items and total value of the shopping cart outside of the IFRAME so that it can be seen at all times by the user.

Is this possible?

Any help would be greatly appreciated...

John

NormanRouxel
08-Mar-2004, 03:14 PM
The JavaScript in the Actinic page can write to the parent as below:-

Example page that loads the actinic index.html
<HTML>
<HEAD>
<TITLE>Test</TITLE>
</HEAD>
<BODY name="topwin">
<CENTER>
<H1>Frame Test</h1>
<table width="100" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td background="pxl_red.gif">
<form name="infoform">
Quantity<input name="qty" type=text width=10 value="">
<br>
Value<input name="val" type=text width=10 value="">
</td>
</tr>
</table>
<br>
<iframe src="index.html" width=800 height=900>OK</iframe></CENTER>
</BODY>
</HTML>


And use this modified JavaScript in the Act_Primary.html template instead of the usual cart content/value code.

<table width="100" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td background="pxl_red.gif">
<div align="center"> <span class="actxxsmall">
<script language="JavaScript">
document.write("NETQUOTEVAR:CARTCOOKIEITEMS&nbsp;" + getCartItem(3)+"&nbsp;<BR>");
document.write("NETQUOTEVAR:CARTCOOKIEVALUE&nbsp;" + getCartItem(1));

// display this in the parent form
var thisval = getCartItem(1);
thisval = thisval.replace(/£/g,"£"); // fix the pound sign
thisval = thisval.replace(/,/g,","); // and any commas
thisval = thisval.replace(/./g,"."); // and the decimal point
parent.infoform.val.value = thisval;
parent.infoform.qty.value = getCartItem(3);

</script>
</span> </div>
</td>
</tr>
</table>

Norman

businesscore
08-Mar-2004, 03:29 PM
Thanks! I'll try that...

NormanRouxel
08-Mar-2004, 03:45 PM
Grrr... The Forum ate some of the JavaScript above. Here it is corrected:- // display this in the parent form
var thisval = getCartItem(1);
thisval = thisval.replace(/&amp;#163;/g,"£"); // fix the pound sign
thisval = thisval.replace(/&amp;#44;/g,","); // and any commas
thisval = thisval.replace(/&amp;#46;/g,"."); // and the decimal point
parent.infoform.val.value = thisval;
parent.infoform.qty.value = getCartItem(3);



Norman

businesscore
08-Mar-2004, 03:47 PM
Is there a way to display the values as plain text rather than input text boxes?

Thanks in advance...

NormanRouxel
08-Mar-2004, 03:50 PM
I'm sure there is but it would take me too long to work it out. I recommend JavaScript The Definitive Guide published by O'Reilly.

You could use CSS to make the text boxes have no borders and look like the rest of your site.

Note I just posted a small fix above.

Norman

DavidGeran
10-Jul-2004, 08:19 AM
Norman,

Can this be applied to our brochure pages as well, inc. the home page which sits in a directory one level above the acatalog folder?

Regards,
David

www.youraromatherapy.co.uk

NormanRouxel
10-Jul-2004, 08:34 AM
I can't see why not. However you would need to add the line

<SCRIPT LANGUAGE="JavaScript" SRC="actinicextras.js" TYPE="text/javascript"></SCRIPT>

right after the line

<SCRIPT LANGUAGE="JavaScript" SRC="actiniccore.js" TYPE="text/javascript"></SCRIPT>


In your Brochure Primary templates. Usually Act_BrochurePrimary.html. In order for the cart cookie code to be available.

Norman

DavidGeran
11-Jul-2004, 09:10 PM
That appears to work when adding an item to the shopping cart, the items count and value shows in the test text fields, but when a link is clicked on the navigation menu, they reset to zero again... and it doesn't show at all on the home page but that might be because I've imported a html page rather than build it up using the brochure templates.

Any suggestions? Do I need professional help (not personally, although thats open to debate)? :(

(I've removed the test text boxes now because its a live shop)...

Dave

www.youraromatherapy.co.uk

cdicken
12-Jul-2004, 09:23 AM
Your problem is because your Catalog URL is

http://www.youraromatherapy.co.uk/acatalog/

but your cgi-bin URL is on

http://www.your-aromatherapy.co.uk/cgi-bin/

These domains both need to be the same in order for the shopping cart summary to work correctly.

DavidGeran
12-Jul-2004, 11:27 AM
Thanks Chris,

I'll get on to my ISP to sort the domains out, and try Norman's code again.

Regards,
David

DavidGeran
14-Jul-2004, 12:58 PM
Chris,

At the moment the web site has a directory structure set up as your-aromatherapy.

In the network settings do I just need to change the web site url to 'youraromatherapy' (without the hyphen) and republish the site to solve this problem, or does something server side need to change, or would I need to change the directory paths as well?

I don't see why anything server side would need to change as both urls are mapped to the Actinic directory?

Regards,
David

cdicken
14-Jul-2004, 04:14 PM
As long as both URLs point to exactly the same place, then you can just change the values in 'Advanced | Network Setup' to use the same domain names without ill effect.

DavidGeran
14-Jul-2004, 05:31 PM
Thanks for your help Chris, that now works a treat :)