Jump to content

Product Group Name


BAJI26

Recommended Posts

Is there anyway to get the Product Group Name to place on an external pages?

 

Like how you can get the Product Name: <script language="javascript" src="feeds/productsinfo.php?pid=1&get=name"></script>

Edited by BAJI26
Link to comment
Share on other sites

Is there anyway to get the Product Group Name to place on an external pages?

Like how you can get the Product Name

you may have answered your own question! :)

 

you will need to create/modify a data feed to get the required value from the database.

 

e.g, open up productsinfo.php and add the following *after* the if (is_numeric($pid)) { block of code...

 

if (is_numeric($gid)) {
   $groupresult = select_query("tblproductgroups", "", array("id" => $gid));
   $groupdata = mysql_fetch_array($groupresult);
   $groupname = $groupdata['name'];

}

if ($get=="groupname") widgetoutput($groupname);

when you've done that, you should be able to call the Group Name in a similar way...

 

<script language="javascript" src="feeds/productsinfo.php?pid=1&get=groupname"></script>

as a general rule, you shouldn't edit existing data feeds as they might get overwritten during a WHMCS upgrade - but for testing it's fine!

 

also, there are neater ways to do the query (i.e have 1 joined query instead of 2 separate ones), but the above will work.

Link to comment
Share on other sites

apologies for that, I missed out posting one line from the if (is_numeric($pid)) block of code - the first query needs to get the group ID from the database...

 

in the data feed code, you'll see the following line...

 

    $pid = $data['id'];

directly after that line, add the following..

 

    $gid = $data['gid'];

once you add the line, then the second query can get the correct group name... let me know if it doesn't work now!

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