Hi david
I have been mapping products to make the price comparison working, but from the result i'm getting it looks like the script only list 1 product from 1 merchant in the pricecomparison.
I have products that could look like this:
Merhant 1:
Scott Scale 10 - 2010
Scott Scale 10 - 2011
Merchant 2:
Scott - Scale 10 - Red
Scott - Scale 10 - Black
The mapping for this could look like this:
Name: Scott Scale 10
Filter: Scale 10
The result on the product 'Scott Scale 10' looks like this:
Merchant 1 - Scott Scale 10 - 2010
Merchant 2 - Scott - Scale 10 - Black
The other 2 products (Scott Scale 10 - 2011 and Scott - Scale 10 - Red) is no longer listed, not even if i search for 'Scale 10'.
How do I list all the products under the price comparison?
Thx
//Brian
Hi David
Yes i like to list all product matching mapping - including diff. colour or year - into one product mapping.
This will limit how many product mappings i need to make and also show 'sales' offers ie. sales on 2010 model together with 2011 models.
//Brian
Hi Brian,
Have a go removing the duplicate check - in your includes/admin.php look for the following code beginning at around line 300:
/* create dupe_hash value */
$dupe_key = $merchant;
$dupe_key .= $normalisedName;
$dupe_hash = md5($dupe_key);
...and REPLACE that with:
/* create dupe_hash value */
global $dupe_key;
$dupe_key++;
$dupe_hash = md5($dupe_key);
Re-import all affected feeds; and the duplicates should then be imported, but with the original, non-mapped names showing in the price comparison table so that the user will be able to see the model / colour options...
Cheers,
David.
--
PriceTapestry.com
Hi David
Thank you for helping me put once again...
The code above drops almost all products except for the first feed imported?
Second... i don't understand why you say this:
"...but with the original, non-mapped names showing in the price comparison table .."
because right now the name in the comparison table is the non-mapped names - like the sample below:
Product name: Cannondale F1
Butik Produkt Pris
webike Cannondale F1 Magnesium White kr. 15990,00 Til Butik
heino Cannondale – F1 – Mountainbike 2011 kr. 15990,00 Til Butik
product mapping for the product above:
map name: Cannondale F1
alternative names:
Cannondale F1
Cannondale - F1
thx
//Brian
Sorry Brian - the replacement code should be:
/* create dupe_hash value */
global $dupe_key;
$dupe_key++;
$dupe_hash = md5($merchant.$dupe_key);
Cheers,
David.
--
PriceTapestry.com
Hi David
Something is still wrong...
The first feed is imported correctly, but almost all feeds afterwards is dropped?
Thx
//Brian
Hi Brian,
Is that when running an import.php @ALL?
Cheers,
David.
--
PriceTapestry.com
Hi david
No, this is when I manual import feed by feed using import link in the admin section.
//Brian
Hi Brian,
Could you email me your modified includes/admin.php and I'll check it out for you...
Cheers,
David.
--
PriceTapestry.com
Hello David,
i have the same problem. I changed:
/* create dupe_hash value */
global $dupe_key;
$dupe_key++;
$dupe_hash = md5($merchant.$dupe_key);
to
/* create dupe_hash value */
$dupe_key = $merchant;
$dupe_key .= $normalisedName;
$dupe_hash = md5($dupe_key);
Then I could import three XML-Feeds from Zanox.com. But the next feeds doesn't work (I try 3-5 feeds). The import just drop the publish process and there are 0 products from the new feed. I hope you have a solution ;-)
Hi Aslex,
Have a go with this as the replacement:
/* create dupe_hash value */
$dupe_key = $merchant;
$dupe_key .= $importRecord["original_name"];
$dupe_hash = md5($dupe_key);
Dupe filtering on the original name means that product mapping won't affect it and all a merchant's unique original names will be imported...
Cheers,
David.
--
PriceTapestry.com
Hmm this time the import stars, but every merchant has online one variation of one product. I need to compare mobile phone contracts and so I need different variation of the products...
Hi Aslex,
An alternative which might give you a better starting point would be to drop the unique index on the dupe_hash field. Have a go running the following dbmod.php script from your main Price Tapestry installation folder:
<?php
require("includes/common.php");
$sql = "DROP INDEX dupe_filter ON `".$config_databaseTablePrefix."products`";
database_queryModify($sql,$result);
print "Done.";
?>
After running the query, re-import and there shouldn't be any duplicate removal at all...
Cheers,
David.
--
PriceTapestry.com
Doesn't work... I included:
/* create dupe_hash value */
global $dupe_key;
$dupe_key++;
$dupe_hash = md5($merchant.$dupe_key);
and run the dbmod.php with this:
<?php
require("includes/common.php");
$sql = "DROP INDEX dupe_filter ON `".$config_databaseTablePrefix."products`";
database_queryModify($sql,$result);
print "Done.";
?>
The old XML-Feeds/Merchants now include just one product/contract for every mobilephone. The new XML-Feed can be included but with the same problem. The variations are not there ;-)
Hi Alex,
You just caught me - quick question did you re-import all feeds after dropping the index? It sounds like the UNIQUE index is still in place...
One option to try if it's not too much trouble would be to drop your database, and then before running setup.php again, look for the following code at line 93:
FULLTEXT KEY name_2 (name),
UNIQUE KEY dupe_filter (dupe_hash)
...and REPLACE with:
FULLTEXT KEY name_2 (name)
(make sure to remove the command from the end of the remaining line)
Then run setup.php again and import the feed - there should be no duplicate checking at all taking place, and the code to derive $dupe_hash wouldn't actually be required...
Hope this helps!
Cheers,
David.
Cheers,
David.
--
PriceTapestry.com
I dropped the table and start again - it's working.
Nice thanks David!
Hi David,
I've added this modification and have all the product variations showing for each merchant. Is there a way to group together all the products from a merchant regardless of price?
I would like the lowest price showing first, but if the merchant with the lowest price has additional products at a higher price, I would like them to show in a group.
Example:
Merchant 1 / Product 1 / $1.00
Merchant 1 / Product 1 / $5.00
Merchant 2 / Product 1 / $2.00
Merchant 3 / Product 1 / $3.00
Merchant 3 / Product 1 / $7.00
Merchant 4 / Product 1 / $5.00
Merchant 5 / Product 1 / $6.00
Basically it sorts the merchants by lowest price, then sorts the products within each merchant by price. Is that possible?
Thanks,
Erik
Hi Eric,
Sure - in your products.php, search for the following code around line 60:
$product["products"] = $rows;
...and REPLACE with:
function cmp2($a, $b)
{
return strcmp($a["merchant"],$b["merchant"]);
}
usort($rows,"cmp2");
$product["products"] = $rows;
Cheers,
David.
--
PriceTapestry.com
That's grouping nicely, but within each merchant group the highest price is showing first. That's also causing the merchant group as a whole to be sorted lower than it should.
Hi,
Ah - I understand - have a go with the following as an alternative replacement:
$rowsByMerchant = array();
foreach($rows as $row)
{
$rowsByMerchant[$row["merchant"]][] = $row;
}
$rows = array();
foreach($rowsByMerchant as $k => $v)
{
$rows = array_merge($rows,$v);
}
$product["products"] = $rows;
So merchants will be all be grouped, individually in price order, and overall in order of cheapest price per merchant...
Cheers,
David.
--
PriceTapestry.com
When I added that, all the product pages disappeared entirely.
The previous code worked except that it reversed the sort order within each merchant and that reverse sorting messed up the group order as a whole.
Instead of...
Merchant 1 / Product 1 / $1.00
Merchant 1 / Product 1 / $5.00
Merchant 2 / Product 1 / $2.00
Merchant 3 / Product 1 / $3.00
Merchant 3 / Product 1 / $7.00
Merchant 4 / Product 1 / $5.00
Merchant 5 / Product 1 / $6.00
It ranked Merchant 1 and 3 according to the highest priced product...
Merchant 2 / Product 1 / $2.00
Merchant 4 / Product 1 / $5.00
Merchant 1 / Product 1 / $5.00
Merchant 1 / Product 1 / $1.00
Merchant 5 / Product 1 / $6.00
Merchant 3 / Product 1 / $7.00
Merchant 3 / Product 1 / $3.00
Sorry about that - i'd missed off the last line of the replacement (the original line that sets $product["products"] = $rows;
- corrected above, and should do the trick...
Cheers,
David.
--
PriceTapestry.com
That works great, thanks.
Now that the products are grouped, is there a way to make the merchant name/logo only show up for the first product in the group? Something like...
Merchant 1
Product 1 / $1.00
Product 1 / $5.00
Merchant 2
Product 1 / $2.00
Merchant 3
Product 1 / $3.00
Product 1 / $7.00
Merchant 4
Product 1 / $5.00
Merchant 5
Product 1 / $6.00
Hi,
Sure - it can all be done in html/prices.php which you may have modified already, but start with something like this to give you the basic structure:
<div class='prices'>
<?php $pricesMerchant = ""; ?>
<?php function pricesHeader() {
global $pricesMerchant;
?>
<a href='<?php print $pricesMerchant; ?>'><?php print (file_exists("logos/".$pricesMerchant)?"<img src='".$config_baseHREF."logos/".$pricesMerchant."' border='0' />":$pricesMerchant); ?></a>
<table width='100%' cellpadding='4'>
<tr bgcolor='#eeeeee'>
<th align='left'><?php print translate("Catalogue Product Name"); ?></th>
<th align='left'><?php print translate("Price"); ?></th>
<th align='left'> </th>
</tr>
<?php } ?>;
<?php function pricesFooter() { ?>
</table>
<?php } ?>;
<?php foreach($prices["products"] as $product): ?>
<?php
if ($pricesMerchant != $product["merchant"])
{
if ($pricesMerchant) pricesFooter();
$pricesMerchant = $product["merchant"];
pricesHeader();
}
?>
<tr bgcolor='#ffffcc'>
<td><?php print $product["original_name"]; ?></td>
<td><strong><?php print $config_currencyHTML.$product["price"]; ?></strong>
<?php if ($product["voucher_code"]) print "<br /><small><nobr>".translate("using voucher code")." <strong>".$product["voucher_code"]."</strong></nobr></small>"; ?>
</td>
<td align='center'><nobr><a href='<?php print tapestry_buyURL($product); ?>' <?php print javascript_statusBar("go to ".$product["merchant"]); ?>><?php print translate("Visit Store"); ?></a></nobr></td>
</tr>
<?php endforeach; ?>
<?php pricesFooter(); ?>
</div>
The 2 functions pricesHeader() and pricesFooter() contain each merchant's links, with the merchant name or logo displayed outside of the price comparison table. May need so visual adjustment but should be close...
Cheers!
David.
--
PriceTapestry.com
One minor adjustment...
if ($pricesMerchant) $pricesFooter();
was changed to...
if ($pricesMerchant) pricesFooter();
After that, testing worked great. I think it will look exactly how I want it to once I get it integrated with my page.
Thanks!
No worries!
Typo corrected above..
Cheers,
David.
--
PriceTapestry.com
The second mapped result to the same product name for the same merchant will be dropped during import due to the duplication prevention - the name you're seeing in the prices table will be the "original_name" field that holds the original unmapped name. Ideally as they are strictly speaking different products (by year or colour) they would be compared on their own page, but is my understanding that you would like to show all variations on the same product page in the price comparison table?
Cheers,
David.
--
PriceTapestry.com