Page 1 of 1

Hide certain content from product pages until logged in

Posted: Thu Jan 30, 2014 11:39 am
by Olsta
Hi,

I would like to hide some content in product description if the customer is not logged in (this is a Customer/Distributor website).
So I have created a user group for distributors. Basically I only want distributors to see certain content ie. download links when they login.

Is there a bit of code that I could use to let me hide content if not logged in. I only want a specific customer group to see the content/links in this case.

Re: Hide certain content from product pages until logged in

Posted: Sat Feb 01, 2014 12:28 am
by Xyph3r
There are a lot of extensions in the market. you can assign free downloads to any product..and only logegd customers can download them. Check the extension market

Re: Hide certain content from product pages until logged in

Posted: Mon Feb 03, 2014 5:25 am
by Olsta
Xyph3r wrote:There are a lot of extensions in the market. you can assign free downloads to any product..and only logegd customers can download them. Check the extension market
I ended purchasing a custom page tabs extension for this but what I really wanted was to be able to wrap a section of content in the product description and wrap it in a div tag with a display:none if not logged in.

Re: Hide certain content from product pages until logged in

Posted: Mon Feb 03, 2014 1:55 pm
by rempong

Re: Hide certain content from product pages until logged in

Posted: Mon Feb 03, 2014 2:29 pm
by dolrichfortich
You can just wrap the content with this code.

Code: Select all

<?php if ($this->customer->isLogged()) { ?>
Show this only for logged in users.
<?php } ?>

Re: Hide certain content from product pages until logged in

Posted: Tue Feb 04, 2014 10:42 am
by Olsta
dolrichfortich wrote:You can just wrap the content with this code.

Code: Select all

<?php if ($this->customer->isLogged()) { ?>
Show this only for logged in users.
<?php } ?>
Thanks dolrichfortich but this does not work inside the html editor for the category/products section on admin side.

Re: Hide certain content from product pages until logged in

Posted: Tue Feb 04, 2014 12:19 pm
by tarheit
I bet you could setup a style the is not displayable by default. Wrap your content in a div with that style. Then override the css with an inline style using the above code in your product template. Should be very strait forward.

Re: Hide certain content from product pages until logged in

Posted: Tue Feb 04, 2014 12:46 pm
by Olsta
Thanks will give that a go. Guess I should have thought of that in the first place.

Re: Hide certain content from product pages until logged in

Posted: Tue Feb 04, 2014 5:13 pm
by qahar
You can use OpenCart Shortcode to hide content manually until user is logged in.

You can use the shortcode at information, product description editor etc

Code: Select all

Some text A

[login]Some text B[/login]

Re: Hide certain content from product pages until logged in

Posted: Tue Feb 04, 2014 11:15 pm
by ajaiverma
Hi,
I can code this, I am expert opencart developer.
Contact me at ajaiverma401[at]gmail[dot]com

Re: Hide certain content from product pages until logged in

Posted: Tue Feb 04, 2014 11:58 pm
by OSWorX
For all shops having reseller/distributor.
Here a module you can assign products and categories as well to selected customergroups:
Module Resellermode

The module will also introduce a new unit: packing unit (available for all products).
Useful for products shipped as package (definition is up to you and your business).

Re: Hide certain content from product pages until logged in

Posted: Wed Feb 05, 2014 4:52 am
by Olsta
qahar wrote:You can use OpenCart Shortcode to hide content manually until user is logged in.

You can use the shortcode at information, product description editor etc

Code: Select all

Some text A

[login]Some text B[/login]
I like this and I downloaded the extension to test but unfortunately it is not compatible with Mijoshop :-[

Re: Hide certain content from product pages until logged in

Posted: Thu Apr 16, 2015 9:40 pm
by sensadvert
Hello,

How can I hide certain product from listing on the store? I tried -1 but it's not working.

Thanks.