News:

Support the VirtueMart project and become a member

Main Menu

Products Price Problem

Started by ercankoc, August 16, 2012, 02:00:18 AM

Previous topic - Next topic

ercankoc

Hi (:

I want only the members to see the price of the products and don't want guests to see any prices. Settings in the pricing section are as seen below and still guests can see the prices.

Thanks for your help..





Joomla; 2.5.6
Virtuemart; 2.0.8e

John2400

you could clone all your products -

then set  prices for guest products to $.00-

They see the The words "call for price"- but only registered guest could purchase? infact you could change the call for price option to another word setting in language. OR just leave it as it is quite good and change the availability words to say - only registered users can purchase.  Call us or sign up.




ivus

Hi ercankoc,

I could be wrong, but I haven't seen this feature in VM... but as I said, I could be wrong.

I hope you know how to code and edit templates?

One solution that would work 100% of the time is to wrap all your code that you don't want guests to see with the following code snippet:



if ( ! $user->get('guest')) {

CODE SNIPPET TO HIDE FROM PRYING EYES HERE

}



Be sure to define to USER object once on every page you want to use it on.



$user =& JFactory::getUser();



Good luck ;D

John2400


Optimalu

Hi I am using latest joomla and virtuemart. I am trying to get the code to work from Ivus, but I need some more directions.

I have the adjusted the default.php to following

code:
<?php
                  if ( ! $user->get('guest')) {
                  // Add the button
                  $button_lbl = JText::_('COM_VIRTUEMART_CART_ADD_TO');
                  $button_cls = 'addtocart-button'; //$button_cls = 'addtocart_button';
                  $button_name = 'addtocart'; //$button_cls = 'addtocart_button';


                  // Display the add to cart button
                  $user =& JFactory::getUser();
                  $stockhandle = VmConfig::get('stockhandle','none');
                  if(($stockhandle=='disableit' or $stockhandle=='disableadd') and ($this->product->product_in_stock - $this->product->product_ordered)<1){
                     $button_lbl = JText::_('COM_VIRTUEMART_CART_NOTIFY');
                     $button_cls = 'notify-button';
                     $button_name = 'notifycustomer';
                  }
                  vmdebug('$stockhandle '.$stockhandle.' and stock '.$this->product->product_in_stock.' ordered '.$this->product->product_ordered);
                  }?>
                       
                        <span class="addtocart-button">
                     <input type="submit" name="<?php echo $button_name ?>"  class="<?php echo $button_cls ?>" value="<?php echo $button_lbl ?>" title="<?php echo $button_lbl ?>" />
                  </span>


but this is giving an error message, maybe that has to do with the fact that I am not doing anything with the define user object. But I really don't know where to do that. Some help please or maybe some more eloborate explanation? Thank a lot in advance