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

Add radio button choice in New Profile page

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 12-09-2010, 05:27 AM
 
bjt bjt is offline
 

Advanced Member
  
Join Date: Jul 2008
Location: Vietnam
Posts: 32
 

Default Add radio button choice in New Profile page

My customer wants to give away a free product upon a new user registering. I've added a custom field entitled "Free gift" and made it a select box with two choices.
What I'd really like to do is make the choices radio buttons instead and include an image of the two products.
So far I have tried adding the two images and the following in the register_additional_info.tpl

<tr>
{foreach from=$v.varients item=o}
<td align="center"><input type="radio" name="additional_values[{$v.fieldid}]" id="additional_values_{$v.fieldid}" value='{$o|escape}'{if $v.value eq $o} checked="checked"{/if}>{$o|escape}
{/foreach}
</tr>

I've basically copied the structure from the code to use a select box, but so far no luck in getting the radio buttons to display. Using standard select box works fine. Any help would be much appreciated.

Cheers,

Brett
__________________
X-Cart Gold 4.3.2 (Windows)
X-Cart Gold Plus 4.6.1 (Linux)
Magic Toolbox slider and zoom
Reply With Quote
  #2  
Old 12-13-2010, 09:50 AM
 
peddler peddler is offline
 

Senior Member
  
Join Date: May 2007
Posts: 140
 

Default Re: Add radio button choice in New Profile page

I can't say for certain, but first glance makes me wonder if your "{if $v.value eq $o}" code is trying to set both radio buttons to checked status?

If so, that's the reason for non-display. Using Name and ID can have strange effects as well, depending upon whether the variables change or stay the same. You want the same name for more than one radio button, if you want to force a choice between the buttons.

Without knowing the variables involved, it's difficult to diagnose, at least for me. Maybe you could look at the page's source code and get a better idea of what the variables end up resolving to, alphanumerically.

hth
__________________
Ralph
X-Cart v4.4.2 Gold (still buggy, some are new ones)
PHP 5.2.13
Reply With Quote

The following user thanks peddler for this useful post:
bjt (12-13-2010)
  #3  
Old 12-13-2010, 10:16 PM
 
bjt bjt is offline
 

Advanced Member
  
Join Date: Jul 2008
Location: Vietnam
Posts: 32
 

Default Re: Add radio button choice in New Profile page

Once again, thanks very much Ralph.
Having both radio buttons selected was part of the problem. The rest was caused by trying to nut this out way too late at night.
One problem was a mis-spelling of the word variant and the other thing I missed was a closing <td>

Here is the working solution:
{foreach from=$v.variants item=o}
<td align="center"><input type="radio" name="additional_values[{$v.fieldid}]" id="additional_values_{$v.fieldid}" value='{$o|escape}'>{$o|escape}</td>
{/foreach}

Kind regards,
Brett
__________________
X-Cart Gold 4.3.2 (Windows)
X-Cart Gold Plus 4.6.1 (Linux)
Magic Toolbox slider and zoom
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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:57 AM.

   

 
X-Cart forums © 2001-2020