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

How to show 'Free" for 0 priced products

Started by mogaka, August 29, 2016, 16:25:10 PM

Previous topic - Next topic

mogaka

Software used:
Database Version: 5.5.36
PHP Version: 5.4.27
Joomla! Version: 3.3.3
Virtuemart: 2.9.9

I edited this file: administrator/components/com_virtuemart/helpers/currencydisplay.php, line 349 to become:
$priceFormatted = 'Free';

After doing that, product on the main virtuemart shop displays correctly as shown in 'pic 1' but products on the additional virtumart modules eg recently viewed do not diplay the text 'Free' as shown in 'pic 2'.

and lastly, when I add a free product to the cart, i get the following error messages as show in 'pic 3'.

Notice: Undefined index: product_price in C:\xampp\htdocs\cadpick\administrator\components\com_virtuemart\helpers\calculationh.php on line 269
Notice: Undefined index: product_currency in C:\xampp\htdocs\cadpick\administrator\components\com_virtuemart\helpers\calculationh.php on line 270
Notice: Undefined index: override in C:\xampp\htdocs\cadpick\administrator\components\com_virtuemart\helpers\calculationh.php on line 271
Notice: Undefined index: product_override_price in C:\xampp\htdocs\cadpick\administrator\components\com_virtuemart\helpers\calculationh.php on line 272
Notice: Undefined index: product_tax_id in C:\xampp\htdocs\cadpick\administrator\components\com_virtuemart\helpers\calculationh.php on line 273
Notice: Undefined index: product_discount_id in C:\xampp\htdocs\cadpick\administrator\components\com_virtuemart\helpers\calculationh.php on line 274

Kindly help

jenkinhill

You should not be using VM2.9.9 which was part of a test/development version leading up to the release of VM3 and is known to be buggy and insecure - the current stable VM version is 3.0.16 (http://dev.virtuemart.net/projects/virtuemart/files )
Joomla 3.3.3 is also very old and insecure.  These versions should not be used on a live site.
http://forum.virtuemart.net/index.php?topic=118683.0

You should not edit core files as this can lead to all sorts of problems. That should be done using template overrides or by building plugins.

AS for the php notices:  http://forum.virtuemart.net/index.php?topic=102555.0
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

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

mogaka

Thank you for your help @jenkinhill - it has greatly improved my site. I have upgraded my software as follows:
Joomla: 3.6.2
Php: 5.4.27
Virtuemart: 3.0.16

However I still have the problem I had earlier. I want to display 'Free' for 0 priced products on the main products page and on the additional virtuemart modules e.g the recently viewed products. Currently, if a product has a price of 0, the price div is not even displayed - as show on the attachments on my previous post.

Help on this matter will be highly appreciated.

GJC Web Design

you can do this in the templates.. or in the sublayout prices - over ride it


e.g.


//echo $currency->createPriceDiv ('salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $product->prices);
$salesprice = $currency->createPriceDiv ('salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $product->prices);

if(empty($saleprice)) {
echo 'Free';
}else{
echo $currency->createPriceDiv ('salesPrice', 'COM_VIRTUEMART_PRODUCT_SALESPRICE', $product->prices);
}




not tested
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

mogaka

Hi @GJC Web Design, thank you for the reply but unfortunately it doesn't work - it displays 'Free' for all products including the ones with a price.
However i found a very simple solution to my problem, simply set the minimum product price as 0.000001 on the vmvendor configuration.