Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Feb 2013
    Location
    Vancouver, British Columbia, Canada
    Posts
    3
    Plugin Contributions
    0

    Default tpl_modules_attributes - modification

    Hello,

    I have a page that has been modified by a person during the original build. The site is for a contact lens company opticalnow.ca

    The modification made sense when the site was built as every product had needs a prescription. We now have a new product that doesn't so the code on the tpl_modules_attributes is causing an issue.

    I need to keep the code for the prescription for every product except this one.

    I've managed to get the product attribute to display on the page by adding another line with it's attribute but it isn't right.

    This is the page - http://opticalnow.ca/adlens-hemisphe....html?cPath=32

    Here is the code I added to the rest to get it to show
    PHP Code:
    case 'Colour':
                        
    $result['Colour']['right'][] = $options_menu[$i];
                        break; 
    My php is not great - thanks for the help

    This is the rest of the page code.
    PHP Code:
    <?php
    /**
     * Module Template
     *
     * Template used to render attribute display/input fields
     *
     * @package templateSystem
     * @copyright Copyright 2009 Glenn Herbert
     * @copyright Copyright 2003-2005 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.gnu.org/licenses/ GNU Public License V3.0
     * @version $Id: tpl_modules_attributes.php 3208 2006-03-19 16:48:57Z birdbrain $
     * Modified for Flexible Attributes by Glenn Herbert (gjh42)  20091228
     */
    ?>
    <div id="productAttributes">
    <?php if ($zv_display_select_option 0) { ?>
    <h3 id="attribsOptionsText"><?php //echo TEXT_PRODUCT_OPTIONS; ?>Enter your Prescription:</h3>
    <?php // show please select unless all are readonly ?>

    <?php
        $html 
    '<table id="products_attributes_table">';
        
    $result = array();
        for(
    $i=0;$i<sizeof($options_name);$i++) 
        {
                switch( 
    strip_tags($options_name[$i]))
                {
                    case 
    'BC (mm) / Dia (mm)':
                        
    $result['BC / DIA']['right'][] = $options_menu[$i];
                        break;
                    case 
    '2 BC (mm) / Dia (mm)':
                        
    $result['BC / DIA']['left'][] = $options_menu[$i];
                        break;
                    
                    case 
    'Power Range (D)':
                        
    $result['Power']['right'][] = $options_menu[$i];
                        break;
                    case 
    '2 Power Range (D)':
                        
    $result['Power']['left'][] = $options_menu[$i];
                        break;
                        
                    case 
    'Cyl':
                        
    $result['Cyl']['right'][] = $options_menu[$i];
                        break;
                    case 
    '2 Cyl':
                        
    $result['Cyl']['left'][] = $options_menu[$i];
                        break;
                    
                    case 
    'Axes':
                        
    $result['Axes']['right'][] = $options_menu[$i];
                        break;
                    case 
    '2 axes':
                        
    $result['Axes']['left'][] = $options_menu[$i];
                        break;
                    
                    case 
    'Adds':
                        
    $result['Adds']['right'][] = $options_menu[$i];
                        break;
                    case 
    '2 adds':
                        
    $result['Adds']['left'][] = $options_menu[$i];
                        break;
                    
                    case 
    'quantity':
                        
    $result['Qty']['right'][] = $options_menu[$i];
                        break;
                    case 
    '2 quantity':
                        
    $result['Qty']['left'][] = $options_menu[$i];
                        break;
                    case 
    'Colour':
                        
    $result['Colour']['right'][] = $options_menu[$i];
                        break;
                    default:
                        echo 
    'not found: '.$options_name[$i];
                }
        }
        
    $heading "";
        
    $left '';
        
    $right '';
        
    $body '';
        
    $count 0;
        foreach( 
    $result as $key => $value )
        {
            if( 
    $count == )
            {
                
    $heading .= '<th colspan="2" align="right">'.$key.'</th>';
            }
            else
            {
                
    $heading .= '<th>'.$key.'</th>';
            }
            
    $count++;
            foreach( 
    $value['left'] as $leftValues )
            {
                
    $left .= '<td>'.$leftValues.'</td>';
            }
            foreach( 
    $value['right'] as $rightValues )
            {
                
    $right .= '<td>'.$rightValues.'</td>';
            }
        }
    ?>

    <?php
        
    for($i=0;$i<sizeof($options_name);$i++) {
    ?>
    <div class="wrapperAttribsOptions" id="<?php echo $options_wrapper_id[$i];//gjh42 ?>">
    <?php
      
    if ($options_comment[$i] != '' and $options_comment_position[$i] == '0') {
    ?>
    <h3 class="attributesComments"><?php echo $options_comment[$i]; ?></h3>
    <?php
      
    }
    ?>



    <?php if ($options_comment[$i] != '' and $options_comment_position[$i] == '1') { ?>
        <div class="ProductInfoComments"><?php echo $options_comment[$i]; ?></div>
    <?php ?>
    </div>

    <?php
    if ($options_attributes_image[$i] != '') {
    ?>
    <?php 
    echo $options_attributes_image[$i]; ?>
    <?php
    }
    ?>

    <div class="clearBoth"></div>
    <?php
        
    }
    ?>


    <?php
      
    if ($show_onetime_charges_description == 'true') {
    ?>
        <div class="wrapperAttribsOneTime"><?php echo TEXT_ONETIME_CHARGE_SYMBOL TEXT_ONETIME_CHARGE_DESCRIPTION?></div>
    <?php ?>


    <?php
      
    if ($show_attributes_qty_prices_description == 'true') {
    ?>
        <div class="wrapperAttribsQtyPrices"><?php echo zen_image(DIR_WS_TEMPLATE_ICONS 'icon_status_green.gif'TEXT_ATTRIBUTES_QTY_PRICE_HELP_LINK1010) . '&nbsp;' '<a href="javascriptopupWindowPrice(\'' zen_href_link(FILENAME_POPUP_ATTRIBUTES_QTY_PRICES'products_id=' $_GET['products_id'] . '&products_tax_class_id=' $products_tax_class_id) . '\')">' TEXT_ATTRIBUTES_QTY_PRICE_HELP_LINK '</a>'?></div>
    <?php ?>

    <?php
        
    echo '<table cellpadding="0" cellspacing="0"><tr>'.$heading.'</tr><tr><td><span>Right Eye</span></td>'.$right.'</tr><tr class="empty"><td colspan="4"></tr><tr><td><span>Left Eye</span></td>'.$left.'</tr><tr class="empty"><td colspan="4"></tr></table>';
    ?>
    </div>

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

    Default Re: tpl_modules_attributes - modification

    I'm guessing that the answer is in the last section of code:
    Code:
    <?php
        echo '<table cellpadding="0"  cellspacing="0"><tr>'.$heading.'</tr><tr><td><span>Right  Eye</span></td>'.$right.'</tr><tr  class="empty"><td  colspan="4"></tr><tr><td><span>Left  Eye</span></td>'.$left.'</tr><tr  class="empty"><td colspan="4"></tr></table>';
    ?>
    </div>
    I might try replacing those lines to use the following lines instead:
    Code:
    <?php
    echo '<table cellpadding="0" cellspacing="0"><tr>'.$heading.'</tr>';
    if ($left == '<td></td>') { // if there is only a "Right" setting, then assume the choices apply for both eyes equally, ie: skip the "Right" label, and don't output the content for $left:
      echo '<tr><td><span>Selection</span></td>'.$right.'</tr><tr class="empty"><td colspan="4"></tr></table>';
    } else { // otherwise, display both choices
      echo '<tr><td><span>Right Eye</span></td>'.$right.'</tr><tr class="empty"><td colspan="4"></tr><tr><td><span>Left Eye</span></td>'.$left.'</tr><tr class="empty"><td colspan="4"></tr></table>';
    }
    ?>
    </div>
    .

    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
    Feb 2013
    Location
    Vancouver, British Columbia, Canada
    Posts
    3
    Plugin Contributions
    0

    Default Re: tpl_modules_attributes - modification

    Quote Originally Posted by DrByte View Post
    I'm guessing that the answer is in the last section of code:
    Code:
    <?php
        echo '<table cellpadding="0"  cellspacing="0"><tr>'.$heading.'</tr><tr><td><span>Right  Eye</span></td>'.$right.'</tr><tr  class="empty"><td  colspan="4"></tr><tr><td><span>Left  Eye</span></td>'.$left.'</tr><tr  class="empty"><td colspan="4"></tr></table>';
    ?>
    </div>
    I might try replacing those lines to use the following lines instead:
    Code:
    <?php
    echo '<table cellpadding="0" cellspacing="0"><tr>'.$heading.'</tr>';
    if ($left == '<td></td>') { // if there is only a "Right" setting, then assume the choices apply for both eyes equally, ie: skip the "Right" label, and don't output the content for $left:
      echo '<tr><td><span>Selection</span></td>'.$right.'</tr><tr class="empty"><td colspan="4"></tr></table>';
    } else { // otherwise, display both choices
      echo '<tr><td><span>Right Eye</span></td>'.$right.'</tr><tr class="empty"><td colspan="4"></tr><tr><td><span>Left Eye</span></td>'.$left.'</tr><tr class="empty"><td colspan="4"></tr></table>';
    }
    ?>
    </div>
    Thanks - I tried that, same result though.

    Was thinking this am - could the code about a not found be part of it?


    case 'Colour':
    $result['Colour']['right'][] = $options_menu[$i];
    break;
    default:
    echo 'not found: '.$options_name[$i];
    }

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

    Default Re: tpl_modules_attributes - modification

    Oops. I should have checked for 'blank' as well.

    Change this:
    Code:
    if ($left == '<td></td>') {
    to this:
    Code:
    if ($left == '' || $left == '<td></td>') {
    .

    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
    Feb 2013
    Location
    Vancouver, British Columbia, Canada
    Posts
    3
    Plugin Contributions
    0

    Default Re: tpl_modules_attributes - modification

    Quote Originally Posted by DrByte View Post
    Oops. I should have checked for 'blank' as well.

    Change this:
    Code:
    if ($left == '<td></td>') {
    to this:
    Code:
    if ($left == '' || $left == '<td></td>') {
    Thanks - worked perfect.

    Just have to figure out why the option comes up as not found in the cart once you add it.

  6. #6
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: tpl_modules_attributes - modification

    Guessing you've got some similar code elsewhere that needs updating as well.
    .

    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. 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
  2. sidebar modification
    By brent281 in forum Basic Configuration
    Replies: 4
    Last Post: 22 Dec 2008, 03:28 AM
  3. How to change a tpl_modules_attributes.php?
    By Miri4413 in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 20 May 2008, 08:57 PM
  4. Replies: 0
    Last Post: 9 Jan 2007, 04:38 AM
  5. Admin modification vs. .php file modification??
    By recordshow in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 13 Nov 2006, 05:00 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