News:

Support the VirtueMart project and become a member

Main Menu

Product Description Only For Memebers

Started by raheelhir, November 26, 2015, 07:15:46 AM

Previous topic - Next topic

raheelhir

VirtueMart 3.0.12
Joomla: 3.4

I want to hide product full description for the guest. Only registered user can see product description on product detail page. Please find attached screenshot for better understanding. 

Thank you for any help with this.

Jumbo!

You are layout overrides in your site Joomla template and you will need to customize your layout file for product details page for the same.

I will explain you the change for standard VirtueMart layout i.e. components/com_virtuemart/views/productdetails/tmpl/default.php

Find the following codes in between lines 194 to 205:
<?php
//echo ($this->product->product_in_stock - $this->product->product_ordered);
// Product Description
if (!empty($this->product->product_desc)) {
    ?>

        <div class="product-description">
<?php /** @todo Test if content plugins modify the product description */ ?>
    <span class="title"><?php echo vmText::_('COM_VIRTUEMART_PRODUCT_DESC_TITLE'?></span>
<?php echo $this->product->product_desc?>
        </div>
<?php
    
// Product Description END


Replace above by:
<?php
//echo ($this->product->product_in_stock - $this->product->product_ordered);
// Product Description
if (!empty($this->product->product_desc) && !JFactory::getUser()->get('guest')) {
    ?>

        <div class="product-description">
<?php /** @todo Test if content plugins modify the product description */ ?>
    <span class="title"><?php echo vmText::_('COM_VIRTUEMART_PRODUCT_DESC_TITLE'?></span>
<?php echo $this->product->product_desc?>
        </div>
<?php
    
// Product Description END


You will need to replicate the above codes in your template override.

raheelhir

#2
Wao great brother for quick solution I am very very thanks full to you Jumbo!  :)