News:

Support the VirtueMart project and become a member

Main Menu

Add product description in Category layout

Started by kristijan, June 29, 2015, 10:57:28 AM

Previous topic - Next topic

kristijan

How do I just show the full or short product detail on the category page.

I got Joomla! 3.4.1 with Virtuemart 3.0.6.4,
i  made a menu item with Virtuemart->Category Layout, and want to display the product details in that page.

I'm searching for 3 days now, and nothing helps.
Please help

GJC Web Design

if desc aren't showing in your template then you need to make a template over ride for the products sublayout ( components\com_virtuemart\sublayouts\products.php ) and add the call the sh desc

look at the standard template - something like 

<div class="vm-product-descr-container-<?php echo $rowsHeight[$row]['product_s_desc'?>">
<h2><?php echo JHtml::link ($product->link.$ItemidStr$product->product_name); ?></h2>
<?php if(!empty($rowsHeight[$row]['product_s_desc'])){
?>

<p class="product_s_desc">
<?php // Product Short Description
if (!empty($product->product_s_desc)) {
echo shopFunctionsF::limitStringByWord ($product->product_s_desc60' ...'?>

<?php ?>
</p>
<?php  ?>
</div>
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

kristijan

here is the link of the page: http://centrofruta.com.mk/trimeks/index.php/2015-06-11-12-10-53
just made the changes but it still doesent show up, im i puting it in the right place (its for category view to show short desc for products):

<?php
/**
* sublayout products
*
* @package   VirtueMart
* @author Max Milbers
* @link http://www.virtuemart.net
* @copyright Copyright (c) 2014 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL2, see LICENSE.php
* @version $Id: cart.php 7682 2014-02-26 17:07:20Z Milbo $
*/

defined('_JEXEC') or die('Restricted access');
$products_per_row = $viewData['products_per_row'];
$currency = $viewData['currency'];
$showRating = $viewData['showRating'];
$verticalseparator = " vertical-separator";
echo shopFunctionsF::renderVmSubLayout('askrecomjs');

$ItemidStr = '';
$Itemid = shopFunctionsF::getLastVisitedItemId();
if(!empty($Itemid)){
   $ItemidStr = '&Itemid='.$Itemid;
}

foreach ($viewData['products'] as $type => $products ) {

   $rowsHeight = shopFunctionsF::calculateProductRowsHeights($products,$currency,$products_per_row);

   if(!empty($type) and count($products)>0){
      $productTitle = vmText::_('COM_VIRTUEMART_'.strtoupper($type).'_PRODUCT'); ?>
<div class="<?php echo $type ?>-view">
  <h4><?php echo $productTitle ?></h4>
      <?php // Start the Output
    }

   // Calculating Products Per Row
   $cellwidth = ' width'.floor ( 100 / $products_per_row );

   $BrowseTotalProducts = count($products);

   $col = 1;
   $nb = 1;
   $row = 1;

   foreach ( $products as $product ) {

      // Show the horizontal seperator
      if ($col == 1 && $nb > $products_per_row) { ?>
   <div class="horizontal-separator"></div>
      <?php }

      // this is an indicator wether a row needs to be opened or not
      if ($col == 1) { ?>
   <div class="row">
      <?php }

      // Show the vertical seperator
      if ($nb == $products_per_row or $nb % $products_per_row == 0) {
         $show_vertical_separator = ' ';
      } else {
         $show_vertical_separator = $verticalseparator;
      }

    // Show Products ?>
   <div class="product vm-col<?php echo ' vm-col-' . $products_per_row . $show_vertical_separator ?>">
      <div class="spacer">
         <div class="vm-product-media-container">

               <a title="<?php echo $product->product_name ?>" href="<?php echo $product->link.$ItemidStr; ?>">
                  <?php
                  echo $product->images[0]->displayMediaThumb('class="browseProductImage"', false);
                  ?>
               </a>

         </div>

         <div class="vm-product-rating-container">
            <?php echo shopFunctionsF::renderVmSubLayout('rating',array('showRating'=>$showRating, 'product'=>$product));
            if ( VmConfig::get ('display_stock', 1)) { ?>
               <span class="vmicon vm2-<?php echo $product->stock->stock_level ?>" title="<?php echo $product->stock->stock_tip ?>"></span>
            <?php }
            echo shopFunctionsF::renderVmSubLayout('stockhandle',array('product'=>$product));
            ?>
         </div>


            <div class="vm-product-descr-container-<?php echo $rowsHeight[$row]['product_s_desc'] ?>">
               <h2><?php echo JHtml::link ($product->link.$ItemidStr, $product->product_name); ?></h2>
               <?php if(!empty($rowsHeight[$row]['product_s_desc'])){
               ?>
               <p class="product_s_desc">
                  <?php // Product Short Description
                  if (!empty($product->product_s_desc)) {
                     echo shopFunctionsF::limitStringByWord ($product->product_s_desc, 60, ' ...') ?>
                  <?php } ?>
               </p>
         <?php  } ?>
            </div>


         <?php //echo $rowsHeight[$row]['price'] ?>
         <div class="vm3pr-<?php echo $rowsHeight[$row]['price'] ?>"> <?php
            echo shopFunctionsF::renderVmSubLayout('prices',array('product'=>$product,'currency'=>$currency)); ?>
            <div class="clear"></div>
         </div>
         <?php //echo $rowsHeight[$row]['customs'] ?>
         <div class="vm3pr-<?php echo $rowsHeight[$row]['customfields'] ?>"> <?php
            echo shopFunctionsF::renderVmSubLayout('addtocart',array('product'=>$product,'rowHeights'=>$rowsHeight[$row])); ?>
         </div>

         <div class="vm-details-button">
            <?php // Product Details Button
            $link = empty($product->link)? $product->canonical:$product->link;
            echo JHtml::link($link.$ItemidStr,vmText::_ ( 'COM_VIRTUEMART_PRODUCT_DETAILS' ), array ('title' => $product->product_name, 'class' => 'product-details' ) );
            //echo JHtml::link ( JRoute::_ ( 'index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id=' . $product->virtuemart_product_id . '&virtuemart_category_id=' . $product->virtuemart_category_id , FALSE), vmText::_ ( 'COM_VIRTUEMART_PRODUCT_DETAILS' ), array ('title' => $product->product_name, 'class' => 'product-details' ) );
            ?>
         </div>

      </div>
   </div>
   
   <div class="vm-product-descr-container-<?php echo $rowsHeight[$row]['product_s_desc'] ?>">
               <h2><?php echo JHtml::link ($product->link.$ItemidStr, $product->product_name); ?></h2>
               <?php if(!empty($rowsHeight[$row]['product_s_desc'])){
               ?>
               <p class="product_s_desc">
                  <?php // Product Short Description
                  if (!empty($product->product_s_desc)) {
                     echo shopFunctionsF::limitStringByWord ($product->product_s_desc, 60, ' ...') ?>
                  <?php } ?>
               </p>
         <?php  } ?>
            </div>
   
   

   <?php
    $nb ++;

      // Do we need to close the current row now?
      if ($col == $products_per_row || $nb>$BrowseTotalProducts) { ?>
    <div class="clear"></div>
  </div>
      <?php
         $col = 1;
      $row++;
    } else {
      $col ++;
    }
  }

      if(!empty($type)and count($products)>0){
        // Do we need a final closing row tag?
        //if ($col != 1) {
      ?>
    <div class="clear"></div>
  </div>
    <?php
    // }
    }
  }

kristijan

This is for the category layout to show descriptions of the products, it's not for the descriptions in the products page (they are showing fine).

please help if u can

GJC Web Design

yep - correct place

try commenting out the if

  <div class="vm-product-descr-container-<?php echo $rowsHeight[$row]['product_s_desc'?>">
               <h2><?php echo JHtml::link ($product->link.$ItemidStr$product->product_name); ?></h2>
               <?php  // if(!empty($rowsHeight[$row]['product_s_desc'])){
               
?>

               <p class="product_s_desc">
                  <?php // Product Short Description
                //  if (!empty($product->product_s_desc)) {
                     
echo shopFunctionsF::limitStringByWord ($product->product_s_desc60' ...'?>

                  <?php // } ?>
               </p>
         <?php  //  } ?>
            </div>
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

kristijan

The code You sent me is already there, i just see that, it's a bit higher in the code of where i put the same code.
So is there any other suggestions on how to solve this.

kristijan

Can i send You the link of my site with user and pass to have a better look?
I'm using a template that i bought with integrated virtuemart btw.

kristijan

Thank You for the help.

I found the correct file. I should have mentioned that i was working on a template with integrated VM.

The path was:        /public_html/trimeks/templates/glenon/html/com_virtuemart/sublayouts/products.php

When i change the:

<div class="vm-product-descr-container-<?php echo $rowsHeight[$row]['product_s_desc'] ?>">
               <h3><?php echo JHtml::link ($product->link, $product->product_name); ?></h3>
               <?php if(!empty($rowsHeight[$row]['product_s_desc'])){
               ?>
         <?php  } ?>
            </div>

With this one:

<div class="vm-product-descr-container-<?php echo $rowsHeight[$row]['product_s_desc'] ?>">
               <h2><?php echo JHtml::link ($product->link.$ItemidStr, $product->product_name); ?></h2>
               <?php  // if(!empty($rowsHeight[$row]['product_s_desc'])){
               ?>
               <p class="product_s_desc">
                  <?php // Product Short Description
                //  if (!empty($product->product_s_desc)) {
                     echo shopFunctionsF::limitStringByWord ($product->product_s_desc, 60, ' ...') ?>
                  <?php // } ?>
               </p>
         <?php  //  } ?>
            </div>

All was good   ;D ;D ;D

BTW if u want a longer description just change the number 60 to what ever number You want
example: echo shopFunctionsF::limitStringByWord ($product->product_s_desc, 200, ' ...') ?>