Results 1 to 10 of 10
  1. #1
    Join Date
    Oct 2007
    Posts
    65
    Plugin Contributions
    0

    Default Different Header based on landing page...one database

    Hi All...before I dive in with ZC, I want to see if this is possible.

    I have a domain name lets call http://www.somesalesite.com

    I advertise in many publications. I put in the ads a different "landing" page, such as somesalesite.com/pub1, somesalesite.com/charity1

    Is there a way that I can have the corresponding header (pub1 or charity1) show throught the user's session? All the products are the same.

    Something like you go to somesalesite.com/pub1. It stores the pub1 as a variable and then redirects to the home page with the header based on the variable?

    I see that there is a multiple store addon, but the stores are not really different. plus I don't want to have 20 different domain names.

    Thanks for any help in advance!
    -steve

  2. #2
    Join Date
    Apr 2004
    Location
    UK
    Posts
    5,821
    Plugin Contributions
    2

    Default Re: Different Header based on landing page...one database

    http://www.zen-cart.com/forum/showthread.php?t=55487
    You could use similar option as per thread above

  3. #3
    Join Date
    Oct 2007
    Posts
    65
    Plugin Contributions
    0

    Default Using session_start() or zen_session_start()

    using session_start() or zen_session_start() outside of the zencart.

    Hi all, I asked a similar question before when I first started out, but now that I am more familiar with ZC and sessions, I want to ask again. First off, here is a link to my shop:http://www.energetixjewelry.com/shop

    We do fund raisers with different charities, lets say, for example, and Autism charity. A certain amount of the proceeds go to the charity. So we would advertise the domain of: http://www.energetixjewelry.com/aut From there I would like to store a session variable that will remain after the page is forwarded to the shop url.http://www.energetixjewelry.com/shop

    what I have now is an index page in the /aut/ directory. on the page I have:

    PHP Code:
    if (!isset($_SESSION)) {
    session_start(); // This connects to the existing session 
    session_register ("landing"); // Create a session variable called name 
    $_SESSION['landing'] = 'aut'
    then i use a php header location to redirect to the main shop url. now my problem is calling that variable on the main page. I want to be able to switch the header image based on what page the user first entered at.

    Any ideas?

  4. #4
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Using session_start() or zen_session_start()

    Quote Originally Posted by forced View Post
    A certain amount of the proceeds go to the charity.
    How are you doing this part?
    .

    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.

  5. #5
    Join Date
    Oct 2007
    Posts
    65
    Plugin Contributions
    0

    Default Re: Using session_start() or zen_session_start()

    Quote Originally Posted by DrByte View Post
    How are you doing this part?
    Depends on the charity, but we will use coupon codes to keep track of the sales... I am not totally familiar with the admin process of that part. I am only the web designer...

  6. #6
    Join Date
    Oct 2007
    Posts
    65
    Plugin Contributions
    0

    Default Re: Different Header based on landing page...one database

    If i use this code on a test page to display the landing value it works fine.... but when I tried putting in on the index.php page of zen... I got an error: Fatal error: Call to a member function add_current_page() on a non-object in D:\Inetpub\energetixjewelry\shop\includes\autoload_func.php on line 90


    PHP Code:
    if (!isset($_SESSION)) {
      
    session_start();

    Last edited by forced; 10 Dec 2007 at 11:08 PM. Reason: added error

  7. #7
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Different Header based on landing page...one database

    So, you said you want anyone going to the /aut/ folder to be auto-redirected to the /shop/ folder and know where it came from?
    .

    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
    Oct 2007
    Posts
    65
    Plugin Contributions
    0

    Default Re: Different Header based on landing page...one database

    Quote Originally Posted by DrByte View Post
    So, you said you want anyone going to the /aut/ folder to be auto-redirected to the /shop/ folder and know where it came from?
    Yes... so that I can use a different header image depending on where they first came in from.

  9. #9
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Different Header based on landing page...one database

    How about something like this:

    1. /aut/index.php
    Code:
    header("HTTP/1.1 301 Moved Permanently");
    header("Location: ../shop/index.php?main_page=index&ref=aut");
    (or maybe use a full complete URL instead of the .. )
    And, of course ref=aut could be ref=unitedway or whatever you plan to use later in your code.
    In step 3 you'll see that this is also used as an auto-redeem coupon code by setting the 'cc_id' session variable.

    2. /shop/includes/auto_loaders/config.referral_tracking.php
    Code:
    <?php
    /**
     * @package initSystem
     * @copyright Copyright 2003-2007 Zen Cart Development Team
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: config.referral_tracking.php 2006-03-06 drbyte $
     */
      $auto Load Config[100][] = array('autoType'=>'init_script',
                                     'loadFile'=> 'init_referral_tracking.php');
    ?>
    (remove the spaces in auto Load Config before saving)

    3. /shop/includes/init_includes/init_referral_tracking.php
    Code:
    <?php
    /**
     * initialize referral-tracking-system variables
     * Determines which referral code the customer came in on 
     *
     * @package initSystem
     * @copyright Copyright 2003-2007 Zen Cart Development Team
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: init_referral_tracking.php  2006-03-06 drbyte $
     */
    // Determine which 'ref' code was used
    if (isset($_GET['ref']) && $_GET['ref'] != '') {
    
      // Set the 'referral_code' session variable for reference later
      $_SESSION['referral_code'] = $_GET['ref'];
    
      // Use the ref code and set it to be the redeemed coupon code (add // before next line to disable this option)
      $_SESSION['cc_id'] = $_GET['ref'];
    }
    
    ?>
    4. In your template, call the appropriate header image based on whatever $_SESSION['referral_code'] contains.
    .

    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.

  10. #10
    Join Date
    Oct 2007
    Posts
    65
    Plugin Contributions
    0

    Default Re: Different Header based on landing page...one database

    You are the man! Can we give hugs on this board?

    Seems to be working like a champ.

    I used the following code to create the variable for the image:
    PHP Code:
    if ($_SESSION['referral_code'] != '') {
        
    $MY_HEADER_LOGO_IMAGE $_SESSION['referral_code'];
            } else {
            
    $MY_HEADER_LOGO_IMAGE 'header'
            } 
    I used the following code for the header image:
    PHP Code:
    echo '<a href="' HTTP_SERVER DIR_WS_CATALOG '">' '<img src="https://www4027.ssldomain.com/energetixjewelry/shop/includes/templates/energetix/images/' $MY_HEADER_LOGO_IMAGE'.gif"' '</a>'
    Is there more of a zen way, other than putting the full image URL?

 

 

Similar Threads

  1. different header based on language
    By keneso in forum Templates, Stylesheets, Page Layout
    Replies: 10
    Last Post: 22 Mar 2012, 12:18 PM
  2. Different text shown based on quantity on product page
    By DigitalShadow in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 17 Jun 2010, 02:57 PM
  3. set different shipping rates based on zones only for one country.. need help..
    By daxchoki in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 13 Dec 2009, 06:19 PM
  4. index.php copy for different landing pages
    By NRG in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 14 Mar 2008, 08:46 PM
  5. Two Sites, one database, different prices? Is it possible???
    By infocom in forum General Questions
    Replies: 1
    Last Post: 26 Mar 2007, 10:09 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