Do you like AbanteCart? Please rate AbanteCart or share your experience with other eCommerce entrepreneurs. Go to Softaculous rating page to add your rating or write a review

Content pages viewable by logged in users only

Started by picasso99, February 02, 2015, 03:22:31 PM

Previous topic - Next topic

picasso99

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.

abantecart

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

picasso99

I have no problems with code modifications, but unsure where to start.

picasso99

#3
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) :

      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.

Forum Rules Code of conduct
AbanteCart.com 2010 -