Jump to content

Product Data feed with Configurable Options


faisal

Recommended Posts

I have WHMCS installed in subdomain client.domain.com

And I have my main site in the main domain www.domain.com

 

So I wand to make an order form in my main domain for a product group listing all products in it and it's configurable options, then post the chosen options to the WHMCS cart.

 

 

I think it must be done by data feed.

 

 

* I can do it without data feed but I have to fill all data manually then using WHMCS linking method.

But it's going to be annoying.

Edited by faisal
Link to comment
Share on other sites

I think it must be done by data feed.

yes, if it's external to WHMCS, that's probably the easiest way.

 

* I can do it without data feed but I have to fill all data manually then using WHMCS linking method.

But it's going to be annoying.

once you figure out the SQL query, the feed should be straightforward - but the query would have to reference a number of database tables to get all the info you want.

 

if you can't work out the query to use, then you'll either have to post on marketplace and pay someone for help, or use the manual linking method.

Link to comment
Share on other sites

Thanks, If I manage to do it myself I will share the code here.

 

 

Or maybe in the future WHMCS team add (External link) for order in the Links tab for products and products group.

So it can be used without WHMCS header/footer to be add with iframe or included in someway.

 

 

OR if someone pro make "data feed" or "External API" to list/pull a products or products group with Configurable Options in same page to use it in main website and post the entries to WHMCS checkout page.

Link to comment
Share on other sites

Thanks, If I manage to do it myself I will share the code here.

i'm sure that would be appreciated by other users. :idea:

 

OR if someone pro make "data feed" or "External API" to list/pull a products or products group with Configurable Options in same page to use it in main website and post the entries to WHMCS checkout page.

using a data feed to output a list of products for a given product group would be very simple... but you've complicated it by wanting to add configurable options too! :)

 

e.g the data feed code below will output a list of products (linked) for a specified product group...

 

<?php
/*
*** USAGE SAMPLES ***
<script language="javascript" src="feeds/productgroups.php?gid=1"></script>
*/
require("../init.php");
$gid = (int) $whmcs->get_req_var('gid');
$result = "SELECT * FROM tblproducts WHERE tblproducts.gid = $gid AND tblproducts.hidden = 0 ORDER BY tblproducts.order ASC";
$data = mysql_query($result);
while ($row = mysql_fetch_assoc($data)) {
   $code .= '<a href="cart.php?a=add&pid='.$row['id'].'">'.$row['name'].'</a><br />';
}  
echo "document.write('".$code."');";

now let's say you want to add annual pricing to the feed, it then becomes...

 

<?php
/*
*** USAGE SAMPLES ***
<script language="javascript" src="feeds/productgroups.php?gid=1"></script>
*/
require("../init.php");
$gid = (int) $whmcs->get_req_var('gid');
$result = "SELECT
tblproducts.id,
tblproducts.gid,
tblproducts.`name`,
tblproducts.hidden,
tblproducts.order,
tblpricing.annually
FROM tblproducts,
tblpricing
WHERE tblproducts.gid = $gid AND
tblproducts.hidden = 0 AND
tblpricing.relid = tblproducts.id AND
tblpricing.type = 'product' AND
tblpricing.annually != -1
ORDER BY tblproducts.order ASC";
$data = mysql_query($result);
while ($row = mysql_fetch_assoc($data)) {
   $code .= '<a href="cart.php?a=add&pid='.$row['id'].'">'.$row['name'].'</a> '.$row['annually'].'<br />';
}  
echo "document.write('".$code."');";

... and that's not taking into account multiple billing cycles... or even the currency prefix/suffix, which would need to be looked up on a third table.. :roll:

 

then when it comes to configurable options, you've got upto four more tables to deal with - with some products possibly not having any configurable options, and others having multiples.

 

it certainly wouldn't be impossible to do, but perhaps you can see why such code has never been posted in the forums! :)

 

if I needed to do this, I could work out the correct query - but unless you have a serious amount of products, it might just be easier to manually link them.

Link to comment
Share on other sites

It is true what you are saying, And yes I think every body need this.

 

One simple example

 

Most of us using WHMCS in sub domain/folder and the main website is for Marketing, SEO etc....

 

So a lot of us if not all want to show the products in the main website.

 

If you visit all those main websites you will see that all of them show only the lowest billing cycle and making easy order form with "some/all of the configurable options" for visitors (Marketing), then when somebody click on order it will take him/her to the whmcs final product configure page to fill the rest of configuration if any, change the billing cycle if needed and fill his/her info or login and finally checkout.

 

 

 

 

 

And as you say we can make any external custom order form use the easy WHMCS Linking method. (all product info and pricing hard coded) so if edit any thing in WHMCS you have to go back to the code in main website and modify it manually.

 

We already doing this for a long time :)

 

 

Thank you again brian! for taking the time helping all of us all the time.

Edited by faisal
Link to comment
Share on other sites

It is true what you are saying, And yes I think every body need this.

I don't! :)

 

Most of us using WHMCS in sub domain/folder and the main website is for Marketing, SEO etc....

So a lot of us if not all want to show the products in the main website.

for that, there would be alternatives to using data feeds - e.g., if your main website used WordPress, there is a plugin available, WHMPress, that can show product details, pricing, domain search etc on it.

 

codecanyon.net/item/whmpress-whmcs-wordpress-integration-plugin-/9946066

 

tbh, it's nothing special as for each of those features, it would be simple enough to write a data feed to do an equivalent job - however, for those with no coding experience and using a WordPress site, it could be a time-saver.

 

btw - it doesn't show configurable options... :)

 

And as you say we can make any external custom order form use the easy WHMCS Linking method. (all product info and pricing hard coded) so if edit any thing in WHMCS you have to go back to the code in main website and modify it manually.

as i've shown above, it'd be easy to do that with a data feed - you can get all the setup fees and billing cycles for each product in the same query... it's just a case of how you want to use them... for example, you could make the whole external order form using a data feed, with perhaps a dropdown showing available billing cycles for the chosen product, and changing the link back to whmcs accordingly.

 

Thank you again brian! for taking the time helping all of us all the time.

I do what I can! :idea:

 

if I had the correct sql query to hand, i'd have posted it to save you time - but i've never had the need to figure it out.

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