I like using the shop by brand page however mine already has over 2000 different brands from just 10 merchants.
I'd like to implement a filter that will only display a brand name on the brands.php page if it is available from at least TWO different merchants. Showing brands that don't have multiple merchants defeats the "price comparison" idea. I know that not all products within the brand might be offered by all merchants who promote it but this would be a big help in reducing the number of no comparison possible items. Actually it would make it much simpler to find product matches too. If you can point me in the right direction in removing any brand that isn't available by TWO or more merchants it would be much appreciated.
Regards
Gem
Not really, no, because some products are unique to one merchant.
I was thinking of something more along the lines of "for a brand name to show up on my brand list page it has to be available by more than one merchant". I know some items within the brands would be orphans and that's fine but a "true comparison" at the brand level would be a big help. I don't want to remove any products/brands from the site but I would like to reduce the number of links to brands that are only sold by one merchant (ie: which happen to be the less popular brands in my case).
I started to use the "drop" feature on these brands but realized I didn't want to drop them or their products, I just don't want to link to "solo merchant" brands from the brands page (it's 2000+ brands in size right now).
Is that more clear? By removing brands that only have one merchant I'll have an easier time of product matching too, I won't waste my time on brands that will have no other match (because they aren't on my brands list).
Actually, a process to purge all database entries in which a brand (not product) is only available by one merchant might be useful. The items available under those brands would not be linked to from anywhere on my site anyway and this would help speed up queries.
Sorry for the triple post, I'm making it harder than it needs to be I think.
A process to remove BRANDS that are only available by one merchant would be perfect.
Hi Gem,
That should be workable - have a go with the following script, designed to run from /scripts/ so that you can automate it in the same way as import.php etc.; but to test in the first instance just browse to /scripts/brandpurge.php
scripts/brandpurge.php:
<?php
set_time_limit(0);
require("../includes/common.php");
header("Content-Type: text/plain");
$sql = "SELECT DISTINCT(brand) as brand FROM `".$config_databaseTablePrefix."products` ORDER BY brand";
if (database_querySelect($sql,$products))
{
foreach($products as $product)
{
$sql = "SELECT DISTINCT(merchant) FROM `".$config_databaseTablePrefix."products` WHERE brand='".database_safe($product["brand"])."'";
$numMerchants = database_querySelect($sql,$rows);
if ($numMerchants == 1)
{
$sql = "UPDATE `".$config_databaseTablePrefix."products` SET brand='' WHERE brand='".database_safe($product["brand"])."'";
database_queryModify($sql,$result);
}
}
}
print "Done.";
?>
Hope this helps!
Cheers,
David.
Worked perfectly. By setting the product brand value to "" for brands with only one merchant none of the individual products were removed entirely correct? They still return in a normal search this way, which is exactly what I wanted.
When I import a feed again will the brand value be entered again? (not a bad thing if it is, the updated feeds may yield more 2+ merchant brands.
Thanks David
Correct on both counts - nothing is deleted; but after the next import it would be "as you were" until brandpurge.php is run again...
Cheers,
David.
That made quick work of a massive brands list, down to 1400 from 2000+ and setting up product match is indeed easier.
To take it a step further, I'd like to remove brands from the remaining brand list that have less than 12 products in them. I'm finding several affiliate programs that give one off and signature pieces their own separate brand listing (ie: widgets vs special widgets, etc). Since most if not all of these have identical descriptions/images (lazy on their end) I don't need the duplicate brand listings.
I could set this up with a long list of filters but a 2nd script to run after the one mentioned above would be a godsend.
No hurry, you've already gone above and beyond in supporting my site.
Hi Gem,
That's easy enough - here's the above script modified to remove brands with less than 12 products in addition to the previous requirement....
<?php
set_time_limit(0);
require("../includes/common.php");
header("Content-Type: text/plain");
$sql = "SELECT DISTINCT(brand) as brand FROM `".$config_databaseTablePrefix."products` ORDER BY brand";
if (database_querySelect($sql,$products))
{
foreach($products as $product)
{
$sql = "SELECT DISTINCT(merchant) FROM `".$config_databaseTablePrefix."products` WHERE brand='".database_safe($product["brand"])."'";
$numMerchants = database_querySelect($sql,$rows);
if ($numMerchants == 1)
{
$sql = "UPDATE `".$config_databaseTablePrefix."products` SET brand='' WHERE brand='".database_safe($product["brand"])."'";
database_queryModify($sql,$result);
}
$sql = "SELECT DISTINCT(name) FROM `".$config_databaseTablePrefix."products` WHERE brand='".database_safe($product["brand"])."'";
$numProducts = database_querySelect($sql,$rows);
if ($numProducts < 12)
{
$sql = "UPDATE `".$config_databaseTablePrefix."products` SET brand='' WHERE brand='".database_safe($product["brand"])."'";
database_queryModify($sql,$result);
}
}
}
print "Done.";
?>
Cheers,
David.
Hi Gem,
Is true comparison (i.e. only showing products available from more than 1 merchant) something you're trying to establish across your site - in which case (once Product Mapping options have been exhausted of course) how about running a process after import to remove any products only available from one merchant?
Cheers,
David.