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

Product Combo Box Issue

 
Reply
   X-Cart forums > X-Cart 5 > General questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 07-15-2016, 12:43 PM
 
Joshshift Joshshift is offline
 

Advanced Member
  
Join Date: Apr 2004
Posts: 53
 

Default Product Combo Box Issue

it used to be in xcart 4 there was a Validation script (JavaScript) box, for which i input something like this:

if (document.getElementById('po573').selectedIndex== 0) {alert('Please select your color.');
return false;}
if (document.getElementById('po574').selectedIndex== 0) {alert('Please select your size.');
return false;}

so i would make the default combo box selection something like:
Please Select...

and if they didnt change the combo box it would throw the customer a message saying make a selection. how is this achieved in xcart5?

Core version: 5.2.15
__________________
X-Cart version 4.4.4
PHP 5.2.17
MySQL server 5.1.56
Reply With Quote
  #2  
Old 07-15-2016, 01:07 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Product Combo Box Issue

XC5 should be using HTML5 out of the box and this is easily done with simple HTML5 rules. No js required.
Unfortunately I don't think XC5 is coded to take advantage of this so you will have to do this yourself via a custom module.
Basically it comes down to adding new <option> tag as first one in the <select> and setting its properties as below

Code:
<select> <option disabled value="" selected>Please Select</option> <option>1</option> <option>2</option> ........ </select>

Here is live example - https://www.cflsystems.com/site-structured-data-for-x-cart-5.html
It is on XC4 but the idea is the same
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following user thanks cflsystems for this useful post:
qualiteam (07-21-2016)
  #3  
Old 07-18-2016, 06:59 AM
 
Joshshift Joshshift is offline
 

Advanced Member
  
Join Date: Apr 2004
Posts: 53
 

Default Re: Product Combo Box Issue

wouldnt that effect every combo box though?
some combo boxes start at a default that doesnt need to be changed, then wouldnt the default value not be selectable?
__________________
X-Cart version 4.4.4
PHP 5.2.17
MySQL server 5.1.56
Reply With Quote
  #4  
Old 07-18-2016, 07:32 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Product Combo Box Issue

It will affect all of them yes but you can limit which ones are affected with your custom module. In XC5 you can't just go an change some code - it has to be done with a module or you lose changes on next upgrade.
Also - this will not have any affect on which option is selected on page load if its value is passed. It will only be the first one to start with if no option is selected by default.
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > General questions (X-Cart 5)


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 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 12:51 PM.

   

 
X-Cart forums © 2001-2020