You are here:  » config_commonFields case insensitive


config_commonFields case insensitive

Submitted by sirmanu on Fri, 2023-02-03 13:47 in

Hi David.

I have $config_commonFields with several values.

For instance:

$config_commonFields['price'] = ['PRICE', 'price', 'price_new', 'PRICE_NEW'];

Is it possible to make $config_commonFields case insensitive so feeds_register_step2 works with just one combination? Thank you.

Submitted by support on Sat, 2023-02-04 10:15

Hi,

Sure - to do this edit admin/feeds_register_step2.php and locate the existing sections of code to scan for the default beginning at lines 159 and 222:

    if (!$default)
    {
      if (isset($config_commonFields[$name]))
      {
        foreach($config_commonFields[$name] as $test)
        {
          if (isset($productRecordFields[$test]))
          {
            $default = $test;
            break;
          }
        }
      }
    }

...and REPLACE each instance with:

    if (!$default)
    {
      if (isset($config_commonFields[$name]))
      {
        foreach($config_commonFields[$name] as $commonField)
        {
          foreach($productRecordFields as $productRecordField)
          {
            if (!strcasecmp($commonField,$productRecordField))
            {
              $default = $productRecordField;
              break;
            }
          }
          if ($default) break;
        }
      }
    }

Cheers,
David.
--
PriceTapestry.com

Submitted by sirmanu on Fri, 2023-02-10 09:01

Thank you as always, David.

Have a nice weekend.

Submitted by sirmanu on Fri, 2023-02-10 10:55

EDIT:

For category wasn't working so I have done the same into function field_custom()

Is this correct?

Thank you!

Submitted by support on Fri, 2023-02-10 11:20

Yes correct - the loop is identical in both functions.

Cheers,
David.
--
PriceTapestry.com