Author Topic: Add text next to price  (Read 471 times)

JACUK

  • Beginner
  • *
  • Posts: 12
  • A beginner
Add text next to price
« 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


JACUK

  • Beginner
  • *
  • Posts: 12
  • A beginner
Re: Add text next to price
« Reply #1 on: January 31, 2019, 19:47:57 pm »
meant to include version 3.2.14

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8834
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.14
Re: Add text next to price
« Reply #2 on: January 31, 2019, 22:05:52 pm »
image? page? your desc is unclear to me
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

JACUK

  • Beginner
  • *
  • Posts: 12
  • A beginner
Re: Add text next to price
« Reply #3 on: January 31, 2019, 23:34:05 pm »
Hi,

Sorry for lack of clarity.

Screen grab attached that should help clarify.

Thanks

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8834
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.14
Re: Add text next to price
« Reply #4 on: February 01, 2019, 11:10:50 am »
depends entirely on your template but on mine it would be

Code: [Select]
          <?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));
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

JACUK

  • Beginner
  • *
  • Posts: 12
  • A beginner
Re: Add text next to price
« Reply #5 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>

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8834
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.14
Re: Add text next to price
« Reply #6 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)
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

JACUK

  • Beginner
  • *
  • Posts: 12
  • A beginner
Re: Add text next to price
« Reply #7 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

jenkinhill

  • UK Web Developer & Consultant
  • Global Moderator
  • Super Hero
  • *
  • Posts: 27345
  • Always on vacation
    • Jenkin Hill Internet
Re: Add text next to price
« Reply #8 on: February 01, 2019, 18:46:05 pm »
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.10045 on Joomla 3.9.5 PHP 7.0.33
Testing VM 3.4.5.10045 on Joomla 3.9.5

JACUK

  • Beginner
  • *
  • Posts: 12
  • A beginner
Re: Add text next to price
« Reply #9 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

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8834
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.14
Re: Add text next to price
« Reply #10 on: February 01, 2019, 22:52:41 pm »
COM_VIRTUEMART_PRODUCT_SALESPRICE
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