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

Add a pop-up information box to describe a product option

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 08-28-2006, 10:21 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Add a pop-up information box to describe a product option

This is for the 4.0 branch of X-Cart. What it does is add a linked icon (or text) next to the product option menu on the product detail page. Clicking that will open a pop-up window to display more information about that option, similar to the little question mark next to the CVV option on checkout. Tested in 4.0.18, not sure about older versions.

First, create a new folder in your files/ directory called options. Make it writable.

Open up skin1/modules/Product_Options/customer_options.tpl and find this line of code:

Code:
<SELECT id="po{$v.classid}" name="{$poname}"{if $disable} disabled{/if}{if $nojs ne 'Y'} onchange="javascript: check_options();"{/if}> {foreach from=$v.options item=o} <OPTION value="{$o.optionid}"{if $o.selected eq 'Y'} selected{/if}>{$o.option_name}{if $v.is_modifier eq 'Y' && $o.price_modifier ne 0} ({if $o.modifier_type ne '%'}{include file="currency.tpl" value=$o.price_modifier display_sign=1}{else}{$o.price_modifier}%{/if}){/if}</OPTION> {/foreach} </SELECT>

Just after it, add this:

Code:
{if $v.classtext eq 'Option Name'} <a href="#" onClick="window.open('files/options/option-name.html','','scrollbars=no,resizable=no,width=300,height=400,menubar=no,toolbar=no');return false;" target="_blank"><img src="{$ImagesDir}/question.gif" border="0" style="vertical-align: middle;" alt="Click here for more info" /></a>{/if}

Replace the following pieces with your information:

- Option Name - this is the name of the option such as select color, select size, etc. as it appears on the product detail screen next to the option drop-down. It is case sensitive, so make sure you type it exactly as it appears.

- option-name.html - replace this with the html file you want to include in the pop-up, or use an image (i.e. imagename.jpg). Be sure to upload the .html or .jpg file to the files/options directory you created

- width= , height= - these the the width/height of the pop-up window. Adjust accordingly.

- alt= - this is the text that will show up when the customer mouses over the question mark image (in Internet Explorer at least).

- question.gif - this is the default x-cart question mark image. I always create my own to go with the style, so adjust this accordingly as well.

The code above will add the image/link to the option specified only. To add it to additional options, use {elseif} statements like this:

Code:
{if $v.classtext eq 'Option Name'} <a href="#" onClick="window.open('files/options/option-name.html','','scrollbars=no,resizable=no,width=300,height=400,menubar=no,toolbar=no');return false;" target="_blank"><img src="{$ImagesDir}/question.gif" border="0" style="vertical-align: middle;" alt="Click here for more info" /></a> {elseif $v.classtext eq 'Option Name2'} <a href="#" onClick="window.open('files/options/option-name2.html','','scrollbars=no,resizable=no,width=300,height=400,menubar=no,toolbar=no');return false;" target="_blank"><img src="{$ImagesDir}/question.gif" border="0" style="vertical-align: middle;" alt="Click here for more info" /></a> {/if}

Now this can get really clunky if you have a million options to add a link to, but it works well if you only have a few universal options. It will NOT work if you have a different image/html page to link to for each individual product, such as if you have different color charts for each product.

If you want to link to a unique image/html page for each product, you can use this:

Code:
{if $v.classtext eq 'Option Name'} <a href="#" onClick="window.open('files/options/{$product.productid}.html','','scrollbars=no,resizable=no,width=300,height=400,menubar=no,toolbar=no');return false;" target="_blank"><img src="{$ImagesDir}/question.gif" border="0" style="vertical-align: middle;" alt="Click here for more info" /></a>{/if}

So if you are veiwing the details for a product with ID # 8, clicking on the link next to the 'Option Name' option will link you to files/options/8.html.

Make sense? Post here with any questions and I'll answer them. Enjoy!
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote

The following 5 users thank balinor for this useful post:
am2003 (07-11-2010), iry (05-12-2009), jefflee (05-12-2009), rct (06-25-2009), Rizwanali (01-06-2010)
  #2  
Old 08-28-2006, 11:43 AM
 
mike@tatechnology.net mike@tatechnology.net is offline
 

Senior Member
  
Join Date: May 2006
Posts: 132
 

Default Re: Add a pop-up information box to describe a product option

balinor is the man!


Good work and did exactly what I needed!
__________________
TA Technologies, Inc.
~Implementing Creative Point of Sale Solutions~
http://www.rmspos.net
X-Cart 4.1.10
Reply With Quote
  #3  
Old 09-14-2006, 04:14 AM
 
carpeperdiem carpeperdiem is offline
 

X-Guru
  
Join Date: Jul 2006
Location: New York City, USA
Posts: 5,399
 

Default Re: Add a pop-up information box to describe a product option

Just to report, this mod works in 4.1.3 -- very nice. Very useful. A zillion possible uses.

Thanks for contributing this, Padraic.

Jeremy
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #4  
Old 11-13-2006, 01:55 PM
  Warwick's Avatar 
Warwick Warwick is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Somewhere on the web through European connection
Posts: 868
 

Question Re: Add a pop-up information box to describe a product option

Hi Balinor, a great mod! Any change of getting it international/multi language?
__________________
Installs: X-Cart 4.1.x - 4.4.x ∙∙ MySQL version: 5.0.45 ∙∙ Apache version: 2.2.8 (Unix) ∙∙ PHP version: 5.25
X-Cart add-ons: all ∙∙ Mods: A lot; too many ∙∙ Skin templates: Many
∙∙ Experience: Somewhere beyond newbie
-----------------------------------
------------------------------------------------------------------------------------------------------
Looking for the best dutch language pack? 4.1.x - 4.6.x compatibel, native speaker translation! More info
Reply With Quote
  #5  
Old 12-28-2006, 07:44 PM
 
dillion dillion is offline
 

Advanced Member
  
Join Date: Jun 2006
Posts: 53
 

Default Re: Add a pop-up information box to describe a product option

Hi Balinor,

I have installed this code on my site and it works great (version 4.1.4). The only thing I have noticed is that when I have "custom text field" choosen for the option group type the icon will not appear next to the drop down box. Is there an easy fix for this?

Thanks!
__________________
X-CART GOLD 4.1.7
UNIX
Reply With Quote
  #6  
Old 03-29-2007, 12:15 AM
  Warwick's Avatar 
Warwick Warwick is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Somewhere on the web through European connection
Posts: 868
 

Default Re: Add a pop-up information box to describe a product option

Does this work with 'product variant' for the product group on 4.1.3?
I don't see anything appearing
__________________
Installs: X-Cart 4.1.x - 4.4.x ∙∙ MySQL version: 5.0.45 ∙∙ Apache version: 2.2.8 (Unix) ∙∙ PHP version: 5.25
X-Cart add-ons: all ∙∙ Mods: A lot; too many ∙∙ Skin templates: Many
∙∙ Experience: Somewhere beyond newbie
-----------------------------------
------------------------------------------------------------------------------------------------------
Looking for the best dutch language pack? 4.1.x - 4.6.x compatibel, native speaker translation! More info
Reply With Quote
  #7  
Old 03-29-2007, 03:31 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default Re: Add a pop-up information box to describe a product option

Sorry, can't help with 4.1
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #8  
Old 03-29-2007, 08:17 AM
 
Shadow Shadow is offline
 

Newbie
  
Join Date: Jun 2006
Location: California
Posts: 7
 

Default Re: Add a pop-up information box to describe a product option

Warwick
It works great for me with 4.1.5
Not sure if this is the problem you are having but I have had that happen when I had the wrong option name.

{if $v.classtext eq 'Option Name'}

"Option name" needs to be what you use in the "Option Text" field in the product variant
and NOT group name this may be your problem.

Not an expert but hope that helps ya
__________________
Mike Gustafson
Beyond2K Enterprises
www.b2kenterprises.com
4.3.8 Gold
4.4.4 Gold
Reply With Quote
  #9  
Old 03-29-2007, 09:14 AM
  Warwick's Avatar 
Warwick Warwick is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Somewhere on the web through European connection
Posts: 868
 

Default Re: Add a pop-up information box to describe a product option

Thanks Shadow and balinor, so what you're basically saying is that when the group's name is for example 'Size' and you have 'Small, 'Medium' and 'Large', I should put 'Small' in the 'Option Name' place, I tried that but it doesn't work and if this would work; what about the others; medium and large?

EDIT: somehow I suddenly got it working not ... don't ask me why

Working with 4.1.3!
__________________
Installs: X-Cart 4.1.x - 4.4.x ∙∙ MySQL version: 5.0.45 ∙∙ Apache version: 2.2.8 (Unix) ∙∙ PHP version: 5.25
X-Cart add-ons: all ∙∙ Mods: A lot; too many ∙∙ Skin templates: Many
∙∙ Experience: Somewhere beyond newbie
-----------------------------------
------------------------------------------------------------------------------------------------------
Looking for the best dutch language pack? 4.1.x - 4.6.x compatibel, native speaker translation! More info
Reply With Quote
  #10  
Old 06-20-2007, 07:51 AM
 
ITVV ITVV is online now
 

X-Wizard
  
Join Date: Nov 2006
Location: UK
Posts: 1,167
 

Default Re: Add a pop-up information box to describe a product option

Hi Balinor,

Just to report that your mod is working great in 4.1.7.

Many thanks for sharing this info with us all.

It was just what I needed.

Kind regards

Nick
__________________
X-Cart Pro 4.7.12 Active and working great with reBOOT-reDUX
X-Cart Pro 4.6.6 Retired after 6 years of first class service
X-Cart Pro 4.1.7 Retired after 9 years of first class service

Apache: 2.4.25
PHP: 7.4.5
MariaDB: 10.1.44
Arch: x86_64
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



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 01:25 PM.

   

 
X-Cart forums © 2001-2020