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

Showing SKU in Products descriptions

Started by aseermrmr, February 20, 2020, 07:19:26 AM

Previous topic - Next topic

aseermrmr

Hi , i am really sorry for keep asking
i was searching for the problem before i post this topic
nothing show how to do it with step by step , or where to post the code
i want to show the SKU under the price in the products page as this attachment
any help with that please and explain where to drop the code
thanks in advance

GJC Web Design

details

echo '<div id="skudiv">SKU: '.$this->product->product_sku.' </div>';

cat view

echo '<div class="skudiv">SKU: '.$product->product_sku.'</div>';

where depends entirely on your template but obviously in the default.php of the over rides
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

aseermrmr

thank you so much sir

where to insert it , in what line ?
i am new with coding :)
i saw this word ( over rides ) what dose this mean ?
and what is the directory for this file default.php is it the the template or on the main component

thank you so much for helping me 

aseermrmr

i managed to know how is the overide work
and i have added that code and it looks now like this

6BTA Piston
Sales price $25.00
'
SKU: '.$this->product->product_sku.'
';

Product Description
Cummins 4BTA 6BTA 3802100

http://www.depqs.com/index.php/left-menue/cummins/6bta-piston-2-detail

what is the wrong
here is the code :

<div class="ttr_prodes_Price">
<?php     
    // Product Price started    
    echo shopFunctionsF::renderVmSubLayout('prices',array('product'=>$this->product,'currency'=>$this->currency));
    // Product Price Ends
    ?>

</div>
'<div id="skudiv">SKU: '.$this->product->product_sku.' </div>';
<?php

aseermrmr

i fix it with this code
<?php echo $this->product->product_sku ?>

really thank you so much sir

aseermrmr

but sir where i can find the next one as this picture
i don't know in what file

Studio 42

IN /components/com_virtuemart/sublayouts/products.php
You can override in template too  /templates/yourtemplate/html/com_virtuemart/sublayouts/products.php

aseermrmr

yes i did that but the site didn't work after my change
where i should insert it ?
i want it after the products name

can you help me to change it

here is my code :

Quote<?php
defined('_JEXEC') or die('Restricted access');
$products_per_row = $viewData['products_per_row'];
$app = JFactory::getApplication();
$template_path = JPATH_BASE . "/templates/" . $app->getTemplate().'/params.ini';
$ini_array = parse_ini_file($template_path);
$addtocart = $ini_array['addtocartbuttonindex'];
$products_per_row = $viewData['products_per_row'];
if( $products_per_row > 0 )
{
$lg = $products_per_row;
$sm = $products_per_row;
$xs = 1;
}else
{
$lg = 4;
$sm = 4;
$xs = 1;
}
$class_suffix_lg  = round((12 / $lg));
$class_suffix_sm  = round((12 / $sm));
$class_suffix_xs  = round((12 / $xs));
$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
   
    }
   $cellwidth = ' width'.floor ( 100 / $products_per_row );
   $BrowseTotalProducts = count($products);
   $col = 1;
   $nb = 1;
   $row = 1;
   $columncounter = 0;
   foreach ( $products as $product ) {
   if ($col == 1 && $nb > $products_per_row) { ?>   
   <div class="horizontal-separator"></div>
      <?php }
         if ($col == 1) { ?>
      <div class="row">
         <?php }
         if ($nb == $products_per_row or $nb % $products_per_row == 0) {
            $show_vertical_separator = ' ';
         } else {
            $show_vertical_separator = $verticalseparator;
         }
    ?>       
   <div class="col-lg-<?php echo $class_suffix_lg;?> col-md-<?php echo $class_suffix_lg;?> col-sm-<?php echo $class_suffix_sm;?> col-xs-<?php echo $class_suffix_xs;?>">
      <article class="ttr_post">
         <div class="ttr_post_content_inner">
         <div class="ttr_article grid">
         
      <a title="<?php echo $product->product_name ?>" href="<?php echo $product->link.$ItemidStr; ?>" class="product-image">
      <?php echo $product->images[0]->displayMediaThumb('', false); ?>
      </a> 
      <div class="product-shop">
         <div class="product-shop-margin postcontent">
            <div class="ttr_post_inner_box">
               <div style="height:0px;width:0px;overflow:hidden;-webkit-margin-top-collapse: separate;"></div>            
               <h2 class="ttr_post_title">
                  <?php echo JHtml::link ($product->link.$ItemidStr, $product->product_name); ?>
               </h2>
               <div style="height:0px;width:0px;overflow:hidden;-webkit-margin-top-collapse: separate;"></div>
            </div>
      <?php echo shopFunctionsF::renderVmSubLayout('prices',array('product'=>$product,'currency'=>$currency)); ?>
      <?php echo shopFunctionsF::renderVmSubLayout('addtocart',array('product'=>$product,'rowHeights'=>$rowsHeight[$row], 'position' => array('ontop', 'addtocart'))); ?>
      </div>
      </div>   
   </div>   
   </div>         
   </article>
   </div>    
   <?php 
   $columncounter++;
   $nb ++;
   if( $lg != 0 || $sm != 0 || $xs != 0)
   {
   if(($columncounter) % $lg == 0) 
   {?>
   <div style="clear: both;" class="visible-xs-block"></div>
   <div style="clear: both;" class="visible-md-block"></div>
   <?php
   }   
   elseif(($columncounter) % $sm == 0) 
   {?>
      <div style="clear: both;" class="visible-sm-block"></div>
   <?php
   }
   elseif(($columncounter) % $xs == 0)
   {?>
      <div style="clear: both;" class="visible-xs-block"></div>
   <?php
   }
   }
    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){
    ?>
   <div class="clear"></div>
   </div>
    <?php
     }
   }
?>

GJC Web Design

               <h2 class="ttr_post_title">
                  <?php echo JHtml::link ($product->link.$ItemidStr, $product->product_name); ?>
               </h2>
<?php echo '<div class="skudiv">SKU: '.$product->product_sku.'</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

aseermrmr

sir
thank you so much for your help
it works great
thank you again

aseermrmr

one more sir please

in your code there is SKU word and i change it to part No

how i can do the same for the first code this one :
   <h1 itemprop="name" class="ttr_Prodes_Title"><?php echo $this->product->product_name ?></h1>
    <?php // Product Title END   ?>
   
</div>
<?php echo $this->product->product_sku ?>

GJC Web Design

<?php echo 'Part No: '.$this->product->product_sku; ?>
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

aseermrmr