Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 43
  1. #21
    Join Date
    Oct 2005
    Location
    Chicago, IL USA
    Posts
    1,587
    Plugin Contributions
    29

    Default Re: Using include in product description

    My mistake, it is 1.2.7 and the upgrade in on my list :-)

    I found the file in:
    /includes/modules/pages/product_info/main_template_vars_attributes.php

    I then found this following code but am at a complete loss as to how to change it to display only if text exists. I think that's a bit beyond my skills. Any suggestions or references to figure it out?

    // Read Only - just for display purposes

    if ($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_READONLY) {

    // $tmp_html .= '<input type="hidden" name ="id[' . $products_options_names->fields['products_options_id'] . ']"' . '" value="' . stripslashes($products_options->fields['products_options_values_name']) . ' SELECTED' . '" /> ' . $products_options->fields['products_options_values_name'];

    $tmp_html .= $products_options_details . '<br />';

    } else {

    $zv_display_select_option ++;

    }

  2. #22
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Using include in product description

    If this is blank then you don't want to show it:
    $products_options->fields['products_options_values_name']
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #23
    Join Date
    Oct 2005
    Location
    Chicago, IL USA
    Posts
    1,587
    Plugin Contributions
    29

    Default Re: Using include in product description

    You've been so helpful, but you lost me. Don't I need some sort of if/then statement? If the field is blank, then do not display the attribute. If it contains text, then display the attribrute.

    I'm not following where your statement goes, if it should replace something...

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

    Default Re: Using include in product description

    You could add a test for $products_options->fields['products_options_values_name'] being not blank to the if statement:

    PHP Code:
    // Read Only - just for display purposes

    if (($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_READONLY) and ($products_options->fields['products_options_values_name'] != ' ')) {

    // $tmp_html .= '<input type="hidden" name ="id[' . $products_options_names->fields['products_options_id'] . ']"' . '" value="' . stripslashes($products_options->fields['products_options_values_name']) . ' SELECTED' . '" /> ' . $products_options->fields['products_options_values_name'];

    $tmp_html .= $products_options_details '<br />';

    } else {

    $zv_display_select_option ++;


    I am not positive I have phrased it correctly - Linda will probably be able to give a more elegant statement.

    I wonder if the // (comment mark) should be removed from the $tmp_html line? That disables the main code in this snippet.

  5. #25
    Join Date
    Oct 2005
    Location
    Chicago, IL USA
    Posts
    1,587
    Plugin Contributions
    29

    Default Re: Using include in product description

    Thanks for the effort, but it still shows up when the field is blank. The comment mark was/is there in the original code.

  6. #26
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Using include in product description

    $products_options->fields['products_options_values_name'] != ' ' is not the same as:
    $products_options->fields['products_options_values_name'] != ''

    You want to test when that field is blank and when blank show nothing ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  7. #27
    Join Date
    Oct 2005
    Location
    Chicago, IL USA
    Posts
    1,587
    Plugin Contributions
    29

    Default Re: Using include in product description

    I'm understanding the logic but not the coding. This is what I have understood, but it's not working right.

    // Read Only - just for display purposes

    if (($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_READONLY) and ($products_options->fields['products_options_values_name'] != '')) {

    $tmp_html .= $products_options_details . '<br />';

    } else {

    $zv_display_select_option ++;

    }

    What did I misunderstand?

  8. #28
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Using include in product description

    If you look for the constant, I believe there are 2 places to reference in that file ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  9. #29
    Join Date
    Oct 2005
    Location
    Chicago, IL USA
    Posts
    1,587
    Plugin Contributions
    29

    Default Re: Using include in product description

    Linda,

    What is the constant you're referring to? Is it PRODUCTS_OPTIONS_TYPE_READONLY?

    If so, I did find two other references but I don't know what to do with them.

  10. #30
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Using include in product description

    The constant is the:
    PRODUCTS_OPTIONS_TYPE_READONLY

    I forget off hand the code in 1.2.7 but it is similar ...

    In the first location I change the code to:
    PHP Code:
                      // Read Only - just for display purposes
                      
    if ($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_READONLY) {
                        
    //            $tmp_html .= '<input type="hidden" name ="id[' . $products_options_names->fields['products_options_id'] . ']"' . '" value="' . stripslashes($products_options->fields['products_options_values_name']) . ' SELECTED' . '" />  ' . $products_options->fields['products_options_values_name'];
                        
    if (empty($products_options_details)) {
                          
    $tmp_html '';
                        } else {
                          
    $tmp_html .= $products_options_details '<br />';
                        }
                      } else {
                        
    $zv_display_select_option ++;
                      } 
    In the next location I change the code:
    PHP Code:
                      // READONLY
                      
    case ($products_options_names->fields['products_options_type'] == PRODUCTS_OPTIONS_TYPE_READONLY):
                      if (empty(
    $tmp_html)) {
                      } else {
                      
    $options_name[] = $products_options_names->fields['products_options_name'];
                      
    $options_menu[] = $tmp_html "\n";
                      
    $options_comment[] = $products_options_names->fields['products_options_comment'];
                      
    $options_comment_position[] = ($products_options_names->fields['products_options_comment_position'] == '1' '1' '0');
                      }
                      break; 
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

 

 
Page 3 of 5 FirstFirst 12345 LastLast

Similar Threads

  1. Using PHP "include" in category & product description
    By g6enterprises in forum General Questions
    Replies: 4
    Last Post: 30 Jan 2009, 09:14 PM
  2. How to include other page to product description
    By marksu in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 11 Dec 2008, 12:47 AM
  3. How to include php code into a product description
    By andy1234 in forum General Questions
    Replies: 10
    Last Post: 5 Jan 2008, 06:32 AM
  4. Using php include in product descriptions
    By gaekwad in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 12 Jun 2007, 11:31 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