Results 1 to 4 of 4

Hybrid View

  1. #1
    Join Date
    Aug 2007
    Posts
    5
    Plugin Contributions
    0

    Default Page specific html_header.php pages

    Hi,
    I want to add some php code to individual product pages to test variations of product description and user tracking.

    The code I want to add, needs to be added before the <html> tag so that a cookie can be sent to track the effectiveness and results.

    From what I can see I can use html_header.php in the overrides but this is for all pages and the code only needs to be added to specific pages.

    I found this thread about making multiple headers for the site [http://www.zen-cart.com/forum/showthread.php?t=72451] but I'm not sure if I need to use the same code principle or not as I'm more interested in specific products and not the home page.

    Any thoughts or ideas will be a big help.

    TIA

    Kevin

  2. #2
    Join Date
    Jan 2004
    Posts
    66,445
    Plugin Contributions
    81

    Default Re: Page specific html_header.php pages

    If this is for 'specific products', then you can code for those products uniquely, perhaps something like this:

    in html_header.php
    Code:
    /**
     * load the module for generating page meta-tags
     */
    require(DIR_WS_MODULES . zen_get_module_directory('meta_tags.php'));
    
    // set cookies unique to certain products:
    if ($current_page_base == 'product_info' && $_GET['products_id'] == '32') {
       // do code here to set cookie
    }
    
    /**
     * output main page HEAD tag and related headers/meta-tags, etc
     */
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" <?php echo HTML_PARAMS; ?>>
    .

    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.

  3. #3
    Join Date
    Aug 2007
    Posts
    5
    Plugin Contributions
    0

    Default Re: Page specific html_header.php pages

    Thanks!

    Can I add multiple code extracts here and if so is there an upper limit?

    i.e.

    // set cookies unique to certain products:
    if ($current_page_base == 'product_info' && $_GET['products_id'] == '32') {
    // do code here to set cookie
    }
    if ($current_page_base == 'product_info' && $_GET['products_id'] == '33') {
    // more code here to set cookie
    }
    //

    thanks
    Kev

  4. #4
    Join Date
    Jan 2004
    Posts
    66,445
    Plugin Contributions
    81

    Default Re: Page specific html_header.php pages

    You can add as many as you like, and if several products should be treated similarly, you could alter the code to work for more than one products_id in the same condition, etc. It can be quite flexible depending on your needs.
    .

    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.

 

 

Similar Threads

  1. v154 application/x-httpd-php html_header.php PHP script text
    By Parafanaylya in forum General Questions
    Replies: 3
    Last Post: 29 Aug 2015, 03:06 PM
  2. wordpress template html_header.php blocking modules/pages/index?
    By ZeroGravity in forum All Other Contributions/Addons
    Replies: 11
    Last Post: 6 Jan 2012, 01:27 AM
  3. need html_header.php & tpl_main_page.php files
    By marvin in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 23 Nov 2011, 06:32 PM
  4. Replies: 1
    Last Post: 16 Mar 2011, 07:11 PM
  5. Custom html_header.php for product_info page - How?
    By profitshock in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 28 Jun 2010, 09:58 PM

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