Hi
Can anyone help here, i am trying to get the shopper group id like 1 and 2 so i can hide some of the content from guests and from det default shopper groups, but it does as it pleases. it works in some part the guests cant see it but the default can.
This is the code in the top:
$user =& JFactory::getUser();
$userId = $user->get('id');
$db = JFactory::getDbo();
$query = 'SELECT `virtuemart_shoppergroup_id` ' . ' FROM `#__virtuemart_vmuser_shoppergroups` ' . ' WHERE `virtuemart_user_id` =' . $userId;
$db->setQuery($query);
$shoppergroup = $db->loadResult();
And this down in the page:
<?php
if (!$shoppergroup == 1 ) {
echo '<div class="width50 floatright"><div><div> </div><div><div></div><div></div><div></div></div>';
} else { ?>
<div class="width50 floatright">
<div class="spacer-buy-area">
<?php // free shipping
include JPATH_THEMES.'/'.$template->template.'/html/com_virtuemart/vt_freeshipping.php';
// Rating
echo '<div class="vt-rating-wrap clearfix text-left">';
echo shopFunctionsF::renderVmSubLayout('rating',array('showRating'=>$this->showRating,'product'=>$this->product));
echo '</div>';
?>
<div class="vt-other-details small clearfix">
<?php
// Manufacturer of the Product
if (VmConfig::get('show_manufacturers', 1) && !empty($this->product->virtuemart_manufacturer_id)) {
echo $this->loadTemplate('manufacturer');
} ?>
<?php if ($sku) {
echo '<div>'.JText::_("COM_VIRTUEMART_PRODUCT_SKU").': '.$this->product->product_sku.'</div>';
} ?>
<?php if ( VmConfig::get ('display_stock', 1)) {
$stocklevel = ($this->product->product_in_stock - $this->product->product_ordered);
if ($instock) {
if ($stocklevel > 0) {
$stockcount = ' <span class="label label-default">'. $stocklevel .'</span>';
echo '<div>'.JText::_("COM_VIRTUEMART_PRODUCT_AVAILABILITY").': '.$stockcount.'</div>';
} else {
$stock = '<i class="fa fa-exclamation-triangle"></i> '.JText::_('TPL_VM_OUTOFSTOCK');
$class= 'nostock';
echo '<div class="'.$class.'">'.JText::_("COM_VIRTUEMART_PRODUCT_AVAILABILITY").': '.$stock.'</div>';
}
} else {
if ($stocklevel > 0) {
$stock = '<i class="fa fa-check-circle"></i> '.JText::_('TPL_VM_INSTOCK');
$class= 'instock';
} else {
$stock = '<i class="fa fa-exclamation-triangle"></i> '.JText::_('TPL_VM_OUTOFSTOCK');
$class= 'nostock';
}
echo '<div class="'.$class.'">'.JText::_("COM_VIRTUEMART_PRODUCT_AVAILABILITY").': '.$stock.'</div>';
}
}?>
</div>
<?php } ?>
Working now!!