X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Product Options Pulldown (https://forum.x-cart.com/showthread.php?t=29292)

grayloon 03-01-2007 11:20 AM

Product Options Pulldown
 
I modified /skin1/modules/Product_Options/customer_options.tpl with the code below to display "Select an option..." in the product options select menu. How/where do I modify the javascript to require a selection before adding to the cart?

Code:

<select id="po{$v.classid}" name="{$poname}"{if $disable} disabled="disabled"{/if}{if $nojs ne 'Y'} onchange="javascript: check_options();"{/if}>
<option value="" selected="selected">Select an option...</option>
{foreach from=$v.options item=o}
    <option value="{$o.optionid}"{if $o.selected eq 'Y'}{/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}
</select>


balinor 03-01-2007 12:49 PM

Re: Product Options Pulldown
 
Not sure about the pro 4.1 version, but in 4.0.x it is done with validation scripts. Have a look at the manual which gives some examples.

grayloon 03-02-2007 05:13 AM

Re: Product Options Pulldown
 
I checked the manual, and it appears to be product specific. My providers are going to be totally lost if I try to explain the necessity and procedure of adding javascript validation scripts for products with options. Anything easier I could do?

balinor 03-02-2007 05:17 AM

Re: Product Options Pulldown
 
I just had X-Cart write me a global product option validation, but it was done for 4.0.18, so that won't help you in 4.1 :(

gfiebich 04-13-2007 06:14 AM

Re: Product Options Pulldown
 
Any chance you'd be willing to share that global validation script? I'm in need of that functionality for a 4.0.18 site.

thanks,
Glen

balinor 04-13-2007 06:17 AM

Re: Product Options Pulldown
 
Yea, I've been meaning to post it in the Completed Custom Mods forum, but haven't had time to extract the custom code out. I may just post the revised files instead of the step by step code edits. I'll post here when I have added the thread.

Dongan 05-05-2007 04:06 AM

Re: Product Options Pulldown
 
Quote:

Originally Posted by balinor
Yea, I've been meaning to post it in the Completed Custom Mods forum, but haven't had time to extract the custom code out. I may just post the revised files instead of the step by step code edits. I'll post here when I have added the thread.


Hi Balinor,

Do you mind sharing it now?

inebriate 05-05-2007 01:25 PM

Re: Product Options Pulldown
 
use DOM...

some pseudocode to get you started (for onsubmit of the add to cart button)
Code:

var selall = boolean(true);
var sel = document.getElementsByTagName("select");
for(i=0;i<sel.length;i++)
{
  if(sel[i].value == "")
  {
      selall = false;
      break;
  }
}
if(sellall)
  add to cart
else
  alert user that they need to select option(s)



All times are GMT -8. The time now is 05:08 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.