Author Topic: Content pages viewable by logged in users only  (Read 3964 times)

Offline picasso99

  • Newbie
  • *
  • Posts: 8
  • Karma: +3/-0
    • View Profile
Content pages viewable by logged in users only
« on: February 02, 2015, 03:22:31 PM »
Is there a way to have content pages restricted to being viewed by logged in users only? I have a wholesale site that restricts viewing prices unless registered and authorized. I want to create a page with download links for a price list and literatures. However, I don't want non-registered users to have access to this page. I added a downloadable product, and it worked as expected, but it's cumbersome to go through the checkout process and then download the file(s). A simple page with links would be much better. I also have other pages that I would like to create for registered users only, such as delivery maps, how-to videos (how to sell our products, etc.), and other wholesale only information.

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4359
  • Karma: +298/-10
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: Content pages viewable by logged in users only
« Reply #1 on: February 04, 2015, 10:51:14 AM »
Unfortunately, content pages do not have extensive CMS features. There is no way to restrict content.

code modification is required for what you are looking to do.

Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

Offline picasso99

  • Newbie
  • *
  • Posts: 8
  • Karma: +3/-0
    • View Profile
Re: Content pages viewable by logged in users only
« Reply #2 on: February 04, 2015, 12:45:33 PM »
I have no problems with code modifications, but unsure where to start.

Offline picasso99

  • Newbie
  • *
  • Posts: 8
  • Karma: +3/-0
    • View Profile
Re: Content pages viewable by logged in users only
« Reply #3 on: February 06, 2015, 09:56:38 AM »
Figured it out. I did the following:

Added a content page with the authorized info. Content_id = 8.
Added a content page with the notice "Authorized users only." Content_id = 9
Modified "/storefront/controller/pages/content/content.php" as below (changes in red) :
Code: newbielink:javascript:void(0); [nonactive]
      if (isset($this->request->get['content_id'])) {                     
          /* customer is logged in OR content_id != 8 (authorized content) */
         if ($this->customer->isLogged()
         or $this->request->get['content_id'] != 8 ) {
            $content_id = $this->request->get['content_id'];
         else
         {
             /* show "Authorization Required" content page */
            $content_id = 9;
         }
      } else {
         $content_id = 0;
      }

Add all authorized content pages to the second IF statement.
« Last Edit: February 09, 2015, 03:54:37 AM by Basara »

 

Powered by SMFPacks Social Login Mod