Results 1 to 4 of 4
  1. #1
    Join Date
    May 2006
    Posts
    321
    Plugin Contributions
    0

    Default [Done v2.0.0]Error deleting ALL attribs: Cannot use object of type queryFactoryResult

    I received this e-mail after upgrading a client from 1.3.7 to 1.3.8a:

    I'm currently inserting some new product in my shop and I realized that I may have done the attributes wrong for one of the items. Before the upgrade I would just click on that item's attributes and hit "delete ALL product attributes for blah blah blah" and then I would simply redo it. Now when I go to delete All attributes I get the following message...

    Fatal error: Cannot use object of type queryFactoryResult as array in /home/hersite/public_html/shop/admin/includes/functions/general.php on line 2089

    I tried searching, but there were so many threads that it was difficult to sort through them all to look for what applies here. Any ideas?

    Thanks!

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Error deleting ALL attribs: Fatal error: Cannot use object of type queryFactoryRe

    a bug!

    There's a small error in the function that is used to delete attributes, which only manifests when the product has Download Files attached to it.

    To fix it, edit this file:
    /admin/includes/functions/general.php

    around line 2082, you'll see the following code.
    Make the following change by adding the ->fields text as shown:
    Code:
    ////
    // Delete all product attributes
      function zen_delete_products_attributes($delete_product_id) {
        global $db;
        // delete associated downloads
        $products_delete_from= $db->Execute("select pa.products_id, pad.products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad  where pa.products_id='" . $delete_product_id . "' and pad.products_attributes_id= pa.products_attributes_id");
        while (!$products_delete_from->EOF) {
          $db->Execute("delete from " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " where products_attributes_id = '" . $products_delete_from->fields['products_attributes_id'] . "'");
          $products_delete_from->MoveNext();
        }
    
        $db->Execute("delete from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . $delete_product_id . "'");
    }
    .

    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
    Apr 2004
    Location
    vienna
    Posts
    198
    Plugin Contributions
    9

    Default Re: Error deleting ALL attribs: Fatal error: Cannot use object of type queryFactoryRe

    Quote Originally Posted by DrByte View Post
    a bug!
    this bug is back with PHP5.3 support == http://www.zen-cart.com/forum/showthread.php?t=140960
    because $products_delete_from->fields['products_attributes_id'] is lost again

    same with banner_monthly.php == http://www.zen-cart.com/forum/showpo...1&postcount=23
    Last edited by hugo13; 14 Dec 2009 at 10:39 AM.

  4. #4
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Error deleting ALL attribs: Fatal error: Cannot use object of type queryFactoryRe

    Yes. The PHP 5.3 files must be merged with any other fixes you've applied to your site.
    The PHP 5.3 patch was kept as minimalist as possible.
    .

    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. v139h Cannot use object of type queryFactoryResult
    By dmagic in forum General Questions
    Replies: 1
    Last Post: 19 Dec 2013, 06:05 PM
  2. Replies: 3
    Last Post: 11 Nov 2009, 04:37 AM
  3. Replies: 7
    Last Post: 4 Nov 2009, 10:49 PM
  4. Error in referrals.php - Cannot use object of type queryFactoryResult as array
    By Agouti in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 3 Jan 2009, 08:25 PM
  5. Replies: 4
    Last Post: 21 Mar 2008, 06:41 PM

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