Hi David,
I have added an extra field (very easy thanx to the config.advanced) in my database and in the feed registration. I had a look at: http://www.pricetapestry.com/node/775
to see how i can group products based on the ean code as well on the product name. But the code in products.php seems to be rewritten and i cant figure it out. Can you help me?
regards,
B.
hi david
just trying the ean code - works great
some feeds have an issue that there are several product entries with the same ean code - not sure why, culprit happens tobe dixons, currys etc, is there a way to delete ean products that occur more than once in the same feed so that none of the duplicates are imported as this is better than wrong price comparison results
regards
Phil Stone
www.buy24-7.net
Hi Phil,
Sure, you could conditionally construct dupe_hash based on the ean field (if one exists). In includes/admin.php (latest distribution); look for the following code on line 297:
$dupe_key .= $normalisedName;
...and REPLACE with:
if ($importRecord["ean"])
{
$dupe_key .= $importRecord["ean"];
}
else
{
$dupe_key .= $normalisedName;
}
Cheers,
David.
thanks david, works perfect,
was wondering as well, for products that have an empty ean field, is there a way that they will not be dragged into a comparison product page with other products with empty ean's?
regards
Phil Stone
www.buy24-7.net
Hi Phil,
That shouldn't be happening - the code above (in products.php) looks for an EAN and only uses it for comparison if one is found. The above code is based on "sku" rather than "ean", so double check that you have replaced every occurrence correctly. If you're still not sure, if you could email me your products.php i'll check it out for you...
Cheers,
David.
hi David
was wondering is there a mod can be made to this products.php to allow products without a matching ean number but that compare under a different product name appear on the comparison table?
eg
at the minute if you go to AEG HC3360M there are 8 products compared, but only 7 compared when someone goes to AEG Chimney Hood HC3360M Stainless Steel
regards
Phil Stone
www.buy24-7.net
Hi Phil,
Can you email me the latest products.php and I'll check what's going on there...
Cheers,
David.
hi david
just getting this implemented in the new script
i get this error when i upload the code above:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/buy247/public_html/includes/database.php on line 27
Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/buy247/public_html/includes/database.php on line 32
Warning: Cannot modify header information - headers already sent by (output started at /home/buy247/public_html/includes/database.php:27) in /home/buy247/public_html/products.php on line 92
Warning: Cannot modify header information - headers already sent by (output started at /home/buy247/public_html/includes/database.php:27) in /home/buy247/public_html/products.php on line 93
the lines in products.php are
line 92: header("HTTP/1.1 301 Moved Permanently");
line 93: header("Location: ".$config_baseHREF.tapestry_hyphenate($rows[0]["name"]).".html");
could you please advise me on what i am doing wrong,
thanks
philip
Hi Phil,
As it's a database error, my guess is that the ean field has not yet been added to the products table - instructions and dbmod.php for the latest version are in this thread.
If that all looks OK, enable database debug mode by changing line 6 of config.advanced.php as follows:
$config_databaseDebugMode = TRUE;
...then browse to the page again and let me know what error message is displayed as that should indicate the problem...
Cheers,
David.
--
PriceTapestry.com
I have a problem with the compare prices on ean, it shows not the lowest prices on searchresult and related products. Is it easy to change that?
ALECTO DBX82
{link saved}
{link saved}
Thx
Henk
Hello Henk,
The easiest work around for this would be to re-query for lowest price by ean or name at the top of html/searchresults.php - have a go with:
<?php
foreach($searchresults["products"] as $k => $p)
{
if ($p["ean"])
{
$sql = "SELECT price FROM `".$config_databaseTablePrefix."products` WHERE ean='".datbase_safe($p["ean"])."' OR normalised_name = '".database_safe($p["normalised_name"])."' ORDER BY price LIMIT 1";
database_querySelect($sql,$result);
$searchresults["products"][$k]["price"] = $result[0]["price"];
$searchresults["products"][$k]["minPrice"] = $result[0]["minPrice"];
}
}
?>
Cheers,
David.
--
PriceTapestry.com
Hi,
The replacement code for the latest distribution, in products.php, look for the following code starting at line 12:
$sql = "SELECT * FROM `".$config_databaseTablePrefix."products` WHERE normalised_name = '".database_safe($q)."' ORDER BY price";
$numRows = database_querySelect($sql,$rows);
...and REPLACE with:
$sql = "SELECT * FROM `".$config_databaseTablePrefix."products` WHERE normalised_name = '".database_safe($q)."' ORDER BY price";
$numRows = database_querySelect($sql,$rows);
$sku = "";
foreach($rows as $row)
{
if ($row["sku"])
{
$sku = $row["sku"];
break;
}
}
if ($sku)
{
$sql = "SELECT * FROM `".$config_databaseTablePrefix."products` WHERE normalised_name = '".database_safe($q)."' OR sku='".database_safe($sku)."' ORDER BY price";
$numRows = database_querySelect($sql,$rows);
}
(of course if you've used ean instead of sku as the new field just replace as appropriate)
Hope this helps!
Cheers,
David.