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

Product Options Customizaion ?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 08-03-2007, 02:27 PM
 
phoenixrider phoenixrider is offline
 

Member
  
Join Date: Aug 2007
Posts: 15
 

Default Product Options Customizaion ?

I was wondering, if instead of having a drop down list for product options, I could set them up as radio buttons instead? And, also making one required before checkout?
__________________
v 4.1.8
Reply With Quote
  #2  
Old 08-03-2007, 02:52 PM
 
balinor balinor is offline
 

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

Default Re: Product Options Customizaion ?

Sure, just change the code to radio instead of select in the template. modules/product_options/customer_options.tpl.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 08-03-2007, 05:06 PM
 
phoenixrider phoenixrider is offline
 

Member
  
Join Date: Aug 2007
Posts: 15
 

Default Re: Product Options Customizaion ?

Thanks, but I am not sure where in the code to change?

<?php
/************************************************** ***************************\
+-----------------------------------------------------------------------------+
| X-Cart |
| Copyright (c) 2001-2007 Ruslan R. Fazliev <rrf@rrf.ru> |
| All rights reserved. |
+-----------------------------------------------------------------------------+
| PLEASE READ THE FULL TEXT OF SOFTWARE LICENSE AGREEMENT IN THE "COPYRIGHT" |
| FILE PROVIDED WITH THIS DISTRIBUTION. THE AGREEMENT TEXT IS ALSO AVAILABLE |
| AT THE FOLLOWING URL: http://www.x-cart.com/license.php |
| |
| THIS AGREEMENT EXPRESSES THE TERMS AND CONDITIONS ON WHICH YOU MAY USE |
| THIS SOFTWARE PROGRAM AND ASSOCIATED DOCUMENTATION THAT RUSLAN R. |
| FAZLIEV (hereinafter referred to as "THE AUTHOR") IS FURNISHING OR MAKING |
| AVAILABLE TO YOU WITH THIS AGREEMENT (COLLECTIVELY, THE "SOFTWARE"). |
| PLEASE REVIEW THE TERMS AND CONDITIONS OF THIS LICENSE AGREEMENT |
| CAREFULLY BEFORE INSTALLING OR USING THE SOFTWARE. BY INSTALLING, |
| COPYING OR OTHERWISE USING THE SOFTWARE, YOU AND YOUR COMPANY |
| (COLLECTIVELY, "YOU") ARE ACCEPTING AND AGREEING TO THE TERMS OF THIS |
| LICENSE AGREEMENT. IF YOU ARE NOT WILLING TO BE BOUND BY THIS |
| AGREEMENT, DO NOT INSTALL OR USE THE SOFTWARE. VARIOUS COPYRIGHTS AND |
| OTHER INTELLECTUAL PROPERTY RIGHTS PROTECT THE SOFTWARE. THIS |
| AGREEMENT IS A LICENSE AGREEMENT THAT GIVES YOU LIMITED RIGHTS TO USE |
| THE SOFTWARE AND NOT AN AGREEMENT FOR SALE OR FOR TRANSFER OF TITLE.|
| THE AUTHOR RETAINS ALL RIGHTS NOT EXPRESSLY GRANTED BY THIS AGREEMENT. |
| |
| The Initial Developer of the Original Code is Ruslan R. Fazliev |
| Portions created by Ruslan R. Fazliev are Copyright (C) 2001-2007 |
| Ruslan R. Fazliev. All Rights Reserved. |
+-----------------------------------------------------------------------------+
\************************************************* ****************************/
#
# $Id: customer_options.php,v 1.31.2.1 2007/03/22 13:54:55 svowl Exp $
#
if ( !defined('XCART_SESSION_START') ) { header("Location: ../../"); die("Access denied"); }
if (empty($err)) $err = "";
$product_options = func_get_product_classes($productid, !empty($product_info['is_taxes']));
$product_options_ex = func_get_product_exceptions($productid);
$product_options_js = func_get_product_js_code($productid);
$variants = func_get_product_variants($productid, $user_account['membershipid']);
$membershipid = ($current_area == 'C') ? $user_account['membershipid'] : $userinfo['membershipid'];
if (empty($options))
$options = func_get_default_options($productid, $product_info['min_amount'], $user_account['membershipid']);
if (!empty($product_options) && !empty($options) && is_array($options)) {
# Defined preselected options
foreach ($product_options as $k => $v) {
if (preg_match("/^\d+$/S", $options[$v['classid']])) {
if ($v['is_modifier'] == 'T') {
$product_options[$k]['default'] = $options[$v['classid']];
} else {
$product_options[$k]['options'][$options[$v['classid']]]['selected'] = 'Y';
}
} else {
$product_options[$k]['default'] = $options[$v['classid']];
}
}
}
if (!empty($product_options))
$smarty->assign("product_options",$product_options);
if (!empty($product_options_ex))
$smarty->assign("product_options_ex", $product_options_ex);
if (!empty($variants)) {
foreach ($variants as $v) {
if ($v['taxed_price'] != 0) {
$smarty->assign("variant_price_no_empty", true);
break;
}
}
$smarty->assign("variants", $variants);
}
$smarty->assign("err", $err);
$smarty->assign("product_options_count", is_array($product_options) ? count($product_options) : 0);
$smarty->assign("product_options_js", @trim($product_options_js));
?>
__________________
v 4.1.8
Reply With Quote
  #4  
Old 08-03-2007, 06:11 PM
 
balinor balinor is offline
 

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

Default Re: Product Options Customizaion ?

That's the php file, you want the .tpl file. skin1/....
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #5  
Old 08-03-2007, 07:59 PM
 
phoenixrider phoenixrider is offline
 

Member
  
Join Date: Aug 2007
Posts: 15
 

Default Re: Product Options Customizaion ?

Thanks for your help here. Unfortunlatley, I have a non-developer brain. I recognize the select and options, but, I've tried a number of combos to insert a radio control, but I am stuck.

Any possiblity you could post the replace code? Please
__________________
v 4.1.8
Reply With Quote
  #6  
Old 08-03-2007, 10:17 PM
 
inebriate inebriate is offline
 

eXpert
  
Join Date: May 2006
Posts: 301
 

Default Re: Product Options Customizaion ?

first, backup skin1/modules/product_options/customer_options.tpl

then replace
Code:
<select id="po{$v.classid}" name="{$poname}"{if $disable} disabled="disabled"{/if}{if $nojs ne 'Y'} onchange="javascript: check_options();"{/if}> {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} </select>

with
Code:
{foreach from=$v.options item=o} <input id="po{$v.classid}" type="radio" name="{$poname}" value="{$o.optionid}" />{$o.option_name} <br /> {/foreach}


as for having a selection required before checkout, its a bit more involved and it may mess with the form validation since to check if there is something selected for radio buttons you need to loop through all of them
__________________
x-cart pro 4.0.18
linux
www.fabric8d.com (currently undergoing construction)
Reply With Quote
  #7  
Old 08-04-2007, 07:11 AM
 
phoenixrider phoenixrider is offline
 

Member
  
Join Date: Aug 2007
Posts: 15
 

Default Re: Product Options Customizaion ?

Most excellent - many thanks!

I didn't wrap the radio in the 'foreach' statement. Now I know. Thanks again!
__________________
v 4.1.8
Reply With Quote
  #8  
Old 09-08-2007, 07:41 PM
 
hhiker hhiker is offline
 

eXpert
  
Join Date: May 2007
Posts: 231
 

Default Re: Product Options Customizaion ?

This worked great for me, however, there is one thing that I can not get to work. With the drop down box, when you select a color, it changes the product image to that color. With the radio buttons, I can get it to select the default color on load, but I can not get it to change the product image when I select a different color.

Here is the code that was in customer_options.tpl
Code:
<select id="po{$v.classid}" name="{$poname}"{if $disable} disabled="disabled"{/if}{if $nojs ne 'Y'} onchange="javascript: check_options();"{/if}> {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} </select>



I replaced the above with this:
Code:
{foreach from=$v.options item=o} <input id="po{$v.classid}" type="radio" name="{$poname}"{if $disable} disabled="disabled"{/if}{if $nojs ne 'Y'} onchange="javascript: check_options();"{/if} value="{$o.optionid}" {if $o.selected eq 'Y'} checked="checked"{/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} <br /> {/foreach}


Anyone able to help me figure out how to make it change the product image?

Thanks!!!
__________________
-
-
Versions: 4.1.10 and 4.3.0 (see post for which cart)

"Until man duplicates a blade of grass, nature can laugh at his so-called scientific knowledge." - Thomas Edison

"Never doubt that a small group of thoughtful, committed citizens can change the world; indeed, it is the only thing that ever has." - Margaret Mead (1901-197 quoted in John M. RIchardson, ed. Making it Happen, 1982

"Water is the best of all things." - Pindar (c. 522 BC - c. 438 BC), Olympian Odes
Reply With Quote
  #9  
Old 09-09-2007, 01:53 AM
  RichieRich's Avatar 
RichieRich RichieRich is offline
 

X-Adept
  
Join Date: Sep 2004
Location: London, England
Posts: 750
 

Default Re: Product Options Customizaion ?

How do u get the price to display next to each? when they are different prices for variants for example
__________________
Richard


Ultimate 5.4 testing
Reply With Quote
  #10  
Old 09-09-2007, 11:07 AM
 
hhiker hhiker is offline
 

eXpert
  
Join Date: May 2007
Posts: 231
 

Default Re: Product Options Customizaion ?

The replacement code I posted does work with the price modification. However, it will not change the price on the product page nor the image like the drop down box will. I am hoping in the next day or two to have figured out where to change the js to use the radio button instead of the drop down box.

HOWEVER, if you use the code above, it will still add the correct options and option prices to the cart when the customer selects the option they would like and hits add to cart.

Soon as I figure out the js part, I will post back.
__________________
-
-
Versions: 4.1.10 and 4.3.0 (see post for which cart)

"Until man duplicates a blade of grass, nature can laugh at his so-called scientific knowledge." - Thomas Edison

"Never doubt that a small group of thoughtful, committed citizens can change the world; indeed, it is the only thing that ever has." - Margaret Mead (1901-197 quoted in John M. RIchardson, ed. Making it Happen, 1982

"Water is the best of all things." - Pindar (c. 522 BC - c. 438 BC), Olympian Odes
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


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 03:26 PM.

   

 
X-Cart forums © 2001-2020