VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: JACUK on January 31, 2019, 19:13:17 PM

Title: Add text next to price
Post by: JACUK on January 31, 2019, 19:13:17 PM
Hi,

Hope someone can help.

I have a number of products that have children to allow a drop down to select a specific product bundle, each with a different price.

All works fine. On the product page it displays the short description and then a price (which is the base price for the smallest bundle)

I want to  add text before the price, on the same line, before the price - ie "Prices starting at" and then displaying the price.

Where would be the best place to modify the code.

Thanks

Title: Re: Add text next to price
Post by: JACUK on January 31, 2019, 19:47:57 PM
meant to include version 3.2.14
Title: Re: Add text next to price
Post by: GJC Web Design on January 31, 2019, 22:05:52 PM
image? page? your desc is unclear to me
Title: Re: Add text next to price
Post by: JACUK on January 31, 2019, 23:34:05 PM
Hi,

Sorry for lack of clarity.

Screen grab attached that should help clarify.

Thanks
Title: Re: Add text next to price
Post by: GJC Web Design on February 01, 2019, 11:10:50 AM
depends entirely on your template but on mine it would be

          <?php
          
// Product Short Description
          
if (!empty($this->product->product_s_desc)) {
          
?>

          <div class="product-short-description small well well-sm">
          <?php
          
echo nl2br($this->product->product_s_desc);
          
?>

          </div>
          <?php
          
// Product Short Description END
  
// add additional text here - either a module position, hardcoded or VMcustom field

          
echo shopFunctionsF::renderVmSubLayout('prices',array('product'=>$this->product,'currency'=>$this->currency));
Title: Re: Add text next to price
Post by: JACUK on February 01, 2019, 13:44:28 PM
Hi,

Thanks GJC - you have helped point me in the right direction.

I have modified the products.php file as shown below. I have just added the text I wanted to the line <?php  //echo  $rowsHeight[$row]['price'] ?>
It puts the copy above the price which is workable for now - just need to work out how to get it on the same line as the price.

Thanks again - my first joomla/virtuemart project so just learning my way around how it all works.

Julian

<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, 300, ' ...') ?>
                  <?php } ?>
               </p>
         <?php  } ?>
            </div>


Prices Starting From:-   <?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>
Title: Re: Add text next to price
Post by: GJC Web Design on February 01, 2019, 15:59:22 PM
can't u add       Prices Starting From:-    to the lang constant of the price label and display the label  ( set in admin)
Title: Re: Add text next to price
Post by: JACUK on February 01, 2019, 18:19:46 PM
Hi GJC,

thanks for the suggestion - at this stage not sure where to look for the price label to change it. When I get a few minutes will investigate.

Any pointers would be appreciated.

Thanks

Julian
Title: Re: Add text next to price
Post by: jenkinhill on February 01, 2019, 18:46:05 PM
http://forum.virtuemart.net/index.php?topic=113895.0
Title: Re: Add text next to price
Post by: JACUK on February 01, 2019, 19:25:44 PM
Hi,

Thanks Kelvyn.

Appreciate the links, etc.

I had used the language overides to alter the text on one of the buttons.

What I am not sure about is string would be for price and if there is one for where this appears on the page. All that is displayed is £9.95 for example no other text, hence why I am not sure what to look for.

If there was already text being displayed before the price then I could understand this solution.

A better screen grab is attached. Just want to get the words "Prices from-" on the same line before the actual price displayed.

Any further pointers would be much appreciated.

Thanks

Julian
Title: Re: Add text next to price
Post by: GJC Web Design on February 01, 2019, 22:52:41 PM
COM_VIRTUEMART_PRODUCT_SALESPRICE