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
  #21  
Old 08-04-2007, 04:26 PM
 
typologist typologist is offline
 

Advanced Member
  
Join Date: Jul 2007
Posts: 51
 

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

When I add the javascript validation, it disables the OUT OF STOCK javascript standard warning, and when a customer chooses a variant that is not in stock, and clicks the Add to cart button, it redirects to the cart (instead of the javascript alert that says OUT OF STOCK).
__________________
4.1.8 Gold (Unix)
Reply With Quote
  #22  
Old 10-23-2007, 11:17 AM
 
TL408 TL408 is offline
 

X-Adept
  
Join Date: Jan 2005
Posts: 549
 

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

Have you had a chance to try this mod with the ver 4.1.9 release? I tried applying your modifications as shown below and added the validation codes below into the "Validation Script (Javascript)" section of the product options.

---------------------------------------------------------------------------------------------------------------------------------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;
---------------------------------------------------------------------------------------------------------------------------------

It doesn't work as expected. Am I missing something? When the customer click "Add to Cart", IE throw up the "error on page" message.

Thanks
-Tuan


Quote:
Originally Posted by carpeperdiem
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!
__________________
Win2003 IIS6, PHP 5.2.3, MySQL 5.0.45 and X-Cart 4.1.9
Reply With Quote
  #23  
Old 10-23-2007, 11:18 AM
 
TL408 TL408 is offline
 

X-Adept
  
Join Date: Jan 2005
Posts: 549
 

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

And this is how my "skin1\modules\Product_Options\customer_options.tp l" file looks.

--------------------------------------------------------------------------------------------------------------------------
{* $Id: customer_options.tpl,v 1.24 2006/04/07 05:19:21 svowl Exp $ *}
{if $product_options 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 id="po{$v.classid}" type="text" name="{$poname}" value="{$v.default|escape}" />
{else}
<select id="po{$v.classid}" name="{$poname}"{if $disable} disabled="disabled"{/if}{if $nojs ne 'Y'} onchange="javascript: check_options();"{/if}>




<option>Please 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 id="exception_msg" 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}
--------------------------------------------------------------------------------------------------------------------------
__________________
Win2003 IIS6, PHP 5.2.3, MySQL 5.0.45 and X-Cart 4.1.9
Reply With Quote
  #24  
Old 01-07-2008, 01:20 PM
 
brandfly brandfly is offline
 

Member
  
Join Date: Nov 2006
Location: San Diego
Posts: 12
 

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

Is there an easier way to do this in 4.1.9? You would think x-cart would already have it so that a customer would have to choose a product option rather than it selecting a default one.
__________________
Thanks.

Dustin // Captain

[ BrandFly ] Design & Other Creative Stuff
BrandFly.com

X-Cart Gold v4.1.1
Reply With Quote
  #25  
Old 01-07-2008, 01:22 PM
 
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..."

read post #12 and #18
__________________
xcart 4.5.4 gold+ w/x-payments 1.0.6; xcart gold 4.4.4
Reply With Quote
  #26  
Old 01-07-2008, 01:45 PM
 
brandfly brandfly is offline
 

Member
  
Join Date: Nov 2006
Location: San Diego
Posts: 12
 

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

Ya, post #12 and #18 work fine, I was just hoping that x-cart would make this an easier fix in future versions. It seems like a simple feature, but oh well, a boy can dream.
__________________
Thanks.

Dustin // Captain

[ BrandFly ] Design & Other Creative Stuff
BrandFly.com

X-Cart Gold v4.1.1
Reply With Quote
  #27  
Old 04-14-2008, 03:17 PM
  jcorneli's Avatar 
jcorneli jcorneli is offline
 

Advanced Member
  
Join Date: Jul 2007
Posts: 74
 

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

I am getting the warning line "Please select your size" as the second line on my drop down and "select size" on my first line. The warning works on line 1 but just returns me when I select line 2. Where did I go wrong?
__________________
www.usapolicesupply.com
v4.6.3

Xcartmods reBoot Template
WebsiteCM CDSEO Pro SEO
BCS Multipe Upselling Links
Firetank Feed Manager

BCS Product Importer Updater Pro
BCS Drop Shipper Pro
BCS Quote Request Module
BCS Printable Online Catalog
Reply With Quote
  #28  
Old 05-18-2008, 09:30 PM
 
sparker2 sparker2 is offline
 

eXpert
  
Join Date: Feb 2007
Posts: 290
 

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

I have version 4.16 and cannot get this to work. when I click on an option nothing happens. It will not add it to the cart.
__________________
Shareen
sparker2@cox.net
http://www.stitches4u.com
X-Cart Version 4.5.0 with Smart Template vs 4.4.x
Reply With Quote
  #29  
Old 12-02-2008, 02:36 PM
 
Doctored Locks Doctored Locks is offline
 

Advanced Member
  
Join Date: Dec 2008
Posts: 42
 

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

First let me say, Thank You!!! This is exactly what I was looking for.

Everything is working but the validation script, and like everyone else I recieve an error when I add it. So for now I am leaving it out.

I'm using Version 4.1.11 and I was wondering if anyone has found a fix for the validation script yet.

Thanks,

Ryan
__________________
Version 4.1.11 Pro
Add-on: X-Affiliate
Add-on: X-RMA
Add-on: X-FancyCategories
Reply With Quote
  #30  
Old 12-12-2008, 10:21 AM
  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 carpeperdiem
Here are the changes I made to my customer_options.tpl...

thanks a bunch carpeperdiem, worked like a charm.

EDIT:

all of the current store items have multiple size options with each size option having its own unique item number.

with this mod in place, the 'item no.' in the details area of an item is defaulting to the the lowest item number.

we would like to have this not be the case UNTIL a size is chosen. any way of having a unique item number along with this mod? or perhaps have the item no. not show until a size is selected? or simply have that field be blank?

i am attaching a pic to hopefully show what i am speaking of.

thanks in advance for any help.
Attached Thumbnails
Click image for larger version

Name:	itemno.JPG
Views:	414
Size:	9.8 KB
ID:	1281  
__________________
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
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:27 AM.

   

 
X-Cart forums © 2001-2020