payless4domains Posted June 20, 2016 Share Posted June 20, 2016 On the clientareaproductdetails.tpl I have a conditional statement that I can't get my head around, using the clients serviced/id. Scenario Customer has purchased 4 of the same products with the same pid/name (let’s call the product – Test). This product has been setup that the 1st time they purchase this product in the cart they fill in custom field (1 & 2), the 2nd time they purchase the product, custom field (3 & 4), the 3rd time purchase the product custom field (5 & 6) and the 4th custom field (7 & The custom fields are dates and reference numbers. I need to be able to show the individual custom fields on the clientareaproductdetails.tpl. The problem is that, and this is what I can’t get my head around, I can’t find a way to call the service ID and allocate the fields needed for that service ID, do I need a hook to do this? And if so does someone have one that will do the trick? Knowing that the service id will always change, I can’t just put a figure. i.e. Purchase 1 - Test, show custom field 1 & 2 Purchase 2 - Test, show custom field 3 & 4 Purchase 3 - Test, show custom field 5 & 6 Purchase 4 - Test, show custom field 7 & 8 Does this make sense? {if $serviceid == '(4th product purchased)'} <input type="text" name="" id="" value="{$clientsdetails.customfields8}" class="form-control" disabled/> <input type="text" name="" id="" value="{$clientsdetails.customfields7}" class="form-control" disabled/> {elseif $serviceid == '(3rd product purchased)'} <input type="text" name="" id="" value="{$clientsdetails.customfields6}" class="form-control" disabled/> <input type="text" name="" id="" value="{$clientsdetails.customfields5}" class="form-control" disabled/> {elseif $serviceid == '(2nd product purchased)'} <input type="text" name="" id="" value="{$clientsdetails.customfields4}" class="form-control" disabled/> <input type="text" name="" id="" value="{$clientsdetails.customfields3}" class="form-control" disabled/> {elseif $serviceid == '(1st product purchased)'} <input type="text" name="" id="" value="{$clientsdetails.customfields2}" class="form-control" disabled/> <input type="text" name="" id="" value="{$clientsdetails.customfields1}" class="form-control" disabled/> {/if} Thanks again Kev 0 Quote Link to comment Share on other sites More sharing options...
twhiting9275 Posted June 20, 2016 Share Posted June 20, 2016 It looks like you're trying to call clientsdetails for something that should honestly be service details. This is setup in the product/service, right? 0 Quote Link to comment Share on other sites More sharing options...
payless4domains Posted June 21, 2016 Author Share Posted June 21, 2016 The custom fields are Client custom fields, there is a long story to this one. They can't be product custom fields. But the issue I'm having is I need to add an {if} statement that shows the appropriate client custom field in relation to the order the product has been purchased, as in the i.e. above. Any idea's? Thanks again for your time. 0 Quote Link to comment Share on other sites More sharing options...
twhiting9275 Posted June 21, 2016 Share Posted June 21, 2016 If they belong to a product, they need to be product custom fields, not client fields. You're only asking for problems like this, and worse, down the road by not properly setting these up from the beginning. 0 Quote Link to comment Share on other sites More sharing options...
payless4domains Posted June 22, 2016 Author Share Posted June 22, 2016 Thanks for your reply. So I change them to product custom fields, will I be able to get the result that I need from the example above? 0 Quote Link to comment Share on other sites More sharing options...
twhiting9275 Posted June 22, 2016 Share Posted June 22, 2016 You'll be able to show the additional fields on the service page, or specifically that service's page, yes. Alternatively, you can probably throw a quick hook together to get what you need done, but you really want to make sure that this is associated with the correct product (ie: in the product custom fields) before you do that 0 Quote Link to comment Share on other sites More sharing options...
payless4domains Posted June 24, 2016 Author Share Posted June 24, 2016 Thank you all fixed. On another topic, this should also be easy, I've manually added custom fields to our cart.tpl but I would like to make some of them required fields. I've tried {$required} and {{customfield.required} but neither work, I can't seem to find the answer to this anywhere. {foreach key=num item=customfield from=$customfields} {if $customfield.name eq "SMS Number"} <div class="form-group"> <label class="control-label">SMS Mobile No (e.g. +61 412345678)</label> <div class="control">{$customfield.input} {$required} </div> </div> {/if} {/foreach} 0 Quote Link to comment Share on other sites More sharing options...
payless4domains Posted June 24, 2016 Author Share Posted June 24, 2016 Worked it out. replace {$customefield.input} with {$customfield.input|replace:'<input ':'<input required '} 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.