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
  #11  
Old 09-09-2007, 11:24 AM
  RichieRich's Avatar 
RichieRich RichieRich is offline
 

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

Default Re: Product Options Customizaion ?

good job so far, its much clearer with radio buttons, the customer can see it on the page, instead of it being hidden in a drop down they have to click
__________________
Richard


Ultimate 5.4 testing
Reply With Quote
  #12  
Old 09-09-2007, 02:20 PM
 
inebriate inebriate is offline
 

eXpert
  
Join Date: May 2006
Posts: 301
 

Default Re: Product Options Customizaion ?

use
Code:
{foreach from=$v.options item=o} <input id="po{$v.classid}" type="radio" name="{$poname}" value="{$o.optionid}" {if $nojs ne 'Y'} onclick="javascript: check_options();"{/if}/>{$o.option_name} <br /> {/foreach}

to include the javascript for updating the price and image and what not
__________________
x-cart pro 4.0.18
linux
www.fabric8d.com (currently undergoing construction)
Reply With Quote
  #13  
Old 09-09-2007, 02:42 PM
 
hhiker hhiker is offline
 

eXpert
  
Join Date: May 2007
Posts: 231
 

Default Re: Product Options Customizaion ?

Ok, I changed what I had which was:

Code:
{if $nojs ne 'Y'} onchange="javascript: check_options();"{/if}

to (the only difference in your code & mine)

Code:
{if $nojs ne 'Y'} onclick="javascript: check_options();"{/if}

and that did not work to update the prices, etc.
__________________
-
-
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
  #14  
Old 09-10-2007, 01:05 AM
  RichieRich's Avatar 
RichieRich RichieRich is offline
 

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

Default Re: Product Options Customizaion ?

that code didnt update the price
__________________
Richard


Ultimate 5.4 testing
Reply With Quote
  #15  
Old 09-10-2007, 12:16 PM
 
inebriate inebriate is offline
 

eXpert
  
Join Date: May 2006
Posts: 301
 

Default Re: Product Options Customizaion ?

well i checked out the javascript file itself...it seems like using radio options will break a lot of the code, its not going to be as simple as a replace

the problem with using radio inputs is that now a group of options will all share the same id and name, so its going to require more manipulation with DOM or with the naming scheme of the inputs
__________________
x-cart pro 4.0.18
linux
www.fabric8d.com (currently undergoing construction)
Reply With Quote
  #16  
Old 09-10-2007, 12:31 PM
 
hhiker hhiker is offline
 

eXpert
  
Join Date: May 2007
Posts: 231
 

Default Re: Product Options Customizaion ?

I am good, I am not that good. Can you do it for us?!
__________________
-
-
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
  #17  
Old 09-10-2007, 04:38 PM
 
inebriate inebriate is offline
 

eXpert
  
Join Date: May 2006
Posts: 301
 

Default Re: Product Options Customizaion ?

when i have time i will have a crack at it
__________________
x-cart pro 4.0.18
linux
www.fabric8d.com (currently undergoing construction)
Reply With Quote
  #18  
Old 09-11-2007, 11:34 AM
 
pyap pyap is offline
 

Member
  
Join Date: Aug 2004
Posts: 16
 

Default Re: Product Options Customizaion ?

This should be close to what you're looking for. I'm not sure if it works because I have my radio button id's modified. I edited this version to work with the default x-cart installation. At a minimum, this is a good place to start for others.

Change the SELECT elements to INPUT type RADIO as mentioned in previous posts. Then...

In skin1/modules/Product_Options/func.js

Change:

Code:
/* Get product option value */ function getPOValue(c) { if (!document.getElementById('po'+c) || document.getElementById('po'+c).tagName.toUpperCase() != 'SELECT') return false; return document.getElementById('po'+c).options[document.getElementById('po'+c).selectedIndex].value; }

To:

Code:
/* Get product option value -modified */ function getPOValue(c) { if (!document.getElementsByName('product_options['+c+']')) return false; var radios = document.getElementsByName('product_options['+c+']'); for (var i = 0; i < radios.length; i++) { if (radios[i].checked) { return radios[i].value; } } }

Let me know how it goes.

-Scott
__________________
X-Cart 4.1.8 Gold
Windows 2000 server
Reply With Quote
  #19  
Old 09-11-2007, 12:10 PM
 
hhiker hhiker is offline
 

eXpert
  
Join Date: May 2007
Posts: 231
 

Default Re: Product Options Customizaion ?

It works and it works beautifully!

I never really dove into JavaScript after learning too many languages that I never have had a need for. I am getting ready to dive into JavaScript & Ajax as soon as I get time. I have determined I need to.

Thanks so much! That was a very simple fix for those who know JS.
__________________
-
-
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
  #20  
Old 09-11-2007, 12:20 PM
 
hhiker hhiker is offline
 

eXpert
  
Join Date: May 2007
Posts: 231
 

Default Re: Product Options Customizaion ?

Just make sure you put the onclick instead of onchange like last shown in post #13 (thanks inebriate!) or it will not change everything until you click away from the radio button you just clicked.
__________________
-
-
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 08:55 PM.

   

 
X-Cart forums © 2001-2020