Jump to content

Phone Number Product


TeleMagic

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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