You are here:  » Products not associated via EAN


Products not associated via EAN

Submitted by Tobix on Mon, 2022-02-21 17:23 in

Hi, David,
I and a programmer tried the EAN step by step function but unfortunately it doesn't work. This is especially important for smartphones and products like it that do not have a product code.

How can we proceed?

Submitted by support on Tue, 2022-02-22 09:01

Hi Tobix,

First check that your new ean field is being populated at import time. To do this, from /admin/ go to Tools > Feed Utilities, and for a feed for which you have registered an EAN field go to Imported Analysis. Click on a product and check that you are seeing the EAN number as expected. If not, check that you are registering the feed correctly and mapping the EAN field in the feed to the EAN in the database.

Otherwise, check that case is correct in all cases; so assuming that you added a field called `ean` with a dbmod.php script as follows;

<?php
  
require("includes/common.php");
  
$sql "ALTER TABLE `".$config_databaseTablePrefix."feeds`
            ADD `field_ean` VARCHAR(255) NOT NULL default ''"
;
  
database_queryModify($sql,$result);
  
$sql "ALTER TABLE `".$config_databaseTablePrefix."products`
            ADD `ean` VARCHAR(255) NOT NULL default ''"
;
  
database_queryModify($sql,$result);
  print 
"Done.";
?>

This would correspond with the following new line in config.advanced.php:

  $config_uidField = "ean";

...and the following added to the $config_fieldSet array:

   $config_fieldSet["ean"] = "EAN";

With that all in place the `ean` field being imported the mapping script (which you should set up to run after the cronjob) should then work as expected.

Cheers,
David.
--
PriceTapestry.com

Submitted by Tobix on Tue, 2022-02-22 21:11

Hi Davide,
i noticed that everything is ok.

the only one could be the cron:

cd /home/ogjnignp/public_html/scripts;/usr/bin/php cron.php;/usr/bin/php uidmap.php

Submitted by support on Wed, 2022-02-23 08:48

Hi Tobix,

I would suggest adding code to html/prices.php to temporarily show the EAN in the price comparison table so that you can double check the values appear identical but not causing the products to be grouped by uidmap.php. To do this look for the following code around line 57:

            <td class='hide-for-small-only'><?php print $product["original_name"]; ?></td>

...and REPLACE with:

            <td class='hide-for-small-only'>
            <?php print $product["original_name"]; ?>
            [<?php print $product["ean"]; ?>]
            </td>

You will then see the EAN after the product name in square brackets e.g.

Blue Widget [1234567890]

If you like it could also be added after the description in html/searchresults.php so where you have beginning at around line 47:

          <?php if ($product["description"]): ?>
            <p><?php print tapestry_substr($product["description"],250,"..."); ?></p>
          <?php endif; ?>

...REPLACE with:

          <?php if ($product["description"]): ?>
            <p><?php print tapestry_substr($product["description"],250,"..."); ?></p>
          <?php endif; ?>
          [<?php print $product["ean"]; ?>]

That way you'll be able to search for a product that you know is across multiple merchants and see how the EAN numbers compare on the search results page. After this if you are seeing identical numbers but they are not being mapped let me know and I'll check it out further with you...

Cheers,
David.
--
PriceTapestry.com

Submitted by Tobix on Wed, 2022-02-23 16:04

Ciao David.
OK done. I see identical numbers but not mapped (Some merchants have no ean code but they are very few) I will contact them to send them but if you notice this product for example 2 version are not grouped together.

{link saved}

Submitted by support on Thu, 2022-02-24 09:24

Hi Tobix,

That would point then to an issue with the database - perhaps the `uidfix` table has not been created successfully. What I would suggest, if you edit scripts/uiddbmod.php and where you have the following code at line 8:

  require("../includes/common.php");

...REPLACE with:

  require("../includes/common.php");
  $config_databaseDebugMode = TRUE;

Then run the script again and check whether any error messages are displayed (if it ran successfully previously you will see an error when adding the new index to the products table as it will already exist so that's OK...

Assuming nothing otherwise; look in your database to confirm the new table exists as expected; and as uidmap.php generates output you could try running it from a terminal window if you have ssh access to your server e.g.

cd path/to/scripts
php uidmap.php

Cheers,
David.
--
PriceTapestry.com

Submitted by Tobix on Thu, 2022-02-24 14:34

Hi Davide,
no error when restarting the scripts, He tells me "On the database I see everything ok ...
Working ...
Done.

Now I'm restarting the product cron let's see what happens ...

Submitted by support on Thu, 2022-02-24 14:56

Hi Tobix,

If the output goes straight from "Working..." to "Done." this means that the initial query either failed or returned no products, line 24 in scripts/uidmap.php:

  $sql1 = "SELECT DISTINCT(".$config_uidField.") FROM `".$config_databaseTablePrefix."products`";

...so I think this points to $config_uidField in config.advanced.php being incorrect; it should be (based on the above) as follows:

  $config_uidField = "ean";

Cheers,
David.
--
PriceTapestry.com

Submitted by Tobix on Thu, 2022-02-24 15:17

It already fits and I put it at the bottom of the page ...
So if I start the script
{link saved} I start all the products and start the process which lasts a few minutes.
If I do the script {link saved}
it ends immediately with Work ... done.
For the moment, all the contents of the table are deleted.

Submitted by support on Fri, 2022-02-25 08:49

Hi Tobix,

Please could you copy your config.advanced.php (after removing your admin password) and the dbmod.php script that you ran to add the new `ean` field to your database (I'll remove both before publishing your reply) and I'll check it out further with you...

Thanks,
David.
--
PriceTapestry.com

Submitted by Tobix on Fri, 2022-02-25 15:30

{code saved}

Submitted by support on Sat, 2022-02-26 08:59

Thanks Tobix,

That all looks OK, I am wondering if it might be a MySQL mode issue. In scripts/uidmap.php look for the following code beginning at line 12:

  $link1 = mysqli_connect($config_databaseServer,$config_databaseUsername,$config_databasePassword,$config_databaseName);
  mysqli_set_charset($link1,"utf8");
  $link2 = mysqli_connect($config_databaseServer,$config_databaseUsername,$config_databasePassword,$config_databaseName);
  mysqli_set_charset($link2,"utf8");

...and REPLACE with:

  $link1 = mysqli_connect($config_databaseServer,$config_databaseUsername,$config_databasePassword,$config_databaseName);
  mysqli_set_charset($link1,"utf8");
  mysqli_query($link1,"SET SESSION sql_mode=''");
  $link2 = mysqli_connect($config_databaseServer,$config_databaseUsername,$config_databasePassword,$config_databaseName);
  mysqli_set_charset($link2,"utf8");
  mysqli_query($link2,"SET SESSION sql_mode=''");

Cheers,
David.
--
PriceTapestry.com

Submitted by Tobix on Mon, 2022-02-28 17:02

Hi David
No work! :(

Submitted by support on Wed, 2022-03-02 08:34

Hi Tobix,

Please could you try the following test script as scripts/uidtest.php

<?php
  header
("Content-Type: text/plain;charset=utf-8");
  require(
"../includes/common.php");
  
$sql "TRUNCATE `".$config_databaseTablePrefix."uidfix`";
  
database_queryModify($sql,$result);
  
$sql "INSERT INTO `".$config_databaseTablePrefix."uidfix` SET uid='1234',name='Blue Widget'";
  
database_queryModify($sql,$result);
  
$sql "SELECT * FROM `".$config_databaseTablePrefix."uidfix`";
  
database_querySelect($sql,$rows);
  
print_r($rows);
?>

Then browse to the script do you see as follows;

Array
(
    [0] => Array
        (
            [id] => 1
            [uid] => 1234
            [name] => Blue Widget
        )
)

Cheers,
David.
--
PriceTapestry.com

Submitted by Tobix on Wed, 2022-03-02 18:06

Hi David...
I see this:

Array
(
[0] => Array
(
[id] => 1
[uid] => 1234
[name] => Blue Widget
)

)

I'm going crazy believe me!

Submitted by support on Wed, 2022-03-02 18:23

You don't have overlapping cronjobs running do you? e.g. cron.php + uidmap.php takes longer than 1 hour (for some large sites it does) but the cronjob is scheduled for every hour - that can cause problems..!

(what I recommend for most sites is for the cronjob to be scheduled daily and early morning e.g. 5AM-6AM that way, you pick up overnight price changes applied by merchants and reflected in the feeds after their own nightly update processes...)

Cheers,
David.
--
PriceTapestry.com

Submitted by Tobix on Thu, 2022-03-03 15:39

Hi, David,
I only have 2 Cron ...
Which depart at night around 4.

Submitted by support on Fri, 2022-03-04 08:21

Hi Tobix,

You can capture the output from uidmap.php during the cronjob by redirecting the output to a file like this:

cd /home/ogjnignp/public_html/scripts;/usr/bin/php cron.php;/usr/bin/php uidmap.php > ../feeds/uidmaplog.txt

With that in place; wait until your next cronjob has completed and fetch uidmaplog.txt from your feeds folder. Do you see the phases working and product names being displayed, or do you just see:

Working...
Done.

Thanks,
David.
--
PriceTapestry.com

Submitted by Tobix on Fri, 2022-03-04 16:06

Hi Davide
I copied the cron
cd /home/ogjnignp/public_html/scripts;/usr/bin/php cron.php;/usr/bin/php uidmap.php > ../feeds/uidmaplog.txt

I started it but it didn't release any log files .

Will I have something wrong?

Submitted by Tobix on Fri, 2022-03-04 21:17

Here he appeared.
There is a long list of products and then done.

Submitted by support on Sat, 2022-03-05 09:05

Hi Tobix,

That implies it should be working! Specifically in that output (towards the end), do you see any lines beginning with Phase 2: e.g.

Phase 2:Blue Widget

Phase 2 is where the product names are being updated in the database to match; so if you are seeing that but it is not being applied that might indicate a MySQL connection issue which we can look into...

Cheers,
David.
--
PriceTapestry.com

Submitted by Tobix on Mon, 2022-03-07 15:22

Hi, David,
Let me know how we can proceed ...

Submitted by support on Mon, 2022-03-07 15:40

Hi Tobix,

Please can you confirm if you are seeing those "Phase 2:..." lines in the log output; that will indicate to me which part of uidmap.php to investigate for you...

Thanks,
David.
--
PriceTapestry.com

Submitted by Tobix on Tue, 2022-03-08 20:30

Hi David,
Phase 2 does not exist on the txt file.
I email it to you so you can analyze it too. Soon,
Tobias

Submitted by Tobix on Fri, 2022-03-11 14:54

Hi David,
We have undoubtedly helped with editing the umap file.
But I still don't understand why some products are grouped like this
{link saved}

and others not ...
{link saved}

Thanks,
Tobix

Submitted by support on Sat, 2022-03-12 10:25

Hi Tobix,

With the modified version are you now seeing Phase 2:Product Name... entries in the uidmaplog.txt file?

Cheers,
David.
--
PriceTapestry.com

Submitted by Tobix on Sun, 2022-03-13 18:12

Hi Divid,
Yes!

Submitted by support on Mon, 2022-03-14 10:19

Hi Tobix,

From the previous links showing products not being grouped have the same EAN, for example the HD9350/90 Kettle, do you see that product in Phase 1 but not Phase 2, or neither of them?

Thanks,
David.
--
PriceTapestry.com