网络营销电子商务研究中心  
How to buy the best prescription safety glasses in Canada? Let's study!
Go Back   网络营销电子商务研究中心 > 网站建设 > X-Cart
User Name
Password
 
FAQ Members List Calendar Cheap Glasses

Reply
 
Thread Tools Display Modes
  #1   IP: 114.238.4.13
Old 2015-12-02, 07:50 PM
Randy Randy is offline
初级会员
 
Join Date: 2006-10-04
Posts: 1
Randy 现在声名狼藉
Default Add a pop-up information box to describe a product option

his 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!
Reply With Quote
  #2   IP: 114.238.4.13
Old 2015-12-02, 07:51 PM
Reedsburg Reedsburg is offline
初级会员
 
Join Date: 2006-05-22
Posts: 1
Reedsburg 现在声名狼藉
Default

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
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 3 (0 members and 3 guests)
 

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Add PDF file to a Product Gainesboro X-Cart 2 2015-12-02 06:40 PM
Determine X-Cart Product Sales Statistics Xenia X-Cart 0 2015-03-31 12:32 AM
mysql 帮助文档使用 Haddam MySQL 0 2014-11-26 06:43 PM
国外买家喜欢看到什么样的购物网站? (转帖,全英文的) topvip 电子商务 0 2010-04-17 10:27 AM
101 ways to get more traffic sunshine Google Adsense 0 2007-05-09 08:29 PM

Prescription-glasses.com offers prescription glasses online at discount prices.
All times are GMT +8. The time now is 11:04 AM.


Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.