Jump to content

SQL Query to show domain prices


smhnaji

Recommended Posts

Hello

I've found the SQL query below but it was posted on 2010 and doesn't seem to work now.

SELECT
   tblpricing.currency,
   tblpricing.msetupfee, tblpricing.qsetupfee, tblpricing.ssetupfee, tblpricing.asetupfee, tblpricing.bsetupfee, tblpricing.monthly, tblpricing.quarterly, tblpricing.semiannually, tblpricing.annually, tblpricing.biennially, 
   (SELECT tblcurrencies.prefix FROM tblcurrencies WHERE id = tblpricing.currency) AS curprefix,
   (SELECT tblcurrencies.suffix FROM tblcurrencies WHERE id = tblpricing.currency) AS cursuffix,
   (SELECT tbldomainpricing.extension FROM tbldomainpricing WHERE id = tblpricing.relid) AS extension
FROM 
   tblpricing
WHERE 
   tblpricing.type= 'domainregister'
AND
   !(SELECT tbldomainpricing.extension FROM tbldomainpricing WHERE id = tblpricing.relid)

Our WHMCS is already 7.2

Would you please help with the new query that should show the following result for us?

Link to comment
Share on other sites

SELECT
	t1.extension, 
	t1.order, 
	t2.type, 
	t2.msetupfee, 
	t3.prefix, 
	t3.suffix 
FROM 
	tbldomainpricing AS t1 
LEFT JOIN 
	tblpricing AS t2 ON t1.id = t2.relid AND t2.type IN ("domainregister", "domaintransfer", "domainrenew") 
LEFT JOIN 
	tblcurrencies AS t3 ON t2.currency = t3.id 
ORDER BY 
	FIELD (t1.extension, ".com", ".net") DESC, 
	`order` DESC, 
	t1.extension 

Tips:

  • It supports multiple currencies therefore you'll get all the available prices
  • Records respect the order you have in Domain Pricing but you can override the default ordering like I did for .com and .net that will always appear on top
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