You are here:  » First product without EAN field


First product without EAN field

Submitted by IG on Sun, 2017-10-08 11:51 in

HI David

The first product of a feed doesn't have an EAN code field and therefore I am not able to choose EAN as the field to import. However, many products in this particular feed to have an EAN code and I am sure there is a way to get around this issue, but how?

Best regards,
IG

Submitted by support on Sun, 2017-10-08 13:40

Hi,

Sure - a small modification can be made to ensure that the the field list is built up from the complete set of unique field names covering the XML scenario where not all fields are present in every record. To do this, edit admin/feeds_register_step2.php and look for the following code beginning at line 91:

  function myRecordHandler($record)
  {
    global $productRecord;
    global $productCount;
    global $samplePage;
    $productCount++;
    $productRecord = $record;
    return ($productCount == $samplePage);
  }

...and REPLACE with:

  function myRecordHandler($record)
  {
    global $productRecord;
    global $productRecordAll;
    global $productCount;
    global $samplePage;
    foreach($record as $k => $v)
    {
      $productRecordAll[$k] = $v;
    }
    $productCount++;
    if ($productCount == $samplePage)
    {
      $productRecord = $record;
    }
  }

And then the following code at (now) line 152:

  foreach($productRecord as $k => $v)

...and REPLACE with:

  foreach($productRecordAll as $k => $v)

Cheers,
David.
--
PriceTapestry.com

Submitted by IG on Mon, 2017-10-09 12:31

Works perfectly - thank you.