News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

How to get the shoppergroup id??

Started by Otto0815, April 26, 2012, 18:04:01 PM

Previous topic - Next topic

Otto0815

Hi,

i would like to show some text in the mincart, depending on the shoppergroup....

So i've tried the following:

$db = JFactory::getDbo();
$user   = JFactory::getUser();
$user1 = ($user->get('id'));

$frage = 'SELECT `*` '
                . ' FROM `#__virtuemart_vmuser_shoppergroups` '
                . ' WHERE `virtuemart_user_id` =' .$user1 ;
               
       $frage2->mysql_query($frage);
echo $frage2;

But this doesn't work    (the echo is only for testing, later it should be used in an if query)


Milbo

First you are not using the joomla database connector correctly.

Second, the information is already there imho. Just use vmdebug to print your prices. There are all rules with names listed.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Otto0815

Dunno if it's the correct way but it works:

$db = JFactory::getDbo();
$user   = JFactory::getUser();
$user1 = ($user->get('id'));   
   
      $query = 'SELECT `virtuemart_shoppergroup_id` '
                . ' FROM `#__virtuemart_vmuser_shoppergroups` '
                . ' WHERE `virtuemart_user_id` =' .$user1 ;
 
        $db->setQuery($query, 0, 10);
      
      $result1 = $db->loadResult();
   
   $link = JRoute::_('index.php?option=com_content&view=article&id=74&');
   $text = " zzgl. Versand";
   $text2 =" inkl. 19%MwSt.";
   
   if ( !empty($product['quantity']) ){   echo JHTML::_('link', $link, $text);}
if ($data->totalProduct && $result1 != '3')   echo $text2;

So it shows "inkl. 19% zzgl. Versand" to B2C customers, and if the Customer is B2B (setup as shoppergroup_id "3") then it's only "zzgl. Versand"....