News:

Looking for documentation? Take a look on our wiki

Main Menu

Show prices only to registered users

Started by broc93, November 07, 2014, 11:01:23 AM

Previous topic - Next topic

broc93

Hello. I thought I could hide prices to unregistered users by changing the "Shopper Group" in the pricing tab of each product. This way, instead of viewing the prices, they see a "Ask for the price" link.
Anyway, I don't want this to happen, products should be added to the cart regularly and anonymous users only won't see the prices on the single product pages, yet they will see the total price in their cart. How to do this?
I've looked on the forum but didn't find anything who could help me.
Thank you in advance
Herbalife products
http://dietabenesserehl.it

jenkinhill

Use template overrides for category & product prices with a check if the user is logged in. If not logged in then hide the price display.
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

broc93

Thank you! Anyway I know where to edit but not the check I should make. What should the "if" be like?
Herbalife products
http://dietabenesserehl.it

broc93

Herbalife products
http://dietabenesserehl.it

GJC Web Design

$user =& JFactory::getUser();
$userid = $user->get('id');
if($userid>0) {
//display prices
}
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

broc93

Herbalife products
http://dietabenesserehl.it