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
  #41  
Old 01-28-2010, 10:43 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..."

well, you shouldn't...


read it carefully.... .tpl not php
__________________
xcart 5.1.2
Reply With Quote
  #42  
Old 01-28-2010, 10:47 AM
 
delboy2028 delboy2028 is offline
 

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

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

sorry thank you
__________________
Version 5.3.1
Reply With Quote
  #43  
Old 01-28-2010, 10:49 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..."

note that this will only add a select option to all product options.

YOu will still need to add appropriate javascript
__________________
xcart 5.1.2
Reply With Quote
  #44  
Old 01-28-2010, 10:52 AM
 
delboy2028 delboy2028 is offline
 

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

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

thanks
__________________
Version 5.3.1
Reply With Quote
  #45  
Old 01-28-2010, 10:56 AM
 
delboy2028 delboy2028 is offline
 

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

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

javascript to each product?
__________________
Version 5.3.1
Reply With Quote
  #46  
Old 01-28-2010, 01:02 PM
  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..."

yes to each one... does every product ahve a color option?
__________________
xcart 5.1.2
Reply With Quote
  #47  
Old 01-29-2010, 01:55 PM
 
delboy2028 delboy2028 is offline
 

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

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

Quote:
Originally Posted by Ashley
yes to each one... does every product ahve a color option?

yes
__________________
Version 5.3.1
Reply With Quote
  #48  
Old 02-21-2010, 10:59 PM
 
spence88mph spence88mph is offline
 

Advanced Member
  
Join Date: Jan 2005
Posts: 95
 

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

I'll drag this up again....

there's gotta be a better error chjeck than placing it it in every product entry? no? dammit!
__________________
-------------------
4.2.2
4.1.9
Reply With Quote
  #49  
Old 02-22-2010, 01:18 AM
 
spence88mph spence88mph is offline
 

Advanced Member
  
Join Date: Jan 2005
Posts: 95
 

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

OK, so I just added a blank value to the option:

<option value="">Select {$v.classtext|default:$v.class}...</option>

now it uses the xcart javascript error which I changed to: Please select size and colour. Works a chalm.
__________________
-------------------
4.2.2
4.1.9
Reply With Quote

The following user thanks spence88mph for this useful post:
vasilis (06-19-2010)
  #50  
Old 06-19-2010, 09:44 AM
  vasilis's Avatar 
vasilis vasilis is offline
 

X-Adept
  
Join Date: Feb 2009
Posts: 761
 

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

Getting the idea from this thread, I came up with an alternative product options validation script for the product options (for a site that I've been working on) that will get any select drop-down elements that their id is something llike "po118", "po119", etc (which is how the option drop-downs are named from x-cart) and display an alert message if the customer has any of these select boxes selected at their 1st option (which could be a hard-coded "select size" option, and not a specific size). So, in this way, the customer is prompted to select for every option drop-down, a specific option (other than the 1st one) in order to be able to proceed to checkout. Actually, I use a regular expression in the getElementById() method. So, someone could even import that script in a massive csv product/variants import and have the same script for each product (which is what I'm planning to do next). The code below is for a product with 2 option groups. Goes without saying, it could be replicated for any number of options.

Code:
var order_Form = document.orderform; // declare our regex var re = new RegExp(/po\d+/); // loop through the form elements for(i = 0; i < order_Form.elements.length; i++){ // execute our regular expression against each element id var m = re.test(order_Form.elements[i].id); if (m) { var matched_id1=order_Form.elements[i].id; var matched_id2=order_Form.elements[i+1].id; // e.g. "po119", i.e. the id of the next option select element if (document.getElementById(matched_id1).selectedIndex == 0) { alert('You must select an optionA for your item.'); return false; } if (document.getElementById(matched_id2).selectedIndex == 0) { alert('You must select an optionB for your item.'); return false; } else return true; } }
__________________
Vasilis Vrontisis
X-Cart Development, Maintenance & Customization
https://[URL="http://www.craftforweb.com"]craftforweb.com[/url]
vasilis@craftforweb.com
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 06:17 AM.

   

 
X-Cart forums © 2001-2020