This describes how to use an existing facility to add popup windows as needed to your store.
In the directory store/skin1/help there are several popups as a standard part of X-Cart. They are named like hlp_XXXX.tpl. You should create a new file in this directory replacing the "XXXX" in the name with something appropriate to your application. For example I created a file hlp_freeship.tpl to explain to the customer the details of our free shipping offer. You should add only letters and numbers - no underscores etc. (except for the underscore after the "hlp").
This tpl file will be processed by Smarty and can contain anything that a normal tpl file can contain.
After adding your code and/or HTML to the file all you have to do is set up a link where you want the customer to be able to invoke the popup. To do this use this as a template:
Code:
<A href="javascript: void(0);" onclick="javascript: window.open('popup_info.php?action=XXXXX','YYYYY','width=600,height=460,toolbar=no,status=no,scrollbars=yes,resizable=no,menubar=no,location=no,direction=no');" >ZZZZZ</A>
You'll need to change the XXXXX to invoke the correct hlp tpl file. For the example above it would be set to "freeship" which will cause the hlp_freeship.tpl file to be invoked.
Change the YYYYY to the popup page title.
Change the ZZZZZ to the text that the customer will see. This a normal <a> link so you can put other things in for the customer to see.
ADDITIONAL INFO:
I've put the following at the top of my hlp_freeship.tpl to get some config and cart values to display in the popup:
Code:
{php}
global $config, $cart;
$this->assign("cart", $cart);
$this->assign("config", $cart);
{/php}
All this does is make all of the $cart and $config values available to Smarty. Then in the HTML of the tpl file you can drop in a Smarty reference like
Code:
${config.Shipping.freeshipthreshold}
or any other $config or $cart value. (freeshipthreshold is our value, you won't have one of these). This all depends on what php values are available at the time of your popup. It is context sensitive. I'm not a Smarty expert so there may be a better way to do this, but this works.