Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

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

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #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
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 10:48 AM.

   

 
X-Cart forums © 2001-2020