News:

Support the VirtueMart project and become a member

Main Menu

how to show customfields in sj_vm_ajax_tab

Started by soroush.ktwo, October 18, 2015, 18:53:01 PM

Previous topic - Next topic

soroush.ktwo

hi
i need help to show some of custom fields in item layout of sj_vm_ajax_tab module.

i used this code below but i see error 1064 :

<?php
//MY EDIT STARTS HERE
//make a database connection and find the field record that contains the customfield string
$db JFactory::getDBO();
//please do check in php myadmin how your database table is called and replace it instead of "VM2_virtuemart_product_customfields"
$db->setQuery("SELECT customfield_value FROM xs2om_virtuemart_product_customfields WHERE virtuemart_product_id=".$product->virtuemart_product_id." and virtuemart_custom_id=14 ;");  
$db->query();
$result $db->loadResult();
echo "<span class=\"updatetime\">".$result."</span>";  
?>

</div>


and this code is used to view item layout from module

<?php

defined
('_JEXEC') or die;
$assets_img JURI::root().'templates/'.$template.'/images/rating';

$ratingModel VmModel::getModel('ratings');
$currency CurrencyDisplay::getInstance();
?>

<div class="item-wrap<?php //echo $item_last_css; ?> ajaxtabs-item">
<?php
$img VmAjaxtabsBaseHelper::getVmImage($item$params);
if ($img):?>

<div class="item-image">
<a href="<?php echo $item->link?>"
   title="<?php echo $item->title?>" <?php echo VmAjaxtabsBaseHelper::parseTarget($params->get('item_link_target''_blank')); ?>>
<?php echo VmAjaxtabsBaseHelper::imageTag($img);?>
</a>
</div>
<?php endif; // image display ?>
<div class="product-info">
<?php if ((int)$params->get('item_title_display'1)): ?>
<div class="item-title">
<a href="<?php echo $item->link?>"
   title="<?php echo $item->title?>" <?php echo VmAjaxtabsBaseHelper::parseTarget($params->get('item_link_target''_blank')); ?>>
<?php echo VmAjaxtabsBaseHelper::truncate($item->title$params->get('item_title_max_characs'100)); ?>
</a>
</div>
<?php endif; // title display ?>

                                  </h2>
<div class="product-review">

<?php 


$maxrating VmConfig::get('vm_maximum_rating_scale'5);
if (empty($item->rating)) {
?>

<div class="ratingbox dummy" title="<?php echo vmText::_('COM_VIRTUEMART_UNRATED'); ?>" ></div>
<?php
} else {
$ratingwidth $item->rating 14;
  ?>


<div title=" <?php echo (vmText::_("COM_VIRTUEMART_RATING_TITLE") . round($item->rating) . '/' $maxrating?>" class="ratingbox" >
<div class="stars-orange" style="width:<?php echo $ratingwidth.'px'?>"></div>
</div>
<?php
}
?>



</div>
<?php if ((int)$params->get('item_price_display'1)) { ?>
<div class="item-price">
<?php
if (!empty($item->prices['salesPrice'])) {
echo $currency->createPriceDiv('salesPrice'JText::_("Price: "), $item->pricesfalsefalse1.0true);
}
if (!empty($item->prices['salesPriceWithDiscount'])) {
$currency CurrencyDisplay::getInstance();
echo $currency->createPriceDiv('salesPriceWithDiscount'JText::_("Price: "), $item->pricesfalsefalse1.0true);
?>

</div>
<?php ?>
<?php if ($params->get('item_addtocart_display'1)) { ?>
        <div class="item-addtocart">
            <?php echo shopFunctionsF::renderVmSubLayout('addtocart',array('product'=>$item)); ?>
        </div>
    <?php ?>
    </div>
</div>