Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    May 2008
    Posts
    23
    Plugin Contributions
    0

    Default How to change a tpl_modules_attributes.php?

    Hi I need to change this php code from my tpl_product_info_display.php, can any one help me? please?


    PHP Code:
    <!--bof Attributes Module -->
    <?php
      
    if ($pr_attr->fields['total'] > 0) {
    ?>

    <?php

    /**
     * display the product atributes
     */
     
      
    require($template->get_template_dir('/tpl_modules_attributes.php',DIR_WS_TEMPLATE$current_page_base,'templates'). '/tpl_modules_attributes.php'); ?>
    <?php
      
    }
    ?>
    <!--eof Attributes Module -->
    I have two different categories "Contact Lenses" and Prescription Lenses" that need to display different attribute layouts.

    So, I'm wondering if something like this is possible, but I'm not a PHP master,

    PHP Code:

    <!--bof Attributes Module -->
    <?php
      
    if ($pr_attr->fields['total'] > 0) {
    ?>

    <?php

    if($_GET['cPath']) {
      switch(
    $_GET['cPath']) {
       case 
    $template_dir "1"// directory of your custom cPath template (/tpl_modules_attributes_1.php)
          
    break;
       case 
    $template_dir "2"// directory your custom cPath template (/tpl_modules_attributes_2.php)
          
    break;
       case 
    $template_dir "2_7"// directory your custom cPath template (/tpl_modules_attributes_2.php)
         
       
    default: // If none of the above 
            
    $template_dir ""// directory name of custom template (/tpl_modules_attributes.php)      
        
    }
      }

    ?>
    Can any one help?

  2. #2
    Join Date
    May 2008
    Posts
    23
    Plugin Contributions
    0

    Default Re: How to change a tpl_modules_attributes.php?

    Here is my situation, I already change my Code:
    the else statment works,
    so i need help with my 2 first statments " if " and " if "


    This Code is in my tpl_product_info_display.php

    My plan is call a different tpl_modules_attributes.php base on

    Categories: "Contact Lenses" and "Prescription Lenses"

    http://opticlubusa.com/index.php?mai...&products_id=1


    PHP Code:
    <!--bof Attributes Module -->
    <?php

      
    if ($pr_attr->fields['total'] > 0) {
    ?>

    <?php
    /** display the product atributes ***/
     
    if(category_id=="1")
      require(
    $template->get_template_dir('/tpl_modules_attributes_1.php',DIR_WS_TEMPLATE$current_page_base,'templates'). '/tpl_modules_attributes_1.php');
      if(
    category_id=="2_7")
      require(
    $template->get_template_dir('/tpl_modules_attributes_2.php',DIR_WS_TEMPLATE$current_page_base,'templates'). '/tpl_modules_attributes_2.php'); 
      else
        require(
    $template->get_template_dir('/tpl_modules_attributes.php',DIR_WS_TEMPLATE$current_page_base,'templates'). '/tpl_modules_attributes.php'); 
        
    ?>
    <?php
      

    ?>
    <!--eof Attributes Module -->


  3. #3
    Join Date
    May 2008
    Posts
    23
    Plugin Contributions
    0

    Default Re: How to change a tpl_modules_attributes.php?

    A (manual) solution for my situation, 4 Categories with SubCat

    Contact Lenses ()

    Eyeglasses Frames (Men, Women, Children Unisex)

    Prescription Lenses ()

    Sunglasses ( Men, Women, Unisex )

    So, The Rx for Contact Lenses and Prescription Lenses are different so I need to upload a differente (tpl_module_attributes.php) base on Category situation,

    This is what came up to me, so far so good I think is working!!!


    1. I create all my Attributes in the Admin section
    ( I use the sort order in the names)

    2. I create my display table
    --- for contact Lenses: tpl_module_attributes_1.php
    --- for Eyeglases Frames: tpl_module_attributes_2.php

    Code: tpl_module_attributes_1.php

    PHP Code:
    <?php
    /**
     * Module Template
     *
     * Template used to render attribute display/input fields
     *
     * @package templateSystem
     * @copyright Copyright 2003-2005 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: tpl_modules_attributes.php 3208 2006-03-19 16:48:57Z birdbrain $
     */
    ?>

    <div id="productAttributes">
      <div class="wrapperAttribsOptions">
        <table width="100%" cellpadding="0" cellspacing="0"  style="border: 1px solid #003399;">
          <tr>
            <td><table width="100%" border="0" cellpadding="5" cellspacing="0" bgcolor="#FFFFFF">
                <tr>
                  <td colspan="9" class="leftBoxHeading" id="categoriesHeading"><strong>Please enter your Rx Information Here</strong> </td>
                </tr>
                <tr>
                  <td><strong> </strong></td>
                  <td><strong>Sphere</strong></td>
                  <td><span class="main"><b>Cylinder</b></span></td>
                  <td><span class="main"><strong>Axis</strong></span></td>
                  <td><span class="main"><b>Prism</b></span></td>
                  <td><span class="main"><b>Add</b></span></td>
                  <td><strong>Diam</strong></td>
                  <td><b>BC</b></td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td><div align="left"> O.D:</div></td>
                  <td><span class="main"><?php echo "\n" $options_menu[0]; ?></span></td>
                  <td><span class="main"><?php echo "\n" $options_menu[1]; ?></span></td>
                  <td><span class="main"><?php echo "\n" $options_menu[2]; ?></span></td>
                  <td><span class="main"><?php echo "\n" $options_menu[3]; ?></span></td>
                  <td><span class="main"><?php echo "\n" $options_menu[4]; ?></span></td>
                  <td><span class="main"><?php echo "\n" $options_menu[5]; ?></span></td>
                  <td><span class="main"><?php echo "\n" $options_menu[6]; ?></span></td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td><div align="left"> O.S:</div></td>
                  <td><span class="main"><?php echo "\n" $options_menu[7]; ?></span></td>
                  <td><span class="main"><?php echo "\n" $options_menu[8]; ?></span></td>
                  <td><span class="main"><?php echo "\n" $options_menu[9]; ?></span></td>
                  <td><span class="main"><?php echo "\n" $options_menu[10]; ?></span></td>
                  <td><span class="main"><?php echo "\n" $options_menu[11]; ?></span></td>
                  <td><span class="main"><?php echo "\n" $options_menu[12]; ?></span></td>
                  <td><span class="main"><?php echo "\n" $options_menu[13]; ?></span></td>
                  <td>&nbsp;</td>
                </tr>
                <tr>
                  <td colspan="9" class="leftBoxHeading" id="categoriesHeading"><strong>Please enter Patient and  Doctor's Information Here</strong> </td>
                </tr>
                <tr>
                  <td colspan="3"><?php echo $options_name[14]; ?></td>
                  <td colspan="6"><?php echo "\n" $options_menu[14]; ?></td>
                </tr>
                <tr>
                  <td colspan="3"><?php echo $options_name[15]; ?></td>
                  <td colspan="6"><?php echo "\n" $options_menu[15]; ?></td>
                </tr>
                <tr>
                  <td colspan="3"><?php echo $options_name[16]; ?></td>
                  <td colspan="6"><?php echo "\n" $options_menu[16]; ?></td>
                </tr>
                <tr>
                  <td colspan="3"><?php echo $options_name[17]; ?></td>
                  <td colspan="6"><?php echo "\n" $options_menu[17]; ?></td>
                </tr>
                <tr>
                  <td colspan="3"><?php echo $options_name[18]; ?></td>
                  <td colspan="6"><?php echo "\n" $options_menu[18]; ?></td>
                </tr>
              </table></td>
          </tr>
        </table>
      </div>
    </div>
    3. I change a Code in tpl_product_info_display.php

    Original Code
    PHP Code:
    <!--bof Attributes Module -->
    <?php
      
    if ($pr_attr->fields['total'] > 0) {
    ?>
    <?php
    /**
     * display the product atributes
     */
      
    require($template->get_template_dir('/tpl_modules_attributes.php',DIR_WS_TEMPLATE$current_page_base,'templates'). '/tpl_modules_attributes.php'); ?>
    <?php
      
    }
    ?>
    <!--eof Attributes Module -->
    Change for (Totally PHP Sinner ) but so far so good I think is working!
    Manual

    PHP Code:
    <!--bof Attributes Module -->
    <?php  if ($pr_attr->fields['total'] > 0) { ?>


    <?php /*** display the product atributes***/

      
    if($current_category_id=="1")
      require(
    $template->get_template_dir('/tpl_modules_attributes_1.php',DIR_WS_TEMPLATE$current_page_base,'templates'). '/tpl_modules_attributes_1.php');
      
        if(
    $current_category_id=="2")
      require(
    $template->get_template_dir('/tpl_modules_attributes_2.php',DIR_WS_TEMPLATE$current_page_base,'templates'). '/tpl_modules_attributes_2.php');
        
        if(
    $current_category_id=="5")
      require(
    $template->get_template_dir('/tpl_modules_attributes_2.php',DIR_WS_TEMPLATE$current_page_base,'templates'). '/tpl_modules_attributes_2.php');
      
        if(
    $current_category_id=="6")
      require(
    $template->get_template_dir('/tpl_modules_attributes_2.php',DIR_WS_TEMPLATE$current_page_base,'templates'). '/tpl_modules_attributes_2.php');
      
       if(
    $current_category_id=="7")
      require(
    $template->get_template_dir('/tpl_modules_attributes_2.php',DIR_WS_TEMPLATE$current_page_base,'templates'). '/tpl_modules_attributes_2.php');
      
       if(
    $current_category_id=="8")
      require(
    $template->get_template_dir('/tpl_modules_attributes_2.php',DIR_WS_TEMPLATE$current_page_base,'templates'). '/tpl_modules_attributes_2.php');
      
       
        
    ?>


    <?php  ?>

    <!--eof Attributes Module -->

    As I said is "a manual solution for my situation"


    Contact Lenses http://opticlubusa.com/index.php?mai...&products_id=3

    Eyeglasses Frames http://opticlubusa.com/index.php?mai...&products_id=1

    Miri4413

 

 

Similar Threads

  1. v139h tpl_modules_attributes - modification
    By KRNL in forum Setting Up Categories, Products, Attributes
    Replies: 5
    Last Post: 4 Feb 2013, 12:04 AM
  2. Need help with tpl_modules_attributes.php
    By rapro in forum Templates, Stylesheets, Page Layout
    Replies: 13
    Last Post: 7 Oct 2010, 10:41 PM
  3. Replies: 0
    Last Post: 9 Jan 2007, 04:38 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