Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2013
    Location
    Portishead, North Somerset, United Kingdom
    Posts
    34
    Plugin Contributions
    0

    Default Product URL on tpl_product_info_display.php to display only when user is logged in?

    Hi everyone, can somebody please help me out with the following:

    Product Page - I'm wanting to amend a small portion for my websites benefit.

    On the 'tpl_product_info_display.php' or 'Product Page' as we know it , I would like the "product URL" section below to only appear when the user is logged in. I know I need to do something with checking the session, but do not have the PHP knowledge to sort this.

    To display this segment when the user is logged in only, else display nothing:

    Code:
    <!--bof Product URL -->
    <?php
      if (zen_not_null($products_url)) {
        if ($flag_show_product_info_url == 1) {
    ?>
        <p id="productInfoLink" class="productGeneral centeredContent"><?php echo sprintf(TEXT_MORE_INFORMATION, zen_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($products_url), 'NONSSL', true, false)); ?></p>
    <?php
        } // $flag_show_product_info_url
      }
    ?>
    <!--eof Product URL -->
    The reason for doing this is because I am using the URL to link to another website that is for logged in users only (but does not need to be strictly secure) and it needs to come from each specific product page.

    Any help appreciated.

    Thanks

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,492
    Plugin Contributions
    88

    Default Re: Product URL on tpl_product_info_display.php to display only when user is logged i

    You can add a condition to see if a customer's currently logged in:
    Code:
    <!--bof Product URL -->
    <?php
      if (zen_not_null($products_url) && isset($_SESSION['customer_id'])) {
        if ($flag_show_product_info_url == 1) {
    ?>
        <p id="productInfoLink" class="productGeneral centeredContent"><?php echo sprintf(TEXT_MORE_INFORMATION, zen_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($products_url), 'NONSSL', true, false)); ?></p>
    <?php
        } // $flag_show_product_info_url
      }
    ?>
    <!--eof Product URL -->

  3. #3
    Join Date
    Oct 2013
    Location
    Portishead, North Somerset, United Kingdom
    Posts
    34
    Plugin Contributions
    0

    Default Re: Product URL on tpl_product_info_display.php to display only when user is logged i

    Works perfectly, I wish that I knew PHP.

    Many Thanks Lat9!

 

 

Similar Threads

  1. v151 Display product with tax does not when customer is logged in
    By jeking in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 16
    Last Post: 17 Feb 2014, 11:22 AM
  2. v150 Show Product Description only when logged in
    By fsu711 in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 4 Apr 2012, 11:57 PM
  3. Layout is jacked up only when user is logged in.
    By knine22 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 28 Nov 2009, 12:14 AM
  4. Product only available when logged in
    By jamesdenny in forum Setting Up Categories, Products, Attributes
    Replies: 4
    Last Post: 5 Mar 2009, 06:00 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR