I have 4 different user groups. Each usergroup sees a different quantity of the product when they log in. So if someone from usergroup "New York" logs in, he will not see the quantity we have in stock for a user from, let's say "Florida". This is more of an inventory management system I created.
We only have a few clients which use the site so that is why we have 4 different locations and everything works according to usergroups.
However, I'd like have a feature where if I log in and am set to usergroup "New York", and I hover over the quantity in stock for "New York" store, I will see a tooltip appearing which has a small table showing the quantities of the 3 other stores.
How can I go about achieving that based on the following code:
<?php
$max_balance=0;
jimport( 'joomla.user.helper' );
$user = JFactory::getUser();
$groups = $user->get('groups');
if(in_array(15, $groups)) { ?>
<td style="text-align: center;">
<?php
// Get a db connection.
$db = JFactory::getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select all records from the user profile table where key begins with "custom.".
// Order it by the ordering field.
$query->select($db->quoteName(array('customfield_value', 'virtuemart_product_id')));
$query->from($db->quoteName('jos_virtuemart_product_customfields'));
$query->where($db->quoteName('virtuemart_custom_id') . ' LIKE '. $db->quote('10'). ' AND '. $db->quoteName('virtuemart_product_id') . 'LIKE ' . $db->quote($product->virtuemart_product_id));
// Reset the query using our newly populated query object.
$db->setQuery($query);
// Load the results as a list of stdClass objects (see later for more options on retrieving data).
$max_balance =$results = $db->loadResult();
echo ($results);
?>
</td> <?php } ?>
You will notice usergroup number here is "15", it goes up till "18". So the store quantity from each of the stores must be shown in a hover/tooltip element.
If this is too difficult, can I make a duplicate of the category layout page I have customised, and make it non-editable. (Just displaying the information in read-me format).