Zen Cart Logo
Forums / Bug Reports / [Done v2.0.0]Error deleting ALL attribs: Cannot use object of type queryFactoryResult

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

Locked

Views: 4,819

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
14 Feb 2008, 2:07 AM
#1
digidiva_kathy avatar

digidiva_kathy

Zen Follower

Join Date:
May 2006
Posts:
323
Plugin Contributions:
0

[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!

14 Feb 2008, 4:06 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

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

:eek: 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:```
////
// 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[B]->fields[/B]['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.

14 Dec 2009, 9:35 AM
#3
hugo13 avatar

hugo13

Zen Follower

Join Date:
Apr 2004
Location:
vienna
Posts:
176
Plugin Contributions:
4

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

DrByte:

:eek: 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/showpost.php?p=570951&postcount=23

14 Dec 2009, 9:51 AM
#4
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

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

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.