gavingwatson Posted January 7 Share Posted January 7 Hello, I am trying to deeplink directly to the cart with some configurable options preset, which I am able to do successfully, all good. But what I need to achieve is that, by passing something in the URL, it makes the configurable options read only (so the customer cannot update them). The reason for this is that we are making some offers on our site which are available immediately (instant provisioning) but if they then alter anything on the cart, the *may* think that it is still instantly provisioned, it it will no longer be. My solution to this, according to WHMCS support, would be to pass an additional option in the URL (such as &readonly=1 or similar) and pick that up in configureproduct.tpl with an if statement to make the Configurable Options read-only. My question is, where in the following code would I add the code for that? {if $configoption.optiontype eq 1} <div class="col-sm-6"> <div class="form-group"> <label for="inputConfigOption{$configoption.id}">{$configoption.optionname}</label> <select name="configoption[{$configoption.id}]" id="inputConfigOption{$configoption.id}" class="form-control"> {foreach key=num2 item=options from=$configoption.options} <option value="{$options.id}"{if $configoption.selectedvalue eq $options.id} selected="selected"{/if}> {$options.name} </option> {/foreach} </select> </div> </div> If it were pure PHP I could work it out, along the lines of (for example): $readonly = $_GET['readonly']; if ($readonly == "1") { echo ' <option value="{$options.id}"{if $configoption.selectedvalue eq $options.id} selected="selected" readonly{/if}> {$options.name} </option>'; } else { echo '<option value="{$options.id}"{if $configoption.selectedvalue eq $options.id} selected="selected"{/if}> {$options.name} </option>'; } (Sorry, can't convert that to code for some reason). So my question is, in the .tpl file, how would I pick up the variable in the URL and add that logic? Thanks in advance. 0 Quote Link to comment Share on other sites More sharing options...
Solution gavingwatson Posted January 7 Author Solution Share Posted January 7 I actually figured that out by using this: <div class="col-sm-6"> <div class="form-group"> <label for="inputConfigOption{$configoption.id}">{$configoption.optionname}</label> <select name="configoption[{$configoption.id}]" id="inputConfigOption{$configoption.id}" class="form-control" {if $productinfo.pid eq 21} disabled=""}{/if}{if $productinfo.pid eq 65} disabled=""}{/if}> {foreach key=num2 item=options from=$configoption.options} <option value="{$options.id}"{if $configoption.selectedvalue eq $options.id} selected="selected" {/if}> {$options.name} </option> {/foreach} </select> </div> </div> (I added this part : {if $productinfo.pid eq 21} disabled=""}{/if}{if $productinfo.pid eq 65} disabled=""}{/if} 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.