Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2009
    Posts
    12
    Plugin Contributions
    0

    Default Need help to write correct line of code...

    I want to add a line of code into tpl_product_info_display.php
    The file has following code:

    <?php require($template->get_template_dir('tpl_modules_also_purchased_products.php', DIR_WS_TEMPLATE, $current_page_base,'templates'). '/' . 'tpl_modules_also_purchased_products.php');?>

    Based on that code I want to display following:

    <?php require($template->get_template_dir('tpl_modules_featured_products2.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_featured_products2.php'); ?>

    Also I have tpl_modules_featured_products3.php and tpl_modules_featured_products4.php which I also will need to call.

    If I will use the call code from above for each file it will show all those three boxes 2, 3, and 4 on the page.

    But I need to call them when certain category is displayed.

    So I need a line of code which will define in which category the given product is sitting and accordingly will show necessary file (box).

    Example:

    if (current product displayed is in the category cPath=1) {
    <?php require($template->get_template_dir('tpl_modules_featured_products2.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_featured_products2.php'); ?>
    }

    I hope I explained it properly.
    Can anyone help? Is it possible?

  2. #2
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Need help to write correct line of code...

    It sounds like you want to display only one of these boxes, according to the current category (and none of them on other pages?) If that is true, you could do this:
    PHP Code:
    switch ($cPath) {
    case 
    '1':
      require(
    $template->get_template_dir('tpl_modules_featured_products2.php',DIR_WS_TEMPLATE$current_page_base,'templates'). '/tpl_modules_featured_products2.php');
      break;
    case 
    '7':
      require(
    $template->get_template_dir('tpl_modules_featured_products3.php',DIR_WS_TEMPLATE$current_page_base,'templates'). '/tpl_modules_featured_products3.php');
      break;
    case 
    '35':
      require(
    $template->get_template_dir('tpl_modules_featured_products4.php',DIR_WS_TEMPLATE$current_page_base,'templates'). '/tpl_modules_featured_products4.php');
      break;
    default:
      
    //any default code desired


  3. #3
    Join Date
    Feb 2009
    Posts
    12
    Plugin Contributions
    0

    Default Re: Need help to write correct line of code...

    Thank you, thank you,

    It works beautifully

 

 

Similar Threads

  1. Need help decoding a line of HTML code
    By CaseyC in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 13 May 2016, 11:48 PM
  2. Replies: 7
    Last Post: 3 Jun 2013, 02:18 PM
  3. Incorrect VAT total on invoice (line per line is correct)
    By sephiroth in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 1
    Last Post: 29 Jan 2010, 10:39 AM
  4. Help need to set up per zip code shipping module with 5 zip code areas flat fee
    By cshart in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 11 Feb 2009, 06:31 AM

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