tonnybarros Posted March 27, 2016 Share Posted March 27, 2016 I need to create hooks to appear on the customer's product area. I already know it's clientareaproductdetails The problem is the data you need to get the product are the custom field. The product has 6 custom fields. How do I get them in clientareaproductdetails? When I get this data will also need to create a link in clientareaproductdetails in html used data from custom fields. Can anyone help me in this matter? 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted March 28, 2016 Share Posted March 28, 2016 hello, if custom fields is not already exist in that page, you may use ActionHook to query Database, get related Custom Fields, pass it to your template and finally place these custom fields where you need to display them. 0 Quote Link to comment Share on other sites More sharing options...
tonnybarros Posted March 28, 2016 Author Share Posted March 28, 2016 I greatly appreciate their willingness to help. In creating the hook I got, but consult the database I do not know how. Could you give me an initial example, so you can go it alone? 0 Quote Link to comment Share on other sites More sharing options...
tonnybarros Posted March 31, 2016 Author Share Posted March 31, 2016 It could not, is it possible to find someone here to do it for me? I paid for the service. 0 Quote Link to comment Share on other sites More sharing options...
wsa Posted March 31, 2016 Share Posted March 31, 2016 If you look of paying service then you need to post here 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted March 31, 2016 Share Posted March 31, 2016 I think there is no need for ActionHook there as product custom fields are already there, you only need to use something as the following to display these custom fields values where you need it to : {foreach item=customfield from=$productcustomfields} {$customfield.name}: {$customfield.value}<br> {/foreach} 0 Quote Link to comment Share on other sites More sharing options...
tonnybarros Posted March 31, 2016 Author Share Posted March 31, 2016 True, the data already, but could not be visible to the customer. It would be possible to use Base64 encode this data? 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted March 31, 2016 Share Posted March 31, 2016 I'm not sure what do you mean! do you need to display these information or hide/encode it? 0 Quote Link to comment Share on other sites More sharing options...
tonnybarros Posted March 31, 2016 Author Share Posted March 31, 2016 Sorry for my English. I need to show, but encrypted. see if better understood here: http://forums.whmcs.com/showthread.php?112766-I-need-to-create-a-service-module 0 Quote Link to comment Share on other sites More sharing options...
tonnybarros Posted April 3, 2016 Author Share Posted April 3, 2016 I thank everyone, including those who sent me budgets, but managed to solve. I had to create a module, although I have little knowledge, search in whmcs documentation and researched a lot on Google. But anyway, it is ready, it is now possible with this module. * Create the product with external API data * Option to activate the product after payment * Suspension for non-payment * Information in real time the product. It is simple but very functional, see how it went: But still I need help, how can I customize the image of the product, different for each product? This image: 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 4, 2016 Share Posted April 4, 2016 when you say "different image for each product", do you mean that each separate product requires a different image... or that these products are of different types and you want an image for each different type of product? if they're different types, then you could create a series of images and call them type1.png, type2.png etc (or something that makes sense for these products) and then use the image for that product type. 0 Quote Link to comment Share on other sites More sharing options...
tonnybarros Posted April 6, 2016 Author Share Posted April 6, 2016 Yes, I want a different image for each product example, if I had I would have ready 100 100 images a imaagem for each product. It's possible? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 6, 2016 Share Posted April 6, 2016 Yes, I want a different image for each product example, if I had I would have ready 100 100 images a imaagem for each product. It's possible? if you can prepare the images in advance, then you could use the product ID (pid) in the image filename, e.g 45.png where 45 is the pid value of the product - product IDs should be unique, so should be ideal for your situation. 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted April 6, 2016 Share Posted April 6, 2016 Yes, I want a different image for each product example, if I had I would have ready 100 100 images a imaagem for each product. It's possible? it might be possible to use your API for the same purpose too, so images will be called dynamically 0 Quote Link to comment Share on other sites More sharing options...
tonnybarros Posted April 6, 2016 Author Share Posted April 6, 2016 it might be possible to use your API for the same purpose too, so images will be called dynamically Just that the API provides the image. But how do I add it as a product image? I did not find where to edit the image. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 6, 2016 Share Posted April 6, 2016 you could do it in the clientareaproductdetails template - as it will already have access to the $pid value... <img src="{$pid}.png"> so if $pid equals 45, it will try to display 45.png - though you'd have to remember to add the correct path to the image in the above code. 0 Quote Link to comment Share on other sites More sharing options...
tonnybarros Posted April 6, 2016 Author Share Posted April 6, 2016 Sure, but the images are in url formats, and all different, it is still possible? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 6, 2016 Share Posted April 6, 2016 Sure, but the images are in url formats, and all different, it is still possible? i'm unsure what you mean by URL formats - are the images on another server? can you give an example... as I understand it (and working from your screenshots), what you want to do for these products is replace the font-awesome icon that is there currently with a unique image - perhaps you could surround the fa code with an if statement to see if the image exists, if so display it; if not, use the fa icon. 0 Quote Link to comment Share on other sites More sharing options...
tonnybarros Posted April 6, 2016 Author Share Posted April 6, 2016 The image that need to change for each product is this: http://image.prntscr.com/image/dc28ee3af9cc4c81898e6f5e30c7fa9b.png The format received from api's how: https://thumb-cc.s3.envato.com/files/102530217/ajax-chat-system-thumb.jpg If you can use condition has image or not, it would be perfect. I already have the string that contains this image of each product. How to use? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 6, 2016 Share Posted April 6, 2016 unfortunately, you can't use file_exists on external links, only on local files - so if you're intending to use external images, you aren't going to be able to check if they exist before displaying them. if all your products are going to use an external image instead of a fa icon, then that makes it simpler, but not ideal... the better solution would be if these images were local. anyway, in clientareaproductdetails.tpl, this is the code that displays the appropriate font-awesome icon... <span class="fa-stack fa-lg"> <i class="fa fa-circle fa-stack-2x"></i> <i class="fa fa-{if $type eq "hostingaccount" || $type == "reselleraccount"}hdd-o{elseif $type eq "server"}database{else}archive{/if} fa-stack-1x fa-inverse"></i> </span> if your images were local, you would simply do this... {assign "image_exists" "..{$BASE_PATH_IMG}/{$pid}.png"} {if file_exists($image_exists)} <img src="{$image_exists}"> {else} <span class="fa-stack fa-lg"> <i class="fa fa-circle fa-stack-2x"></i> <i class="fa fa-{if $type eq "hostingaccount" || $type == "reselleraccount"}hdd-o{elseif $type eq "server"}database{else}archive{/if} fa-stack-1x fa-inverse"></i> </span> {/if} but if you're going to use external images, then because you can't check if the image exists, you'll need to create an {if} statement based on an existing Smarty variable unique to these products - e.g $product if all these products have the same product name... {assign "image_exists" "..{$BASE_PATH_IMG}/{$pid}.png"} {if $product eq "name"} <img src="{$image_exists}"> {else} <span class="fa-stack fa-lg"> <i class="fa fa-circle fa-stack-2x"></i> <i class="fa fa-{if $type eq "hostingaccount" || $type == "reselleraccount"}hdd-o{elseif $type eq "server"}database{else}archive{/if} fa-stack-1x fa-inverse"></i> </span> {/if} 0 Quote Link to comment Share on other sites More sharing options...
tonnybarros Posted April 6, 2016 Author Share Posted April 6, 2016 Wow, I test the night and give feedback. Must be external, because in case of updated image, no need reupar the image again. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 6, 2016 Share Posted April 6, 2016 btw - for that last block of code, you can remove the assign if the image is external and just put the url in the img src value. 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted April 6, 2016 Share Posted April 6, 2016 I will make small adjustment in Brian code {if $apithumburl} <img src="{$apithumburl}" alt="" width="80" height="80"> {else} <span class="fa-stack fa-lg"> <i class="fa fa-circle fa-stack-2x"></i> <i class="fa fa-{if $type eq "hostingaccount" || $type == "reselleraccount"}hdd-o{elseif $type eq "server"}database{else}archive{/if} fa-stack-1x fa-inverse"></i> </span> {/if} where $apithumburl is your product thumbnail URL, if it has value this code will display it, when empty WHMCS default icon will be displayed. it's easy to pass value to this variable from your addon module. 0 Quote Link to comment Share on other sites More sharing options...
tonnybarros Posted April 7, 2016 Author Share Posted April 7, 2016 My file is in module/servers/code And in php, how do I generate a string {} to put on clientareaproductdetails.tpl? It works well using the code in the server, for example: echo $params['configoption1']; echo "<br>"; echo $params['configoption2']; echo "<br>"; echo $params['configoption3']; echo "<br>"; echo $params['configoption4']; echo "<br>"; echo $params['configoption5 ']; But to put in the clientareaproductdetails.tpl does not work {$params['configoption4']} 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted April 7, 2016 Share Posted April 7, 2016 check the example here: https://github.com/WHMCS/sample-provisioning-module/blob/master/modules/servers/provisioningmodule/provisioningmodule.php#L766 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.