TeleMagic Posted August 24, 2013 Share Posted August 24, 2013 Hi Guys I am trying to setup a module to allow customer to buy VOIP Did Numbers through my WHMCS site. I have a Joomla site which is integrated with WHMCS and want to create a product page in Joomla that shows the customer a list of available numbers, the customer picks one and it calls the order page using the Direct Shopping Cart link for the VOIP DID product. I need a way to be able to pass the did selected to the pdoduct so that firstly it can be displayed on the list of products and services against the product so customer can distinguis between their different numbers and secondly allow the provisioning module Im going to write to provision the number. I have tried using the &tld={number} in the order link assuimg that would populate the domain field of the product which would achieve the first objective and also would then be a variable for the provisioning module which would take care of the second but this does not seem to work. Any ideas on how I can achieve this? Regards 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted August 25, 2013 Share Posted August 25, 2013 Sure it's possible with a Server/Provisioning Module. It will handle the entire order process (create, suspend, unsuspend, terminate and if you need you can also create new events). Probably you also need an Addon Module in case you want to manage all your VoIP services with an interface inside WHMCS. 0 Quote Link to comment Share on other sites More sharing options...
TeleMagic Posted August 25, 2013 Author Share Posted August 25, 2013 Hi kian Thanks for the reply. The addon module would be great but I want to concentrate on key functionality for now. I have already written a module which creates the actual VoIP accounts and that's working great so I am familiar with provisioning modules, I'm just not sure how to store and display on the product page the did number selected by customer when ordering. Regards 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted August 25, 2013 Share Posted August 25, 2013 Open Product Services, select your VoIP product and visit Custom Fields tab. Create a new text field named for example "VoIP DID Number" and make it hidden (Admin Only). Now you need get the name of this input text. You can make it with FireBug or with any Inspect Element function you have on your browser. You should find something like this: <input type="text" size="30" value="" id="customfield301" name="customfield[301]"> Let's suppose that customfield[301] this is the name of your "VoIP DID Number" field. You also need to get the ID of your product. Let's say that it's 47. Open configureproduct.tpl (or configureproductdomain.tpl in case you also have domain registration option enabled for this product). In the very first lines you should see the form action. Do something like this: <form method="post" action="{$smarty.server.PHP_SELF}?a=add&pid={$pid}{if $pid eq "47"}&customfield[301]={php}echo $_COOKIE["didnumber_coming_from_joomla"];{/php}{/if}"> Let me explain what the code does. If the product is the one with ID 47 (the ID of your VoIP product) the script adds a new argument in the URL named customfield[301] (the name of your custom field) with the value which comes from Joomla. Of course on Joomla you have to ensure that you are passing the value via $_GET, $_POST or $_COOKIE properly to the product page. Imo you should use a cookie so that the visitors can also browse other pages without loosing the value. 0 Quote Link to comment Share on other sites More sharing options...
TeleMagic Posted August 25, 2013 Author Share Posted August 25, 2013 Thanks for that. Thats great. One final query, how do I make it display the did against the product on the list in product & Services? Or do I just update the $domain value in the module. Regards 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.