Welcome, Guest
Username: Password: Remember me
Use this Category for your support questions about Responsive Joomla Virtuemart Template - LightMart (SKU# FLEX-00012)

TOPIC: Ad to cart button only for logged in users.

Ad to cart button only for logged in users. 10 years 10 months ago #5234

Ad to cart button only for logged in users.

I have found some solutions like adding joomlas getUser code in front of Add To Cart Button code in /components/com_virtuemart/views/productdetails/tmpl/default.php around line 200. This seams to work for all people but not me. It might be because of the template. Can you help me with this.

Codes im trying to use are;

<?php
// check if user is logged in/registered.
$user =& JFactory::getUser(); if( $user->id ){
// Add To Cart Button
...

and

<?php
// check if user is logged in/registered.
// $user =& JFactory::getUser(); if( $user->id ){
$user = JFactory::getUser();
$status = $user->guest;
if($status == 1){
echo "some text";
}
else
{
// Add To Cart Button
...


Both apparently work for others.
Thank you in advance.
Last Edit: 10 years 10 months ago by ikik.
The topic has been locked.

Ad to cart button only for logged in users. 10 years 9 months ago #5243

It should work but are you sure you are in the right template files?

Just add a bit of rubbish to the file

e.g.

echo 'This is the one';

to double check you are where you think you are..

e.g. for product details u should be in

templates/flexible_lightmart/html/com_virtuemart/productdetails/default.php ~ line 522

cheers
The topic has been locked.

Ad to cart button only for logged in users. 10 years 9 months ago #5259

Its ok now on product detail page when I done this on override file. Thank you for pointing me to it.

There was also a bug in codes, last { mark needed to be removed.

Thank you
Last Edit: 10 years 9 months ago by ikik.
The topic has been locked.

Ad to cart button only for logged in users. 10 years 9 months ago #5272

the last { is the opening brace of the final part of the else - but if it's working now very good

Topic solved

Cheers
The topic has been locked.
Time to create page: 0.065 seconds

MaterialMart

for Virtuemart 3

Google's Material Design has finally arrived to Virtuemart

Virtumart Template - MaterialMart Virtumart Template - CleanMart Virtumart Template - CleanMart Virtumart Template - CleanMart

Fully responsive!

Buy Now   |   Live Demo