X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Add custom image buttons w/ X-Cart's builtin popup functionality (https://forum.x-cart.com/showthread.php?t=56139)

mmcelroy 10-21-2010 03:30 PM

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


All times are GMT -8. The time now is 04:34 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.