You are here:  » Undefined index: merchant_name

Active Forum Topics


Undefined index: merchant_name

Submitted by Perce2 on Thu, 2020-05-28 06:47 in

Hi David, hope you are well.

Going through some backup files, I noticed that all my sites have some quite large error logs going wayback inside the scripts folder.

This is the error:

PHP Notice: Undefined index: merchant_name in /home/xxxxxxxxxxxxxx/public_html/xxxxxxxxxx/includes/admin.php on line 236

Looks like a missing 'isset' somewhere, what do you think?

Thanks

Submitted by support on Thu, 2020-05-28 07:08

Hi,

The key "merchant_name" isn't used in the distribution code so it sounds like a modification that just needs to have an isset() check added - please could you post the few lines of code either side of line 236 from the file referred to and I'll check it out further with you...

Cheers,
David.
--
PriceTapestry.com

Submitted by Perce2 on Fri, 2020-05-29 06:46

Hope this helps, line 236 shown:

{code saved}
(236) $importRecord["merchant"] = $record[$admin_importFeed["field_merchant"]];
{code saved}

Submitted by support on Fri, 2020-05-29 07:04

Hi,

Ah I see what's happened - that would indicate that a record in the feed being imported didn't have the mapped field containing the merchant name (merchant_name in this case) so to prevent the warning, REPLACE line 236 with the following code:

  $importRecord["merchant"] = (isset($record[$admin_importFeed["field_merchant"]])?$record[$admin_importFeed["field_merchant"]]:"");

Note that this means the product being imported will fail the minimum required fields check (which would be happening anyway) - if you happen to notice from the /admin/ home page that you have a feed showing zero products that could be the cause and I would check that the feed is registered correctly. If all merchants are showing products it would indicate a data issue within one or more products of an otherwise OK feed...

Cheers,
David.
--
PriceTapestry.com