View Single Post
  #1  
Old 10-21-2010, 03:30 PM
  mmcelroy's Avatar 
mmcelroy mmcelroy is offline
 

Advanced Member
  
Join Date: Feb 2008
Location: Seattle, WA
Posts: 58
 

Default Add custom image buttons w/ X-Cart's builtin popup functionality

I like version 4.4's new popup box, so I wanted to make my own buttons (images - no text) which would popup a file in X-cart's box rather than a boring browser window.

Here's how:
1) The file you are popping must be a .php file, at least from my experience. I put mine in the site root (since user doesn't have permission to access php files in the static page area)

2) in /skin/common_files/customer/buttons/button.tpl:

Immediately before:
{elseif $style eq 'image'}
{if $type eq 'input'}

Add:

{elseif $style eq 'userbutton'}
{strip}
<a href="{$href|amp}" {if $onclick ne ''} onclick="{$onclick}; return false;"{/if} {if $target ne ''} target="{$target}"{/if}>
<img src="{$imgpath}" />
</a>
{/strip}

3) Then, in whatever template you want to add the button, insert something like:

{include file="customer/buttons/button.tpl" style="userbutton" imgpath="/skin/fashion_mosaic_grey/images/fashion_mosaic/freeship_icon.png" href="javascript: return !popupOpen(xcart_web_dir + '/shipping_popup.php')"}

Here, I made a free shipping button (freeship_icon.png) which opens a php file (/shipping_popup.php) in X-Carts new popup box.

I'm sure this could be improved further - for example you could replace /skin/fashion_mosaic_grey with your skin directory smarty variable, but I don't know what it is off the top of my head. If anyone could improve this code or has suggestions, please post!

Works and tested for X-Cart version 4.4.1
__________________
X-Cart Gold v4.4.2
CDSEO Pro, Checkout One
Reply With Quote