Results 1 to 10 of 10
  1. #1
    Join Date
    May 2011
    Location
    Tennessee
    Posts
    377
    Plugin Contributions
    0

    Default PHP Fatal error: 1060:Duplicate column name 'products_id'

    [Note: remember to include site URL, ZC version, list of plugins, PHP version, etc ... read the Posting Tips shown above for information to include in your post here.
    And, remove this comment before actually posting!]

    I recently upgraded from 1.5.7 to 1.5.8 and started receiving the following error whenever a search is done in SBA Search. I went back to 1.5.7 and it did not have the error. Then I tried upgrading for the second time with new douwn loads etc. and the error repeated. It appears the error is in 1.5.8.

    Has anyone else experienced the error?

    SBA Error
    Product ID Search


    [21-Jul-2023 21:20:31 UTC] Request URI: /shop_new/flinG-zvG-sKips/index.php?cmd=products_with_attributes_stock&page=1&search_order_by=products_id, IP address: 69.137.114.242, Language id 1
    #1 trigger_error() called at [/includes/classes/db/mysql/query_factory.php:667]
    #2 queryFactory->show_error() called at [/includes/classes/db/mysql/query_factory.php:634]
    #3 queryFactory->set_error() called at [/includes/classes/db/mysql/query_factory.php:275]
    #4 queryFactory->Execute() called at [/flinG-zvG-sKips/includes/classes/split_page_results.php:220]
    #5 splitPageResults->numberRows() called at [/flinG-zvG-sKips/includes/classes/split_page_results.php:131]
    #6 splitPageResults->__construct() called at [/flinG-zvG-sKips/includes/classes/products_with_attributes_stock.php:389]
    #7 products_with_attributes_stock->displayFilteredRows() called at [/flinG-zvG-sKips/products_with_attributes_stock.php:1506]
    #8 require(/flinG-zvG-sKips/products_with_attributes_stock.php) called at [/flinG-zvG-sKips/index.php:11]
    --> PHP Fatal error: 1060uplicate column name 'products_id' :: SELECT count(*) as total FROM (SELECT DISTINCT pa.products_id, pd.products_name, p.products_quantity, p.products_model, p.products_image, p.products_type, p.master_categories_id, p.products_id FROM products_attributes pa INNER JOIN products_description pd ON (pa.products_id = pd.products_id) INNER JOIN products p ON (pa.products_id = p.products_id) WHERE pd.language_id=1 ORDER BY p.products_id ) countresults ==> (as called by) /flinG-zvG-sKips/includes/classes/split_page_results.php on line 220 <== in /includes/classes/db/mysql/query_factory.php on line 667.

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,524
    Plugin Contributions
    88

    Default Re: PHP Fatal error: 1060:Duplicate column name 'products_id'

    That's a fatal error in the "Stock by Attributes" add-on, not the Zen Cart core.

    I'm pretty sure that the current support thread for that add-on is here: https://www.zen-cart.com/showthread....r-v1-3-5-1-3-9

    That's where you should report the issue.

  3. #3
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,716
    Plugin Contributions
    123

    Default Re: PHP Fatal error: 1060:Duplicate column name 'products_id'

    If you look at admin/includes/classes/products_with_attributes_stock.php line 389, you're going to see that it calls numberRows() with a string that looks like this:

    SELECT DISTINCT pa.products_id, pd.products_name, p.products_quantity, p.products_model, p.products_image, p.products_type, p.master_categories_id, p.products_id

    Just remove the last part (, p.products_id) so it looks like this:

    SELECT DISTINCT pa.products_id, pd.products_name, p.products_quantity, p.products_model, p.products_image, p.products_type, p.master_categories_id
    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.

  4. #4
    Join Date
    May 2011
    Location
    Tennessee
    Posts
    377
    Plugin Contributions
    0

    Default Re: PHP Fatal error: 1060:Duplicate column name 'products_id'

    I did not see a line that you are secribing. Here is line 389 and the line before and after.

    if (!isset($_GET['seachPID']) && !isset($_GET['pwas-search-button']) && !isset($_GET['updateReturnedPID'])) {
    $products_split = new splitPageResults($_GET['page'], STOCK_SET_SBA_NUMRECORDS, $query_products, $products_query_numrows);
    }

    I do not see a line like you are describing.

  5. #5
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,716
    Plugin Contributions
    123

    Default Re: PHP Fatal error: 1060:Duplicate column name 'products_id'

    Search backwards for the definition of $query_products.
    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.

  6. #6
    Join Date
    May 2011
    Location
    Tennessee
    Posts
    377
    Plugin Contributions
    0

    Default Re: PHP Fatal error: 1060:Duplicate column name 'products_id'

    Quote Originally Posted by swguy View Post
    Search backwards for the definition of $query_products.
    I tried looking backwards for the line you are describing and did not find a line with the product id defined twice. I also checked all the select distinct and did not find two definitions for the product id in the same statement.

  7. #7
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,699
    Plugin Contributions
    9

    Default Re: PHP Fatal error: 1060:Duplicate column name 'products_id'

    Quote Originally Posted by jodean View Post
    #7 products_with_attributes_stock->displayFilteredRows() called at [/flinG-zvG-sKips/products_with_attributes_stock.php:1506]
    i believe this is where your problem lies... not in the classes file.

    best.
    author of square Webpay.
    mxWorks has premium plugins. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  8. #8
    Join Date
    May 2011
    Location
    Tennessee
    Posts
    377
    Plugin Contributions
    0

    Default Re: PHP Fatal error: 1060:Duplicate column name 'products_id'

    I am sorry Carl but I do not understand your reply.

  9. #9
    Join Date
    Jul 2012
    Posts
    16,735
    Plugin Contributions
    17

    Default Re: PHP Fatal error: 1060:Duplicate column name 'products_id'

    This issue ended up being brought up in stock by attributes where a solution has been provided: https://www.zen-cart.com/showthread....34#post1396034

    There are some inherent differences between being able to operate under Zen cart 1.5.7 and 1.5.8 and there have been some changes to Zen cart 1.5.8 requiring other code to be changed, but that's a separate and unrelated topic. While I stated I didn't fully like my provided solution, I have determined a more generic fix that still needs to be uploaded. Of course it would help to hear back that the proposed solution at least worked. It was posted within 3 hours of reporting the here which took 2 hours to post on the appropriate forum thread.

    So hey, @jodean, what's the status?
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  10. #10
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,716
    Plugin Contributions
    123

    Default Re: PHP Fatal error: 1060:Duplicate column name 'products_id'

    Closing this thread; please continue on SBA thread as noted by @mc12345678.
    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.

 

 

Similar Threads

  1. v151 PHP Fatal error: 1062:Duplicate entry
    By joyjoy in forum General Questions
    Replies: 6
    Last Post: 2 Jan 2014, 10:17 AM
  2. PHP Fatal error: 1062 Duplicate entry Error, cannot fix table
    By RoboPhung in forum General Questions
    Replies: 5
    Last Post: 10 Apr 2013, 09:03 PM
  3. Replies: 1
    Last Post: 6 May 2008, 03:17 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