31 Iul
2011
Scris de ilcos.ro Web Design in - Virtuemart  - citit de: 3026 ori.   
( 1 Vote )

I found somewhere a solution to this, but I don't know how secure it is. Also I believe there is a better way than what it actually does in order to hide the button.

File:
/components/com_virtuemart/themes/default/templates/product_details/flypage.tpl.php

once the code in this file to display the add to cart button is:

<?php echo $addtocart ?>


after it you add:

<?php if ($_SESSION['auth']['user_id'] < 1) { ?
<style type="text/css" media="screen">
.addtocart_button, .inputboxquantity {display:none;}
</style>
<?php } ?>

Supposed that when the user is not logged it, then -> display:none; for .addtocart_button and .inputboxquantity css styles.
I don't really like the display:none; idea, once the cart button is still there although not visible, anyway, haven't tested fully.

I found on a forum the following cod for Joomla an adapted it for Virtuemart flypage.

<?php
if ($my->id) { // do something for those who ARE logged in
}
else { //do something for those who are NOT logged in
?>

replace

<?php echo $addtocart ?>

with...

<?php
if ($my->id) {
echo $addtocart ; // show the add to cart for logged users
}
else {
echo "You are not loged in"; //display a message for NOT logged users
?>

I test it and its working OK.

Good luck Wink


Pentru a posta comentarii va rugam sa va inregistrati.