Support Team
posted this
20 February 2017
Hello Giuseppe,
you need to incorporate the additional code to the file
<ThemeName>\html\mod_virtuemart_product\default_template.php
Find the code block
<?php
$tmpPrice = (float)$productItems->productBuy->prices['costPrice'];
if (!(VmConfig::get('askprice', true) and empty($tmpPrice))) {
if (isset($productItems->productBuy->orderable) && $productItems->productBuy->orderable) {
$vmLang = VmConfig::get ('vmlang_js', 1) ? '&lang=' . substr (VmConfig::$vmlang, 0, 2) : '';
$attributes = 'data-vmsiteurl="' . JURI::root( ) . '" ' .
'data-vmlang="' . $vmLang . '" ' .
'data-vmsuccessmsg="' . JText::_('COM_VIRTUEMART_CART_ADDED') . '" ' .
'title="' . $productItems->productBuy->product_name . '" ' .
'class="' . $classNames . ' add_to_cart_button" ' .
$buttonDataAttrs;
echo JHTML::link ('#', JText::_ ('COM_VIRTUEMART_CART_ADD_TO'), $attributes);
} else {
$button = JHTML::link ($productItems->productBuy->link, JText::_ ('COM_VIRTUEMART_CART_ADD_TO'),
'title="' . $productItems->productBuy->product_name . '" ' . 'class="' . $classNames . '" ' . $buttonDataAttrs);
if (isset($productItems->productBuy->isOne))
$button = JText::_('COM_VIRTUEMART_ADDTOCART_CHOOSE_VARIANT');
echo $button;
}
}
?>
and replace it with
<?php
$user jfactory::getuser(); if( $user-?>id ){
$user = JFactory::getUser();
$status = $user->guest;
if($status == 1){
echo "Log in om de prijzen te zien.";
}
else
{
// Add To Cart Button
$tmpPrice = (float)$productItems->productBuy->prices['costPrice'];
if (!(VmConfig::get('askprice', true) and empty($tmpPrice))) {
if (isset($productItems->productBuy->orderable) && $productItems->productBuy->orderable) {
$vmLang = VmConfig::get ('vmlang_js', 1) ? '&lang=' . substr (VmConfig::$vmlang, 0, 2) : '';
$attributes = 'data-vmsiteurl="' . JURI::root( ) . '" ' .
'data-vmlang="' . $vmLang . '" ' .
'data-vmsuccessmsg="' . JText::_('COM_VIRTUEMART_CART_ADDED') . '" ' .
'title="' . $productItems->productBuy->product_name . '" ' .
'class="' . $classNames . ' add_to_cart_button" ' .
$buttonDataAttrs;
echo JHTML::link ('#', JText::_ ('COM_VIRTUEMART_CART_ADD_TO'), $attributes);
} else {
$button = JHTML::link ($productItems->productBuy->link, JText::_ ('COM_VIRTUEMART_CART_ADD_TO'),
'title="' . $productItems->productBuy->product_name . '" ' . 'class="' . $classNames . '" ' . $buttonDataAttrs);
if (isset($productItems->productBuy->isOne))
$button = JText::_('COM_VIRTUEMART_ADDTOCART_CHOOSE_VARIANT');
echo $button;
}
}
}
?>
Regards,
Aileen
Hello Giuseppe,
you need to incorporate the additional code to the file
<ThemeName>\html\mod_virtuemart_product\default_template.php
Find the code block
<?php
$tmpPrice = (float)$productItems->productBuy->prices['costPrice'];
if (!(VmConfig::get('askprice', true) and empty($tmpPrice))) {
if (isset($productItems->productBuy->orderable) && $productItems->productBuy->orderable) {
$vmLang = VmConfig::get ('vmlang_js', 1) ? '&lang=' . substr (VmConfig::$vmlang, 0, 2) : '';
$attributes = 'data-vmsiteurl="' . JURI::root( ) . '" ' .
'data-vmlang="' . $vmLang . '" ' .
'data-vmsuccessmsg="' . JText::_('COM_VIRTUEMART_CART_ADDED') . '" ' .
'title="' . $productItems->productBuy->product_name . '" ' .
'class="' . $classNames . ' add_to_cart_button" ' .
$buttonDataAttrs;
echo JHTML::link ('#', JText::_ ('COM_VIRTUEMART_CART_ADD_TO'), $attributes);
} else {
$button = JHTML::link ($productItems->productBuy->link, JText::_ ('COM_VIRTUEMART_CART_ADD_TO'),
'title="' . $productItems->productBuy->product_name . '" ' . 'class="' . $classNames . '" ' . $buttonDataAttrs);
if (isset($productItems->productBuy->isOne))
$button = JText::_('COM_VIRTUEMART_ADDTOCART_CHOOSE_VARIANT');
echo $button;
}
}
?>
and replace it with
<?php
$user jfactory::getuser(); if( $user-?>id ){
$user = JFactory::getUser();
$status = $user->guest;
if($status == 1){
echo "Log in om de prijzen te zien.";
}
else
{
// Add To Cart Button
$tmpPrice = (float)$productItems->productBuy->prices['costPrice'];
if (!(VmConfig::get('askprice', true) and empty($tmpPrice))) {
if (isset($productItems->productBuy->orderable) && $productItems->productBuy->orderable) {
$vmLang = VmConfig::get ('vmlang_js', 1) ? '&lang=' . substr (VmConfig::$vmlang, 0, 2) : '';
$attributes = 'data-vmsiteurl="' . JURI::root( ) . '" ' .
'data-vmlang="' . $vmLang . '" ' .
'data-vmsuccessmsg="' . JText::_('COM_VIRTUEMART_CART_ADDED') . '" ' .
'title="' . $productItems->productBuy->product_name . '" ' .
'class="' . $classNames . ' add_to_cart_button" ' .
$buttonDataAttrs;
echo JHTML::link ('#', JText::_ ('COM_VIRTUEMART_CART_ADD_TO'), $attributes);
} else {
$button = JHTML::link ($productItems->productBuy->link, JText::_ ('COM_VIRTUEMART_CART_ADD_TO'),
'title="' . $productItems->productBuy->product_name . '" ' . 'class="' . $classNames . '" ' . $buttonDataAttrs);
if (isset($productItems->productBuy->isOne))
$button = JText::_('COM_VIRTUEMART_ADDTOCART_CHOOSE_VARIANT');
echo $button;
}
}
}
?>
Regards,
Aileen