Jump to content

Disable Radio button? Disable out of stock location selection


DemoTiger

Recommended Posts

you could modify the web20cart/configureproduct.tpl template to check for the phrase "out of stock", and if found, disable the radio button - you would need to replace...

 

{elseif $configoption.optiontype eq 2}
{foreach key=num2 item=options from=$configoption.options}
<label><input type="radio" name="configoption[{$configoption.id}]" value="{$options.id}"{if $configoption.selectedvalue eq $options.id} checked="checked"{/if}>
{$options.name}</label><br />
{/foreach}

with..

 

{elseif $configoption.optiontype eq 2}
{foreach key=num2 item=options from=$configoption.options}
<label><input type="radio" name="configoption[{$configoption.id}]" value="{$options.id}" {if $options.nameonly|strstr:'out of stock'} disabled{elseif $configoption.selectedvalue eq $options.id} checked="checked"{/if}>
{$options.name}</label><br />
{/foreach}

Link to comment
Share on other sites

what if the client area language is not English? i might modify brain's code to this:

{elseif $configoption.optiontype eq 2}
{foreach key=num2 item=options from=$configoption.options}
<label><input type="radio" name="configoption[{$configoption.id}]" value="{$options.id}" {if $options.nameonly|strstr:$LANG.outofstock} disabled{elseif $configoption.selectedvalue eq $options.id} checked="checked"{/if}>
{$options.name}</label><br />
{/foreach}  

Link to comment
Share on other sites

Hi Sentq,

 

what if the client area language is not English?

that wouldn't matter with my code :idea:

 

the "(out of stock)' text that dewlance.com is using is part of the configurable option name - he's not using any language file entry for this... even if he was, it would be "Out of Stock" rather than 'out of stock'.

 

so I think your code would fail - it might work for English if you changed to using stristr; but for other languages, it will certainly not work.

 

that said, there's a possible argument to be had that he could make it multi-language flexible, by using a replace on the $options.name variable and replacing 'out of stock' with the language equivalent... but he didn't ask about doing that! :)

Link to comment
Share on other sites

you could modify the web20cart/configureproduct.tpl template to check for the phrase "out of stock", and if found, disable the radio button - you would need to replace...

 

Many many thanks. Now I can disable location selection with "Out of Stock" text which is very helpful for me.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated