Results 1 to 7 of 7
  1. #1
    Join Date
    May 2005
    Location
    England
    Posts
    673
    Plugin Contributions
    0

    Default setting up attributes file to not show display only in 2.10

    php 8.2 zencart 2.10

    I have been using the Numinix Google Product Search feeder to add google product categories for many years. I have just upgraded to 2.10, and it seems the code I have added as per their instructions is redundant. The goal is to stop showing display only attributes on the product info page, otherwise it looks a little confusing for the customer.

    I have to add this element:-

    PHP Code:
       and      patrib.attributes_display_only 
    I was getting an error regarding the '=' symbol

    So I think it needs to be :-
    PHP Code:
       and      patrib.attributes_display_only == 
    But now I get an error log as below:

    PHP Code:
    PHP Fatal errorUncaught ErrorUndefined constant "patrib" in 
    I think the attributes has been re-worked now, I guess there is a new constant to replace 'patrib'? Or maybe the whole code needs altering, am not sure.
    Last edited by HeathenMagic; 25 Feb 2025 at 10:09 PM.

  2. #2
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,278
    Plugin Contributions
    125

    Default Re: setting up attributes file to not show display only in 2.10

    > it seems the code I have added as per their instructions is redundant ...

    where are you adding this code?
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  3. #3
    Join Date
    May 2005
    Location
    England
    Posts
    673
    Plugin Contributions
    0

    Default Re: setting up attributes file to not show display only in 2.10

    Quote Originally Posted by swguy View Post
    > it seems the code I have added as per their instructions is redundant ...

    where are you adding this code?
    Sorry I was a bit vague there. Its includes/modules/attributes.php. I have put the snippet below, its mentioned twice. I know its a developer plugin, it might take them a while to update as they are usually busy. I was curious what the new alternative constant is, if there is one. Bear in mind I have adapted these code snippets to the 2.10 standard, it was working for 1.58a and before, I am aware attributes has been massively reworked so it makes sense it no longer works off the bat:-

    PHP Code:
    // Determine number of attributes associated with this product
    $sql "SELECT count(*) as total
            FROM " 
    TABLE_PRODUCTS_OPTIONS " popt
            LEFT JOIN " 
    TABLE_PRODUCTS_ATTRIBUTES " patrib ON (popt.products_options_id = patrib.options_id)
            WHERE patrib.products_id = :products_id
            AND popt.language_id = :language_id
              and      patrib.attributes_display_only = 0 
            LIMIT 1"
    ;
    $sql $db->bindVars($sql':products_id'$_GET['products_id'], 'integer');
    $sql $db->bindVars($sql':language_id'$_SESSION['languages_id'], 'integer');
    $pr_attr $db->Execute($sql);

    if (
    $pr_attr->fields['total'] < 1) return;
    // Only process the rest of this file if attributes are defined for this product


    $prod_id $_GET['products_id'];
    $number_of_uploads 0;
    $zv_display_select_option 0;
    $options_name $options_menu $options_html_id $options_inputfield_id $options_comment $options_comment_position $options_attributes_image = array();
    $attributeDetailsArrayForJson = array();

    $discount_type zen_get_products_sale_discount_type((int)$_GET['products_id']);
    $discount_amount zen_get_discount_calc((int)$_GET['products_id']);
    $products_price_is_priced_by_attributes zen_get_products_price_is_priced_by_attributes((int)$_GET['products_id']);


    if (
    PRODUCTS_OPTIONS_SORT_ORDER == '0') {
        
    $options_order_by " ORDER BY LPAD(popt.products_options_sort_order,11,'0'), popt.products_options_name";
    } else {
        
    $options_order_by ' order by popt.products_options_name';
    }

    $sql "SELECT DISTINCT popt.products_options_id, popt.products_options_name, popt.products_options_sort_order,
                popt.products_options_type, popt.products_options_length, popt.products_options_comment, popt.products_options_comment_position,
                popt.products_options_size,
                popt.products_options_images_per_row,
                popt.products_options_images_style,
                popt.products_options_rows
            FROM " 
    TABLE_PRODUCTS_OPTIONS " popt
            LEFT JOIN " 
    TABLE_PRODUCTS_ATTRIBUTES " patrib ON (patrib.options_id = popt.products_options_id)
            WHERE patrib.products_id= :products_id
            AND popt.language_id = :language_id " 
              
    and      patrib.attributes_display_only == .
            
    $options_order_by;
    $sql $db->bindVars($sql':products_id'$_GET['products_id'], 'integer');
    $sql $db->bindVars($sql':language_id'$_SESSION['languages_id'], 'integer');
    $products_options_names $db->Execute($sql); 

  4. #4
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,278
    Plugin Contributions
    125

    Default Re: setting up attributes file to not show display only in 2.10

    You can see the issue from the color coding above. This line:

    > and patrib.attributes_display_only == 0 .

    needs to be in quotes. And just one equal sign.

    " and patrib.attributes_display_only = 0 " .
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  5. #5
    Join Date
    May 2005
    Location
    England
    Posts
    673
    Plugin Contributions
    0

    Default Re: setting up attributes file to not show display only in 2.10

    Quote Originally Posted by swguy View Post
    You can see the issue from the color coding above. This line:

    > and patrib.attributes_display_only == 0 .

    needs to be in quotes. And just one equal sign.

    " and patrib.attributes_display_only = 0 " .
    Thanks for that Scott, I modified those two lines. I seem to get the same error hence I tried two equals signs:-

    PHP Code:
     PHP Parse errorsyntax errorunexpected token "=" 
    Its strange how the new php 8 doesn't like this logic. Though actually I have production site 1.58a and its using same php 8.2, and that works with the first code example I put. I guess its clashing with some of the new code somehow on my 2.10 dev site?

  6. #6
    Join Date
    Jul 2012
    Posts
    16,797
    Plugin Contributions
    17

    Default Re: setting up attributes file to not show display only in 2.10

    Quote Originally Posted by HeathenMagic View Post
    Sorry I was a bit vague there. Its includes/modules/attributes.php. I have put the snippet below, its mentioned twice. I know its a developer plugin, it might take them a while to update as they are usually busy. I was curious what the new alternative constant is, if there is one. Bear in mind I have adapted these code snippets to the 2.10 standard, it was working for 1.58a and before, I am aware attributes has been massively reworked so it makes sense it no longer works off the bat:-

    PHP Code:
    // Determine number of attributes associated with this product
    $sql "SELECT count(*) as total
            FROM " 
    TABLE_PRODUCTS_OPTIONS " popt
            LEFT JOIN " 
    TABLE_PRODUCTS_ATTRIBUTES " patrib ON (popt.products_options_id = patrib.options_id)
            WHERE patrib.products_id = :products_id
            AND popt.language_id = :language_id
              and      patrib.attributes_display_only = 0 
            LIMIT 1"
    ;
    $sql $db->bindVars($sql':products_id'$_GET['products_id'], 'integer');
    $sql $db->bindVars($sql':language_id'$_SESSION['languages_id'], 'integer');
    $pr_attr $db->Execute($sql);

    if (
    $pr_attr->fields['total'] < 1) return;
    // Only process the rest of this file if attributes are defined for this product


    $prod_id $_GET['products_id'];
    $number_of_uploads 0;
    $zv_display_select_option 0;
    $options_name $options_menu $options_html_id $options_inputfield_id $options_comment $options_comment_position $options_attributes_image = array();
    $attributeDetailsArrayForJson = array();

    $discount_type zen_get_products_sale_discount_type((int)$_GET['products_id']);
    $discount_amount zen_get_discount_calc((int)$_GET['products_id']);
    $products_price_is_priced_by_attributes zen_get_products_price_is_priced_by_attributes((int)$_GET['products_id']);


    if (
    PRODUCTS_OPTIONS_SORT_ORDER == '0') {
        
    $options_order_by " ORDER BY LPAD(popt.products_options_sort_order,11,'0'), popt.products_options_name";
    } else {
        
    $options_order_by ' order by popt.products_options_name';
    }

    $sql "SELECT DISTINCT popt.products_options_id, popt.products_options_name, popt.products_options_sort_order,
                popt.products_options_type, popt.products_options_length, popt.products_options_comment, popt.products_options_comment_position,
                popt.products_options_size,
                popt.products_options_images_per_row,
                popt.products_options_images_style,
                popt.products_options_rows
            FROM " 
    TABLE_PRODUCTS_OPTIONS " popt
            LEFT JOIN " 
    TABLE_PRODUCTS_ATTRIBUTES " patrib ON (patrib.options_id = popt.products_options_id)
            WHERE patrib.products_id= :products_id
            AND popt.language_id = :language_id " 
              
    and      patrib.attributes_display_only == .
            
    $options_order_by;
    $sql $db->bindVars($sql':products_id'$_GET['products_id'], 'integer');
    $sql $db->bindVars($sql':language_id'$_SESSION['languages_id'], 'integer');
    $products_options_names $db->Execute($sql); 
    Look at the difference in the above PHP code towards the bottom to what is provided below. While, yes your past code may be similar, as swift pointed out you can see a clear difference in just the color of the code or text.

    I chose to concatenate the new line rather than extend the content within the existing quote. Doing so makes it easier to incorporate changes again in the future using a software comparison tool.

    Quote Originally Posted by HeathenMagic View Post
    Sorry I was a bit vague there. Its includes/modules/attributes.php. I have put the snippet below, its mentioned twice. I know its a developer plugin, it might take them a while to update as they are usually busy. I was curious what the new alternative constant is, if there is one. Bear in mind I have adapted these code snippets to the 2.10 standard, it was working for 1.58a and before, I am aware attributes has been massively reworked so it makes sense it no longer works off the bat:-

    PHP Code:
    // Determine number of attributes associated with this product
    $sql "SELECT count(*) as total
            FROM " 
    TABLE_PRODUCTS_OPTIONS " popt
            LEFT JOIN " 
    TABLE_PRODUCTS_ATTRIBUTES " patrib ON (popt.products_options_id = patrib.options_id)
            WHERE patrib.products_id = :products_id
            AND popt.language_id = :language_id
              and      patrib.attributes_display_only = 0 
            LIMIT 1"
    ;
    $sql $db->bindVars($sql':products_id'$_GET['products_id'], 'integer');
    $sql $db->bindVars($sql':language_id'$_SESSION['languages_id'], 'integer');
    $pr_attr $db->Execute($sql);

    if (
    $pr_attr->fields['total'] < 1) return;
    // Only process the rest of this file if attributes are defined for this product


    $prod_id $_GET['products_id'];
    $number_of_uploads 0;
    $zv_display_select_option 0;
    $options_name $options_menu $options_html_id $options_inputfield_id $options_comment $options_comment_position $options_attributes_image = array();
    $attributeDetailsArrayForJson = array();

    $discount_type zen_get_products_sale_discount_type((int)$_GET['products_id']);
    $discount_amount zen_get_discount_calc((int)$_GET['products_id']);
    $products_price_is_priced_by_attributes zen_get_products_price_is_priced_by_attributes((int)$_GET['products_id']);


    if (
    PRODUCTS_OPTIONS_SORT_ORDER == '0') {
        
    $options_order_by " ORDER BY LPAD(popt.products_options_sort_order,11,'0'), popt.products_options_name";
    } else {
        
    $options_order_by ' order by popt.products_options_name';
    }

    $sql "SELECT DISTINCT popt.products_options_id, popt.products_options_name, popt.products_options_sort_order,
                popt.products_options_type, popt.products_options_length, popt.products_options_comment, popt.products_options_comment_position,
                popt.products_options_size,
                popt.products_options_images_per_row,
                popt.products_options_images_style,
                popt.products_options_rows
            FROM " 
    TABLE_PRODUCTS_OPTIONS " popt
            LEFT JOIN " 
    TABLE_PRODUCTS_ATTRIBUTES " patrib ON (patrib.options_id = popt.products_options_id)
            WHERE patrib.products_id= :products_id
            AND popt.language_id = :language_id " 
        
    "      and      patrib.attributes_display_only = 0 " .
            
    $options_order_by;
    $sql $db->bindVars($sql':products_id'$_GET['products_id'], 'integer');
    $sql $db->bindVars($sql':language_id'$_SESSION['languages_id'], 'integer');
    $products_options_names $db->Execute($sql); 
    Also note I put a space after the zero and before the closing quote. This ensures a gap between the zero and the following "ORDER BY..." code.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #7
    Join Date
    May 2005
    Location
    England
    Posts
    673
    Plugin Contributions
    0

    Default Re: setting up attributes file to not show display only in 2.10

    Thanks so much for that. It seems to work with no logs and page is fine! I think I messed up the spacing, I wasn't sure. I need to learn how to use " elements better. I have a lot to learn lol.

 

 

Similar Threads

  1. v139h How to modify my template to not show display-only attributes?
    By AvaAdorn in forum Setting Up Categories, Products, Attributes
    Replies: 12
    Last Post: 19 Jun 2014, 07:50 PM
  2. show additonal graphic only when text attributes display?
    By bonnit in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 24 May 2011, 09:42 AM
  3. Display-only attributes: show side by side?
    By cosmocanuck in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 20 Mar 2011, 04:29 AM
  4. Setting Attributes with 2 options (1) 4 file download (2) Hardcopy
    By Elarya in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 9 Mar 2008, 03:52 PM
  5. Product Attributes - display file size?
    By Valaroopie in forum General Questions
    Replies: 1
    Last Post: 15 Mar 2007, 01:51 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