You are here:  » php error

Support Forum



php error

Submitted by thelegacy on Tue, 2011-03-01 23:22 in

Hi David,

Seems I have included something from an older mod that doesn't appear Kosher with the latest distribution. I'm pretty sure I know where it's coming from, not so about the fix for it.

I added a BrandsMapping mod, table etc.. now I am getting this error, although it does import the feeds on the slow import, I just end up with a huge error log..lol

Warning: Invalid argument supplied for foreach() in /home/xxxxx/public_html/includes/admin.php on line 282

This is my mod, line #282 here is the "foreach" statement.

/* mod apply brand mappings */
if (isset($admin_importBrandMappings["=".$importRecord["brand"]]))
{
$importRecord["brand"] = $admin_importBrandMappings["=".$importRecord["brand"]];
}
else
{
foreach($admin_importBrandMappings as $k => $v)
{
if (substr($k,0,1) !== "=")
{
$found = 0;

$words = explode(" ",$k);

foreach($words as $word)
{
if ($word)
{
if (strpos($importRecord["brand"],$word) !== FALSE) $found++;
}
}

if ($found == count($words))
{
$importRecord["brand"] = $v;

break;
}
}
}
}

Thanks in adavance,

Ray

Submitted by support on Wed, 2011-03-02 09:30

Hi Ray,

Replace the else statement at line 5 of the above code with:

elseif(is_array($admin_importBrandMappings))

Cheers,
David.
--
PriceTapestry.com

Submitted by thelegacy on Thu, 2011-03-03 20:52

Thanks once again David, I assumed it was something right in front of my nose..lol