Author Topic: Virtuemart stock level indicator  (Read 430 times)

gcap

  • Beginner
  • *
  • Posts: 25
  • A beginner
Virtuemart stock level indicator
« on: October 08, 2018, 21:19:28 pm »
Evening All

I have been searching for the topic/post that will tell me exactly where and what to change. This seem to be a question asked a few times but i still dont really understand enough to work it out.

VirtueMart 3.2.14
   Joomla! 3.8.12
www.gardensonwheels.co.za

I am hoping to change the colour bars to an indicator that says 'In Stock: X'

example: http://gardensonwheels.co.za/index.php/shop/seedlings/zinnia

I'm afraid I probably need explanations that will border on frustrating to the brains in this forum but as always, your help and patience is very much appreciated.

Thank you

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8562
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.14
Re: Virtuemart stock level indicator
« Reply #1 on: October 08, 2018, 22:28:10 pm »
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

gcap

  • Beginner
  • *
  • Posts: 25
  • A beginner
Re: Virtuemart stock level indicator
« Reply #2 on: October 09, 2018, 06:00:52 am »
where do I change this code and would i remove anything or just add this?

gcap

  • Beginner
  • *
  • Posts: 25
  • A beginner
Re: Virtuemart stock level indicator
« Reply #3 on: October 09, 2018, 14:03:50 pm »
what file am i looking for to change this?

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8562
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.14
Re: Virtuemart stock level indicator
« Reply #4 on: October 09, 2018, 14:16:10 pm »
wherever the stock is currently displayed in what ever template your using

normally productdetails/default.php and sublayouts/products.php but come on .. do some leg work....  get to know your site and your code ..  have a look around in the files
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

gcap

  • Beginner
  • *
  • Posts: 25
  • A beginner
Re: Virtuemart stock level indicator
« Reply #5 on: October 09, 2018, 14:21:26 pm »
ive been doing leg work for some days -

gcap

  • Beginner
  • *
  • Posts: 25
  • A beginner
Re: Virtuemart stock level indicator
« Reply #6 on: October 09, 2018, 14:45:24 pm »
Im really sorry but this is not me using you guys as an easy options. Im just not ugetting this right:

Again I get an error and have done something wrong


<?php
/**
 * sublayout products
 *
 * @package   VirtueMart
 * @author Max Milbers
 * @link https://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 = empty($viewData['products_per_row'])? 1:$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;
}

$dynamic = false;

if (vRequest::getInt('dynamic',false) and vRequest::getInt('virtuemart_product_id',false)) {
   $dynamic = true;
}

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

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

   if($dynamic){
      $rowsHeight[$row]['product_s_desc'] = 1;
      $rowsHeight[$row]['price'] = 1;
      $rowsHeight[$row]['customfields'] = 1;
      $col = 2;
      $nb = 2;
   } else {
      $rowsHeight = shopFunctionsF::calculateProductRowsHeights($products,$currency,$products_per_row);

      if( (!empty($type) and count($products)>0) or (count($viewData['products'])>1 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);


   foreach ( $products as $product ) {
      if(!is_object($product) or empty($product->link)) {
         vmdebug('$product is not object or link empty',$product);
         continue;
      }
      // 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 product-container">
         <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
if($this->product->product_in_stock > 0){
echo JTEXT::_('COM_VIRTUEMART_STOCK_AMOUNT');
}
?>
         </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], 'position' => array('ontop', 'addtocart'))); ?>
         </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>
      <?php if($dynamic){
         echo vmJsApi::writeJS();
      } ?>
      </div>
   </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) or (count($viewData['products'])>1 and count($products)>0) ){
        // Do we need a final closing row tag?
        //if ($col != 1) {
      ?>
    <div class="clear"></div>
  </div>
    <?php
    // }
    }
}

/*if(vRequest::getInt('dynamic')){
   echo vmJsApi::writeJS();
}*/ ?>

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8562
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.14
Re: Virtuemart stock level indicator
« Reply #7 on: October 09, 2018, 16:48:30 pm »
Quote
ive been doing leg work for some days -

and this is better - cheaper than paying an experienced coder for half an hours work?

what does this say?

http://forum.virtuemart.net/index.php?topic=138596.msg496051#msg496051

GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 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
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

gcap

  • Beginner
  • *
  • Posts: 25
  • A beginner
Re: Virtuemart stock level indicator
« Reply #8 on: October 09, 2018, 17:06:51 pm »
I thought that I had put that in. I don't appreciate being patronised when I m looking for help and I would have thought that you would be aware that some of us are really just getting into this so what is boringly obvious to you is not for everyone. I'll pay a coder

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 27097
  • Always on vacation
    • Jenkin Hill Internet
Re: Virtuemart stock level indicator
« Reply #9 on: October 09, 2018, 18:40:11 pm »
I'll pay a coder

Excellent - and no, I am not a coder. In setting up any website, not just a Joomla/VM site, it is important the the site owner realises where their limitations lie. There is also a limitation to how much free time other VM users are willing to donate to try to help their peers. I saw no patronising from GJC, just encouragement to try to work it out for yourself, having already provided a link to a thread that shows the code to be used.

I tried to see what you are doing on the site, but it keeps timing out for me in the UK so I guess it is on a slow server.
Kelvyn

Jenkin Hill Internet,
Lowestoft, Suffolk, UK

Unsolicited PMs/emails will be ignored.

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

Currently using VM 3.4.3.9989 on Joomla 3.9.1 PHP 7.0.32
Testing VM 3.4.3.9993 on Joomla 3.9.1