Zen Cart Logo
If this is your first visit, check our documentation. To post, register or login.
Forums / Setting Up Your Zen Cart Products / Setting Up Categories, Products, Attributes / Disappearing Master Category ID, product name & product description

Disappearing Master Category ID, product name & product description

Started by kcb410 on 13 Jun 2017, 1:30 PM · Views: 2,304

Results 1 to 18 of 18
13 Jun 2017, 1:30 PM
#1
kcb410 avatar

kcb410

Zen Follower

Join Date:
Dec 2008
Location:
Toronto
Posts:
348
Plugin Contributions:
0

Post #1 by kcb410

Hello Everyone,

We're in the process of creating a few new products using the native copy or new product functions in Zen admin. When we use the new product function, the new product initially has a Product Master Category ID, we give it a name and type a product description and insert it. When you reopen the product the Product Master Category ID, product name and description are blank. When we use the copy function the same thing occurs.

The log file is generating the following error:

[13-Jun-2017 08:51:25 America/New_York] PHP Warning: reset() expects parameter 1 to be array, null given in XXXXX/includes/classes/object_info.php on line 29
[13-Jun-2017 08:51:25 America/New_York] PHP Warning: Variable passed to each() is not an array or object in XXXXX/includes/classes/object_info.php on line 30

We use the following addons:
Zen Lightbox, CSS/JSS Loader, Sitemap XML, COWOA, Google Mapinator, TPP, Google Analytics, Short Product Descriptions, Apsona, Snapshot and Maibeez

Can anyone point me in the right direction to correct this?

Any help is appreciated. Thanks.

13 Jun 2017, 2:33 PM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #2 by mc12345678

Some helpful additional questions to be answered: When did this last work? What changed between then and now? Is this a new upgrade or an existing store? From what version was it last upgraded?

Can you identify while stepping through the transaction of at which point the error is generated? Ie. first display the "blank" page to enter new data. Check/refresh logs. Then, enter information, and move to the review step, check/refresh logs. Then insert the product, check/refresh logs.

Are you also able/willing to check/test an update of a product to see if it ends up suffering the same consequence? (Mind you, you would want to try this on a backup of the site and/or make a backup before doing so.)

Also, PHP version?

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

13 Jun 2017, 3:07 PM
#3
kcb410 avatar

kcb410

Zen Follower

Join Date:
Dec 2008
Location:
Toronto
Posts:
348
Plugin Contributions:
0

Post #3 by kcb410

Hello mc12345678,

Thank you for the reply. I've tried to answer your questions below.

mc12345678:

Some helpful additional questions to be answered: When did this last work? What changed between then and now? Is this a new upgrade or an existing store? From what version was it last upgraded?

It's been quite some time since I copied or created a new product so I'm unsure when this last worked. There's been no changes since the last update other than Zens occasional patches. The store was started 2008 , here's the upgrade path:

v1.5.4 [2015-01-28 12:57:58] (Version Update 1.5.3->1.5.4)
v1.5.3 [2015-01-28 12:57:58] (Version Update 1.5.2->1.5.3)
v1.5.2 [2015-01-28 12:57:58] (Version Update 1.5.1->1.5.2)
v1.5.1 [2015-01-28 12:57:56] (Version Update 1.5.0->1.5.1)
v1.5.0 [2012-12-03 16:52:07] (Version Update 1.3.9->1.5.0)
v1.3.9d [2010-06-28 00:54:17] (Version Update 1.3.8->1.3.9d)
v1.3.8 [2008-12-05 15:49:32] (Version Update 1.3.7->1.3.8)
v1.3.7 [2008-12-05 15:49:10] (Version Update 1.3.6->1.3.7)
v1.3.6 [2008-12-05 15:48:16] (Version Update 1.3.5->1.3.6)
v1.3.5 [2008-12-05 15:47:17] (Version Update 1.3.0.2->1.3.5)
v1.3.0.2 [2008-11-07 22:35:35] (Fresh Installation)

We have 155e running on a dev and it doesn't happen on that version.

mc12345678:

Can you identify while stepping through the transaction of at which point the error is generated? Ie. first display the "blank" page to enter new data. Check/refresh logs. Then, enter information, and move to the review step, check/refresh logs. Then insert the product, check/refresh logs.

When we use the new product function, the new product initially has a Product Master Category ID, we give it a name and type a product description as shown below.

Attachment 17093

Click Preview and the info is there.

Attachment 17094

Click Insert and it saves the new product.

Attachment 17095

Click the product we just created and it's gone.

Attachment 17096

mc12345678:

Are you also able/willing to check/test an update of a product to see if it ends up suffering the same consequence? (Mind you, you would want to try this on a backup of the site and/or make a backup before doing so.)
Also, PHP version?

This problem doesn't occur when editing an existing product, we can open a product change text, save it and everything remains.

The PHP Version is: 5.6.30

13 Jun 2017, 4:55 PM
#4
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #4 by mc12345678

Copying of what product was attempted?
Was it a newly created product or was it one that had already existed?

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

13 Jun 2017, 5:13 PM
#5
kcb410 avatar

kcb410

Zen Follower

Join Date:
Dec 2008
Location:
Toronto
Posts:
348
Plugin Contributions:
0

Post #5 by kcb410

mc12345678:

Copying of what product was attempted?
Was it a newly created product or was it one that had already existed?

It happens if you copy a live, existing product and if you create a new one.

13 Jun 2017, 5:48 PM
#6
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #6 by mc12345678

Here's my thoughts on this and a little additional "testing" to confirm "operation".

Attempt to generate a new product. Step to the review screen.
From there select the back button in the window (not the browser) and verify that the information that had been entered remains.

If so, my thought is that there is an issue with admin/includes/modules/update_product.php within one or both of the sections that include 'insert_product' as an action comparison (or data as related before that which would be processed within that band of code). Meaning, that somehow in this process, data to be entered into the database becomes/became misaligned. Would suggest comparing the contents of that file with a copy from a clean install.

And based on the recent notification of occurring with new or existing product, would suggest review of the file admin/includes/modules/copy_to_confirm.php.

Now, it was said above that with a ZC 1.5.5 install, this problem is not occurring; however, is that with a copy of the existing database or a new one?

It could also be an issue of "some sort" with the database, though I would first try to track down the differences in files, particularly in the admin/includes/modules folder as related to a clean install...

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

13 Jun 2017, 6:36 PM
#7
kcb410 avatar

kcb410

Zen Follower

Join Date:
Dec 2008
Location:
Toronto
Posts:
348
Plugin Contributions:
0

Post #7 by kcb410

mc12345678:

Here's my thoughts on this and a little additional "testing" to confirm "operation".

Attempt to generate a new product. Step to the review screen.
From there select the back button in the window (not the browser) and verify that the information that had been entered remains.

If so, my thought is that there is an issue with admin/includes/modules/update_product.php within one or both of the sections that include 'insert_product' as an action comparison (or data as related before that which would be processed within that band of code). Meaning, that somehow in this process, data to be entered into the database becomes/became misaligned. Would suggest comparing the contents of that file with a copy from a clean install.

And based on the recent notification of occurring with new or existing product, would suggest review of the file admin/includes/modules/copy_to_confirm.php.

Now, it was said above that with a ZC 1.5.5 install, this problem is not occurring; however, is that with a copy of the existing database or a new one?

It could also be an issue of "some sort" with the database, though I would first try to track down the differences in files, particularly in the admin/includes/modules folder as related to a clean install...

I've created a new product and selected the back button and the info remains.

The Z155 install uses a copy of the existing database.

I'll do a comparison of my existing admin/includes/modules/update_product.php and admin/includes/modules/copy_to_confirm.php to a clean version of the 154 files.

Thank you for your help.

13 Jun 2017, 6:44 PM
#8
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #8 by mc12345678

kcb410:

I've created a new product and selected the back button and the info remains.

The Z155 install uses a copy of the existing database.

I'll do a comparison of my existing admin/includes/modules/update_product.php and admin/includes/modules/copy_to_confirm.php to a clean version of the 154 files.

Thank you for your help.

Well, the use of the existing (copy of) database and it's successful operation definitely rules out the database as an issue, so it's something related to the files. Perhaps one of the "updates"? Though I can't think of anything that has been posted that would affect this area of the code.

The only other common file that seems to relate to these two issues is the admin/categories.php file.

That said, it still would be good to know during which step of the entire process generated the error log that you posted about earlier. I'm thinking that it is when attempting to access one of the "new" products as a result of the files not being able to successfully pull data from the database (because it didn't get stored "correctly".)

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

13 Jun 2017, 8:26 PM
#9
kcb410 avatar

kcb410

Zen Follower

Join Date:
Dec 2008
Location:
Toronto
Posts:
348
Plugin Contributions:
0

Post #9 by kcb410

mc12345678:

Well, the use of the existing (copy of) database and it's successful operation definitely rules out the database as an issue, so it's something related to the files. Perhaps one of the "updates"? Though I can't think of anything that has been posted that would affect this area of the code.

The only other common file that seems to relate to these two issues is the admin/categories.php file.

That said, it still would be good to know during which step of the entire process generated the error log that you posted about earlier. I'm thinking that it is when attempting to access one of the "new" products as a result of the files not being able to successfully pull data from the database (because it didn't get stored "correctly".)

Thanks for the reply.

The existing admin/includes/modules/update_product.php and admin/includes/modules/copy_to_confirm.php are identical to a clean version of the 154 files.

The admin/categories.php has been altered by the Shorter Descriptions for Categories Plugin. I replaced the admin/categories.php with an original from 154 and it still generates the same error log referenced earlier.

13 Jun 2017, 8:31 PM
#10
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #10 by mc12345678

kcb410:

Thanks for the reply.

The existing admin/includes/modules/update_product.php and admin/includes/modules/copy_to_confirm.php are identical to a clean version of the 154 files.

The admin/categories.php has been altered by the Shorter Descriptions for Categories Plugin. I replaced the admin/categories.php with an original from 154 and it still generates the same error log referenced earlier.

Which operation causes the generation of the error?

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

13 Jun 2017, 8:36 PM
#11
kcb410 avatar

kcb410

Zen Follower

Join Date:
Dec 2008
Location:
Toronto
Posts:
348
Plugin Contributions:
0

Post #11 by kcb410

mc12345678:

Which operation causes the generation of the error?

Clicking the newly created product to open it generates the error log.

13 Jun 2017, 8:41 PM
#12
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #12 by mc12345678

kcb410:

Clicking the newly created product to open it generates the error log.

Okay, so suggest also looking at admin/includes/modules/product/preview_info.php (assuming this is a general product)

Hmm, could also try to generate a product of a different product type to see if the product is not properly created there as well...

The preview_info.php file is supposed to "prepare" the information for receipt/storage as well as keep the previous data to be able to go back to the earlier screen.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

13 Jun 2017, 9:00 PM
#13
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #13 by mc12345678

Entry of product short descriptions, how is that performed? Ie. What screen? Is it an added "window" or an additional field during product entry?

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

14 Jun 2017, 1:37 PM
#14
kcb410 avatar

kcb410

Zen Follower

Join Date:
Dec 2008
Location:
Toronto
Posts:
348
Plugin Contributions:
0

Post #14 by kcb410

mc12345678:

Okay, so suggest also looking at admin/includes/modules/product/preview_info.php (assuming this is a general product)

Hmm, could also try to generate a product of a different product type to see if the product is not properly created there as well...

The preview_info.php file is supposed to "prepare" the information for receipt/storage as well as keep the previous data to be able to go back to the earlier screen.

Sorry for the delayed response.

In looking at this file it has a mod called Product Extra Fields which we haven't used in years and I had forgotten about. I'm going to look at these files now.

14 Jun 2017, 1:40 PM
#15
kcb410 avatar

kcb410

Zen Follower

Join Date:
Dec 2008
Location:
Toronto
Posts:
348
Plugin Contributions:
0

Post #15 by kcb410

mc12345678:

Entry of product short descriptions, how is that performed? Ie. What screen? Is it an added "window" or an additional field during product entry?

I'm sorry I had actually named this mod incorrectly, it's called Short Description for Categories and we still use this but obviously not on product pages.

14 Jun 2017, 4:09 PM
#16
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #16 by mc12345678

kcb410:

I'm sorry I had actually named this mod incorrectly, it's called Short Description for Categories and we still use this but obviously not on product pages.

No problem, that at least explains why there were no modifications in the update_product.php file associated with that code/plugin. :) Now as for the extra products fields part... Been a while since I've installed it, but I would think that somewhere in that submission process its code/results would need to get stored. It may be by an "alternate" file such as an observer, an init_ style file, etc..., but somehow the data would need to come back... And bringing things "full circle" there could be something in the admin/includes/modules/PRODUCT_TYPE/collect_info.php file (where PRODUCT_TYPE might be something like product, document_product, etc...) that is "conflicting" with the expected storage of related extra fields and the fact that none were saved with the product... So.. Might need to go back to the top area of that file in or around:

if (isset($_GET['pID']) && empty($_POST)) {
      $product = $db->Execute("select pd.products_name, pd.products_description, pd.products_url,
                                      p.products_id, p.products_quantity, p.products_model,
                                      p.products_image, p.products_price, p.products_virtual, p.products_weight,
                                      p.products_date_added, p.products_last_modified,
                                      date_format(p.products_date_available, '%Y-%m-%d') as
                                      products_date_available, p.products_status, p.products_tax_class_id,
                                      p.manufacturers_id,
                                      p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute,
                                      p.product_is_free, p.product_is_call, p.products_quantity_mixed,
                                      p.product_is_always_free_shipping, p.products_qty_box_status, p.products_quantity_order_max,
                                      p.products_sort_order,
                                      p.products_discount_type, p.products_discount_type_from,
                                      p.products_price_sorter, p.master_categories_id
                              from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                              where p.products_id = '" . (int)$_GET['pID'] . "'
                              and p.products_id = pd.products_id
                              and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'");

      $pInfo->objectInfo($product->fields);
    } elseif (zen_not_null($_POST)) {
      $pInfo->objectInfo($_POST);
      $products_name = $_POST['products_name'];
      $products_description = $_POST['products_description'];
      $products_url = $_POST['products_url'];
    }

It may also be something a little further down but basically the absence of population of data may be causing the above $product->fields = $db->Execute line to return zero results which would present as you have seen...

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

14 Jun 2017, 8:32 PM
#17
kcb410 avatar

kcb410

Zen Follower

Join Date:
Dec 2008
Location:
Toronto
Posts:
348
Plugin Contributions:
0

Post #17 by kcb410

mc12345678:

No problem, that at least explains why there were no modifications in the update_product.php file associated with that code/plugin. :) Now as for the extra products fields part... Been a while since I've installed it, but I would think that somewhere in that submission process its code/results would need to get stored. It may be by an "alternate" file such as an observer, an init_ style file, etc..., but somehow the data would need to come back... And bringing things "full circle" there could be something in the admin/includes/modules/PRODUCT_TYPE/collect_info.php file (where PRODUCT_TYPE might be something like product, document_product, etc...) that is "conflicting" with the expected storage of related extra fields and the fact that none were saved with the product... So.. Might need to go back to the top area of that file in or around:

if (isset($_GET['pID']) && empty($_POST)) {
$product = $db->Execute("select pd.products_name, pd.products_description, pd.products_url,
p.products_id, p.products_quantity, p.products_model,
p.products_image, p.products_price, p.products_virtual, p.products_weight,
p.products_date_added, p.products_last_modified,
date_format(p.products_date_available, '%Y-%m-%d') as
products_date_available, p.products_status, p.products_tax_class_id,
p.manufacturers_id,
p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute,
p.product_is_free, p.product_is_call, p.products_quantity_mixed,
p.product_is_always_free_shipping, p.products_qty_box_status, p.products_quantity_order_max,
p.products_sort_order,
p.products_discount_type, p.products_discount_type_from,
p.products_price_sorter, p.master_categories_id
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
where p.products_id = '" . (int)$_GET['pID'] . "'
and p.products_id = pd.products_id
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'");

  $pInfo->objectInfo($product->fields);
} elseif (zen_not_null($_POST)) {
  $pInfo->objectInfo($_POST);
  $products_name = $_POST['products_name'];
  $products_description = $_POST['products_description'];
  $products_url = $_POST['products_url'];
}
> 
> It may also be something a little further down but basically the absence of population of data may be causing the above $product->fields = $db->Execute line to return zero results which would present as you have seen...

I've actually removed the Product Extra Fields mod because we're not using it. This resolved the problem.

Thank you very much for leading me through the path to finding it!

I definitely wouldn't have found it on my own.
15 Jun 2017, 12:25 AM
#18
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Post #18 by mc12345678

kcb410:

I've actually removed the Product Extra Fields mod because we're not using it. This resolved the problem.

Thank you very much for leading me through the path to finding it!

I definitely wouldn't have found it on my own.

Thank you for answering the questions asked. :) Helped to be able to remotely troubleshoot the issue. Really glad that you were able to do some sort of comparison on the existing/vanilla files. That cut down on a lot of back and forth. :)

Glad that you're back in business. Now to just finish the upgrade! :)

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...