| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Add radio button choice in New Profile page | |||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
![]() 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 |
|||||||
#2
|
|||||||
|
|||||||
![]() 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 |
|||||||
|
#3
|
|||||||
|
|||||||
![]() 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 |
|||||||
|
|||
X-Cart forums © 2001-2020
|