customize visibility on 'add to cart'

  • Posts: 13
  • Thank you received: 0
14 years 1 week ago #1587

Hi there..
I want to make the 'add to cart' on products show in the front-end can only be seen by members. Is there a solution to this problem?
Thank you

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
14 years 1 week ago #1590

Hi,

You can edit the file show.php of the view product in Display->Views. There you can just check the status of the user like explained there: docs.joomla.org/Accessing_the_current_us...t#Determining_Status

Please Log in or Create an account to join the conversation.

  • Posts: 13
  • Thank you received: 0
14 years 1 week ago #1594

I don't understand about the explanation on docs.joomla.org/Accessing_the_current_us...t#Determining_Status . I have opened file show.php in display->views->product but I can not find which parts should be edited to make 'add to chart' does not appear if viewed by a guest.
Could you explain more about it, please? Thanks before.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
14 years 1 week ago #1595

It's this code around line 60 which displays the button :
$this->row =& $this->element;
$this->setLayout('quantity');
echo $this->loadTemplate();

Please Log in or Create an account to join the conversation.

  • Posts: 13
  • Thank you received: 0
14 years 1 week ago #1601

I've been entering code, but 'add to cart' button still visible in guest mode. When i try to enter another code, i got it appear beside product image in guest mode. I'm still stuck about this case. Hope You will be able to help Me. Thanks a lot for the solution.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
14 years 1 week ago #1605

you should just replace the code I previously talked about by that code:

$user =& JFactory::getUser();
if (!$user->guest) {
$this->row =& $this->element;
$this->setLayout('quantity');
echo $this->loadTemplate();
}

Please Log in or Create an account to join the conversation.

  • Posts: 13
  • Thank you received: 0
14 years 1 week ago #1676

I'll try it many times, but 'add to cart' on my product description still appear and accessible by guest. Then, i modify your tips and make it disable to access 'add to cart' by guest. In joomla->components->controllers->product.php I put code:
$user =& JFactory::getUser();
if (!$user->guest){'function update cart'}
Then, guest can't access add to cart button.
Thank you for your suggestion.
:)

Please Log in or Create an account to join the conversation.

Time to create page: 0.064 seconds
Powered by Kunena Forum