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
  #11  
Old 04-05-2006, 03:29 AM
 
balinor balinor is offline
 

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

Default

Hey thanks Yes, I'm a big fan of clean and simple.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #12  
Old 04-19-2006, 08:25 PM
 
mffowler mffowler is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Melbourne, Australia
Posts: 811
 

Default

In 4.1.0, the "{if $o.selected eq 'Y'} selected="selected"{/if}" forces the first option to be selected and ignores my added "option". You simply have to move "{if $o.selected eq 'Y'} selected="selected"{/if}" from the looped option to the title option that you added.

I didn't notice this being forced prior to 4.1, but the code was there prior. There must be something that prevented the forced selection in previous versions that is fixed now.

- Mike
__________________
4.1.9
Reply With Quote
  #13  
Old 04-27-2006, 01:37 PM
 
nfc5382 nfc5382 is offline
 

X-Adept
  
Join Date: Nov 2002
Posts: 478
 

Default

can we add the javascript code anywhere in a global spot to alert, with a generic message, if the first item is selected? Instead of having to add the validation code in the product options for each product and changing the 'poNNNN', etc....
__________________
-----------------------
x-cart v4.7.6 [LIVE]
x-cart v4.0.18 [retired 2004-2016]
x-cart v3.5.13 [retired]
x-cart v3.4.14 [retired]
Reply With Quote
  #14  
Old 04-27-2006, 09:34 PM
 
mffowler mffowler is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Melbourne, Australia
Posts: 811
 

Default

You can import the javascript validation in 4.1.x if that helps. Otherwise there are probably some options about the forum.

- Mike
__________________
4.1.9
Reply With Quote
  #15  
Old 05-02-2006, 08:29 AM
 
HEK HEK is offline
 

Member
  
Join Date: Jul 2005
Posts: 23
 

Default

Hi Mike and everybody,

thats amazing mod, thanks Mike.
I have a question if customer choose ONLY one option
so they can only choose color option or size option.
What can i do?

--HEK
__________________
HEK

X-Cart 4.1.3 Gold
PHP 4.3.11
MySQL server 4.0.27
Reply With Quote
  #16  
Old 05-13-2006, 02:41 AM
 
mffowler mffowler is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Melbourne, Australia
Posts: 811
 

Default

If you create the validation for each (and all) options, then it isn't possible to select only one option.

- Mike
__________________
4.1.9
Reply With Quote
  #17  
Old 07-25-2007, 05:57 AM
 
Steve-C Steve-C is offline
 

Senior Member
  
Join Date: Jan 2006
Location: England
Posts: 172
 

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

Thanks Mike. Great Mod. Just what I needed.
__________________
X-Cart Gold v 4.3.2
X-AOM, Marketing Manager, On Sale
Reply With Quote
  #18  
Old 07-25-2007, 08: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..."

Wow. Lovely mod. Very useful. Thank you.

Post #12 is required reading to make this work for 4.1.x


Here are the changes I made to my customer_options.tpl, as a reference (version 4.1.8 )

FIND:
Code:
{foreach from=$v.options item=o} <option value="{$o.optionid}"{if $o.selected eq 'Y'} selected="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 plain_text_message=1}{else}{$o.price_modifier}%{/if}){/if}</option> {/foreach}

REPLACE WITH:
Code:
{* I have 2 products that have a single-color option -- they will someday have more than one so I need to exclude these 2 products from this mod... if you don't need to exclude any products, make the next line go away *} {if $product.productid ne '9' && $product.productid ne '3' } {* BEGIN "PLEASE SELECT" MOD *} <option>Please Select Your {$v.classtext|default:$v.class}...{if $o.selected eq 'Y'} selected="selected"{/if}</option> {/if} {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}

Mike -- this a GREAT addition. Thank you!
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #19  
Old 07-25-2007, 09:41 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..."

Mike (or any javascript expert):

In Firefox/Mac (only) the warning popup box hugs the top of the window. IN every other browser (including Firefox/win, Safari/mac, MSIE 6/7) the box either centers on the display or is at a position to be visible to the user.

Is this a default of the error popup box, or do you know if it's possible to position this error box somehwere -- force it to the middle of the screen, or x=300 y=300 or something besides huging the top of the window (as it does in Firefox/mac). This may be a Firefox bug -- but it may be solved with a line of code that forces the error ox where we want it.

Any ideas?

Thanks!

Jeremy
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #20  
Old 07-25-2007, 11:22 AM
 
inebriate inebriate is offline
 

eXpert
  
Join Date: May 2006
Posts: 301
 

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

you should use document.getElementsByTagName("select") rather than using product option id's since some products may have multiple options

that will return an array of all the elements that have the <select> tags

you would then loop through each array element's value and if it equals "noneselected" (replace with the value you used for the default none selected option, if it doesnt have a value, assign one) or you can compare with the index equaling 0

if the loop stumbles upon just 1 thats not selected, break the loop and throw an error message
__________________
x-cart pro 4.0.18
linux
www.fabric8d.com (currently undergoing construction)
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 09:33 AM.

   

 
X-Cart forums © 2001-2020