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

Product Options Dropdown "Select XXXX..."

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #31  
Old 12-17-2008, 09:41 AM
 
OceanRiver OceanRiver is offline
 

Newbie
  
Join Date: Jul 2007
Posts: 6
 

Default Re: Product Options Dropdown "Select XXXX..."

Hello,

I have a problem that my third option down is displaying selected="selected" after Please select xxx...

This only appears on the the third one down, above and below it works fine.

An example can be seen here:
http://store.oceanriver.com/store/product.php?productid=16144

Thanks,
Graham
__________________
www.oceanriver.com
Version 4.1.11
Reply With Quote
  #32  
Old 12-17-2008, 10:45 AM
 
carpeperdiem carpeperdiem is offline
 

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

Default Re: Product Options Dropdown "Select XXXX..."

Quote:
Originally Posted by OceanRiver
Hello,

I have a problem that my third option down is displaying selected="selected" after Please select xxx...

This only appears on the the third one down, above and below it works fine.

An example can be seen here:
http://store.oceanriver.com/store/product.php?productid=16144

Thanks,
Graham

Check your code in customer_options.tpl

it should look something like this:

Code:
<option>Please Select Your {$v.classtext|default:$v.class}...{if $o.selected eq 'Y'} selected="selected"{/if}</option>

You are probably missing an if or a closing /if or a bracket.
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #33  
Old 12-17-2008, 11:06 AM
 
OceanRiver OceanRiver is offline
 

Newbie
  
Join Date: Jul 2007
Posts: 6
 

Default Re: Product Options Dropdown "Select XXXX..."

Nope, it's exactly the same line. I've even tried cutting and pasting code directly out of some of the posts. Same result. Here is my code:
Code:
{* $Id: customer_options.tpl,v 1.24.2.2 2008/06/16 13:35:09 ferz Exp $ *} {if $product_options ne '' or $product_wholesale ne ''} {if $nojs ne 'Y'} <tr style="display: none;"><td> <script type="text/javascript" language="JavaScript 1.2"> <!-- var alert_msg = '{$alert_msg}'; --> </script> {include file="modules/Product_Options/check_options.tpl"} </td></tr> {/if} {foreach from=$product_options item=v} {if $v.options ne '' || $v.is_modifier eq 'T'} <tr> <td valign="middle" height="25">{if $usertype eq "A"}{$v.class}{else}{$v.classtext|default:$v.class}{/if}</td> <td valign="middle"> {if $cname ne ""} {assign var="poname" value="$cname[`$v.classid`]"} {else} {assign var="poname" value="product_options[`$v.classid`]"} {/if} {if $v.is_modifier eq 'T'} <input {if $nojs ne 'Y'}id="po{$v.classid}"{/if} type="text" name="{$poname}" value="{$v.default|escape}" /> {else} <select {if $nojs ne 'Y'}id="po{$v.classid}"{/if} name="{$poname}"{if $disable} disabled="disabled"{/if}{if $nojs ne 'Y'} onchange="javascript: check_options();"{/if}> {* BEGIN "PLEASE SELECT" MOD *} <option>Select Your {$v.classtext|default:$v.class}...{if $o.selected eq 'Y'} selected="selected"{/if}</option> {foreach from=$v.options item=o} <option value="{$o.optionid}">{$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 plain_text_message=1}{else}{$o.price_modifier}%{/if}){/if}</option> {/foreach} </select> {/if} </td> </tr> {/if} {/foreach} {/if} {if $product_options_ex ne ""} <tr> <td colspan="2"><font {if $nojs ne 'Y'}id="exception_msg"{/if} color="red"></font></td> </tr> {if $err ne ''} <tr> <td colspan="2"><font class="CustomerMessage">{$lng.txt_product_options_combinations_warn}:</font></td> </tr> {foreach from=$product_options_ex item=v} <tr> <td>{foreach from=$v item=o}{if $usertype eq "A"}{$o.class}{else}{$o.classtext}{/if}: {$o.option_name}<br />{/foreach}<br /></td> </tr> {/foreach} {/if} {/if}

This happens for any product with three or more options. I've attached a screenshot.

Thanks,
Graham
Attached Thumbnails
Click image for larger version

Name:	options error.jpg
Views:	245
Size:	61.6 KB
ID:	1284  
__________________
www.oceanriver.com
Version 4.1.11
Reply With Quote
  #34  
Old 12-17-2008, 11:56 AM
 
drubarth drubarth is offline
 

Member
  
Join Date: Jul 2004
Posts: 23
 

Default Re: Product Options Dropdown "Select XXXX..."

Instead of the javascript in each of your products, you can instead add the following to your product.tpl file (or anywhere else).

{if $err eq "options"}
<div class="ErrorMessage">{$lng.err_select_options}</div>
{/if}

Then add a language variable called "err_select_options"

This assumes you did add the additional select option described above and that you always want all options selected.

I'm working on an X-cart 4.1.11 site.
__________________
x-cart 4.1.11
x-cart 4.1.12
x-cart 4.2.3
x-cart 4.3.2
Reply With Quote
  #35  
Old 08-27-2009, 08:37 AM
  hoosierglass's Avatar 
hoosierglass hoosierglass is offline
 

X-Adept
  
Join Date: Aug 2006
Location: Zionsville, IN
Posts: 974
 

Default Re: Product Options Dropdown "Select XXXX..."

I hate to beat a dead horse but I am having trouble with this.

I put this code in customer_options.tpl before {foreach from=$v.options item=o}
<option>Select {$v.classtext|default:$v.class}...</option>

Then added this to the product option java box

if (document.getElementById('po3').selectedIndex == 0)
{ alert('Please select a size for your item.'); return false;
}
if (document.getElementById('po4').selectedIndex == 0)
{ alert('Please select a color for your item.'); return false;
}
else return true;

When I go to the product the page loads fine but when you click add to cart the page pops the old warning triangle in the bottom left of IE.

For all items with an option my first option is None Selected. All I want is a warning box to pop when an absent minded customer trys to add the None Selected to the cart.

Mike
__________________
X-Cart Gold 4.7.7
Custom Work from www.luminointernet.com
www.indy-pen-dance.com
Reply With Quote
  #36  
Old 08-28-2009, 07:19 AM
  hoosierglass's Avatar 
hoosierglass hoosierglass is offline
 

X-Adept
  
Join Date: Aug 2006
Location: Zionsville, IN
Posts: 974
 

Default Re: Product Options Dropdown "Select XXXX..."

Anyoe have any ideas on this?
__________________
X-Cart Gold 4.7.7
Custom Work from www.luminointernet.com
www.indy-pen-dance.com
Reply With Quote
  #37  
Old 10-03-2009, 12:38 PM
  xcel's Avatar 
xcel xcel is offline
 

eXpert
  
Join Date: Nov 2008
Posts: 220
 

Default Re: Product Options Dropdown "Select XXXX..."

Quote:
Originally Posted by OceanRiver
Hello,

I have a problem that my third option down is displaying selected="selected" after Please select xxx...

This only appears on the the third one down, above and below it works fine.

An example can be seen here:
http://store.oceanriver.com/store/product.php?productid=16144

Thanks,
Graham

graham, i just discovered that i too was having this hangup. but my selected="selected" was only occurring on my 6th option. i pondered on what it could be as i sat and stared at the code, and then i figured i would simply remove selected="'selected" to see what would happen.

well, to my surprise the issue went away and my 6th option displayed just as the first 5 did. i tested with 2 orders and nothing seems to have been affected.

can those who know about code explain why removing selected="selected" fixed my issue and obviously had no bearing on the product being ordered?

thanks in advance.
__________________
X-Cart Gold Plus 4.6.6

Altered Cart - Checkout One
Altered Cart - Checkout One Payments
Altered Cart - Cash Rewards
Altered Cart - On Sale

Smack Digital - CDSEO
Smack Digital - CDSEO Rich Snippets
Smack Digital - xCMS

The xCart Store - xBanners2

Star Plugins - Cloud Zoom

Heavily Customized by Starts Here Ltd. (UK)
Reply With Quote
  #38  
Old 01-28-2010, 06:39 AM
 
delboy2028 delboy2028 is offline
 

Advanced Member
  
Join Date: Jan 2009
Location: UK
Posts: 97
 

Default Re: Product Options Dropdown "Select XXXX..."

any way of getting this on 4.2.2
__________________
Version 5.3.1
Reply With Quote
  #39  
Old 01-28-2010, 10:23 AM
  ARW VISIONS's Avatar 
ARW VISIONS ARW VISIONS is offline
 

X-Man
  
Join Date: Jan 2007
Location: Pensacola, FL
Posts: 2,536
 

Default Re: Product Options Dropdown "Select XXXX..."

MAKE A BACK UP!!!!!!!

in skin1/modules/Product_Options/customer_options.tpl

find this code starting around line 45

{foreach from=$v.options item=o}

<option value="{$o.optionid}"{if $o.selected eq 'Y'} selected="selected"{/if}>

change to this

{foreach from=$v.options item=o}
<option value="select">Select</option>
<option value="{$o.optionid}">
__________________
xcart 5.1.2
Reply With Quote
  #40  
Old 01-28-2010, 10:40 AM
 
delboy2028 delboy2028 is offline
 

Advanced Member
  
Join Date: Jan 2009
Location: UK
Posts: 97
 

Default Re: Product Options Dropdown "Select XXXX..."

hi can not find the above code here is my customer_options.php


PHP Code:
<?php
/*****************************************************************************\
+-----------------------------------------------------------------------------+
| X-Cart                                                                      |
| Copyright (c) 2001-2009 Ruslan R. Fazliev <rrf@rrf.ru>                      |
| All rights reserved.                                                        |
+-----------------------------------------------------------------------------+
| PLEASE READ  THE FULL TEXT OF SOFTWARE LICENSE AGREEMENT IN THE "COPYRIGHT" |
| FILE PROVIDED WITH THIS DISTRIBUTION. THE AGREEMENT TEXT IS ALSO AVAILABLE  |
| AT THE FOLLOWING URL: http://www.x-cart.com/license.php                     |
|                                                                             |
| THIS  AGREEMENT  EXPRESSES  THE  TERMS  AND CONDITIONS ON WHICH YOU MAY USE |
| THIS SOFTWARE   PROGRAM   AND  ASSOCIATED  DOCUMENTATION   THAT  RUSLAN  R. |
| FAZLIEV (hereinafter  referred to as "THE AUTHOR") IS FURNISHING  OR MAKING |
| AVAILABLE TO YOU WITH  THIS  AGREEMENT  (COLLECTIVELY,  THE  "SOFTWARE").   |
| PLEASE   REVIEW   THE  TERMS  AND   CONDITIONS  OF  THIS  LICENSE AGREEMENT |
| CAREFULLY   BEFORE   INSTALLING   OR  USING  THE  SOFTWARE.  BY INSTALLING, |
| COPYING   OR   OTHERWISE   USING   THE   SOFTWARE,  YOU  AND  YOUR  COMPANY |
| (COLLECTIVELY,  "YOU")  ARE  ACCEPTING  AND AGREEING  TO  THE TERMS OF THIS |
| LICENSE   AGREEMENT.   IF  YOU    ARE  NOT  WILLING   TO  BE  BOUND BY THIS |
| AGREEMENT, DO  NOT INSTALL OR USE THE SOFTWARE.  VARIOUS   COPYRIGHTS   AND |
| OTHER   INTELLECTUAL   PROPERTY   RIGHTS    PROTECT   THE   SOFTWARE.  THIS |
| AGREEMENT IS A LICENSE AGREEMENT THAT GIVES  YOU  LIMITED  RIGHTS   TO  USE |
| THE  SOFTWARE   AND  NOT  AN  AGREEMENT  FOR SALE OR FOR  TRANSFER OF TITLE.|
| THE AUTHOR RETAINS ALL RIGHTS NOT EXPRESSLY GRANTED BY THIS AGREEMENT.      |
|                                                                             |
| The Initial Developer of the Original Code is Ruslan R. Fazliev             |
| Portions created by Ruslan R. Fazliev are Copyright (C) 2001-2009           |
| Ruslan R. Fazliev. All Rights Reserved.                                     |
+-----------------------------------------------------------------------------+
\*****************************************************************************/

#
# $Id: customer_options.php,v 1.34.2.2 2009/05/21 16:14:51 avg Exp $
#

if ( !defined('XCART_SESSION_START') ) { header("Location: ../../"); die("Access denied"); }

if (empty(
$err)) $err "";

$product_options func_get_product_classes($productid, !empty($product_info['is_taxes']));
$product_options_ex func_get_product_exceptions($productid);
$product_options_js = ($product_info["allow_active_content"]) ? func_get_product_js_code($productid) : "";
$variants func_get_product_variants($productid$user_account['membershipid']);

$membershipid = ($current_area == 'C') ? $user_account['membershipid'] : $userinfo['membershipid'];

if (empty(
$options))
    
$options func_get_default_options($productid$product_info['min_amount'], $user_account['membershipid']);

if (!empty(
$product_options) && !empty($options) && is_array($options)) {

    
# Defined preselected options
    
foreach ($product_options as $k => $v) {
        if (
preg_match("/^\d+$/S"$options[$v['classid']])) {
            if (
$v['is_modifier'] == 'T') {
                
$product_options[$k]['default'] = $options[$v['classid']];
            } else {
                
$product_options[$k]['options'][$options[$v['classid']]]['selected'] = 'Y';
            }
        } else {
            
$product_options[$k]['default'] = $options[$v['classid']];
        }
    }

}

if (!empty(
$product_options))
    
$smarty->assign("product_options",$product_options);

if (!empty(
$product_options_ex))
    
$smarty->assign("product_options_ex"$product_options_ex);

$max_avail $product_info['avail'];

if (!empty(
$variants)) {
    
    foreach (
$variants as $v) {

        
$max_avail max($max_avail$v['avail']);

        if (
$v['taxed_price'] != 0) {
            
$smarty->assign("variant_price_no_empty"true);
            break;
        }
    }

    
$smarty->assign("variants"$variants);
}

$smarty->assign("err"$err);
$smarty->assign("product_options_count"is_array($product_options) ? count($product_options) : 0);
$smarty->assign("product_options_js", @trim($product_options_js));
?>
__________________
Version 5.3.1
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 11:00 PM.

   

 
X-Cart forums © 2001-2020