Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2004
    Posts
    120
    Plugin Contributions
    0

    Default Show products_url only when loged in

    I want to hide url link from not registered customers, is this possible?
    So $products_url is only shown where user is loged in.

    Thank you

  2. #2
    Join Date
    Sep 2004
    Posts
    120
    Plugin Contributions
    0

    Default Re: Show products_url only when loged in

    I'm not a php programer, so i could be way off.

    Looking at index.php in language dir, i notice that greeting is formated in that way.

    So i tried the same thing for URL, but it does not work.

    Code:
    if (STORE_STATUS == '0') {
      define('TEXT_MORE_INFORMATION', 'Url is not shown');
    } else {
      define('TEXT_MORE_INFORMATION', 'Url is showing');
    }
    Later on, i found that something is also defined in functions_customers.php and that is really complicated for me. Any idea how to proced?

    Tnx

  3. #3
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Show products_url only when loged in

    In your admin go to:

    Configuration > Customer Details > Customer Approval Status - Authorization Pending > and set to "1"

  4. #4
    Join Date
    Sep 2004
    Posts
    120
    Plugin Contributions
    0

    Default Re: Show products_url only when loged in

    Tnx kobra, but wouldn't this also hide all other info about product?
    I only want URL link to hide from not registered users. I'm linking this url to PDF document, that has some info, only registered customers cas see.
    I'm using showcase only

    Well, i looked into function_customers.php and added this

    Code:
     // Hide url
       function show_url() {
          if ($_SESSION['customer_first_name'] && $_SESSION['customer_id']) {
          $url_string = sprintf(TEXT_MORE_INFORMATION, zen_output_string_protected($_SESSION['customer_first_name']), zen_href_link(FILENAME_PRODUCTS_NEW));
        } else {
          $url_string = sprintf(TEXT_MORE_INFORMATION_URL, zen_href_link(FILENAME_LOGIN, '', 'SSL'), zen_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL'));
        }
    
        return $url_string;
      }
    In tpl_products_info_display.php i replaced
    <?php // echo sprintf(TEXT_MORE_INFORMATION, $products_url); ?>
    with
    <?php echo show_url(); ?>

    in languages products_info.php i added

    define('TEXT_MORE_INFORMATION_URL', 'You have to be loged in to see this');
    below
    define('TEXT_MORE_INFORMATION', 'Please click <a href="%s" target="_blank">here, for PDF</a>.');


    This works fine, but the problem now is, that %s is not showing url to PDF, but username of loged customer.

    I'm aware that this must be very funy for someone who is experienced in php, but i'm graphic designer and programing is really not my thing.

    Anyway if someone can check this and give me a little help, i would be wery grateful.

    tnx

  5. #5
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Show products_url only when loged in

    I want to hide url link from not registered customers, is this possible?
    So $products_url is only shown where user is loged in.
    Sorry, I read this as the URL to the product pages...& not to a PDF.

    I am also not a php coder by any definition.

    Maybe by keeping this at the top, one of the php Zenners will chime in.

  6. #6
    Join Date
    Sep 2004
    Posts
    120
    Plugin Contributions
    0

    Default Re: Show products_url only when loged in

    Hey!

    Sorry for bumping this, but does anybody have any idea how to solve my problem?

    Tnx

  7. #7
    Join Date
    Jan 2004
    Posts
    66,450
    Plugin Contributions
    81

    Default Re: Show products_url only when loged in

    Try this:
    PHP Code:
     // Hide url
       
    function show_url($products_url='') {
          if (
    $_SESSION['customer_id'] && $products_url !='') {
          
    $url_string sprintf(TEXT_MORE_INFORMATION$products_url);
        } else {
          
    $url_string sprintf(TEXT_MORE_INFORMATION_URLzen_href_link(FILENAME_LOGIN'''SSL'), zen_href_link(FILENAME_CREATE_ACCOUNT'''SSL'));
        }
        return 
    $url_string;
      } 
    In tpl_products_info_display.php replace
    PHP Code:
    <?php // echo sprintf(TEXT_MORE_INFORMATION, $products_url); ?>
    with
    PHP Code:
    <?php echo show_url($products_url); ?>
    .
    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  8. #8
    Join Date
    Sep 2004
    Posts
    120
    Plugin Contributions
    0

    Default Re: Show products_url only when loged in

    Yes! Thank you Sensei, this works great.

 

 

Similar Threads

  1. 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
  2. E-Z Pages To Only Show When Logged in??
    By mattk251285 in forum Templates, Stylesheets, Page Layout
    Replies: 23
    Last Post: 14 Dec 2011, 06:25 PM
  3. Insurance Module: show on invoice only when selected
    By sbbemn in forum Addon Shipping Modules
    Replies: 0
    Last Post: 7 Mar 2011, 02:34 AM
  4. Link only show when logged in
    By twdhosting in forum Templates, Stylesheets, Page Layout
    Replies: 11
    Last Post: 16 Aug 2010, 01:12 AM
  5. breadcrumb show only when i move mouse on it
    By jewelery in forum Templates, Stylesheets, Page Layout
    Replies: 14
    Last Post: 12 Jan 2010, 01:10 AM

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