Hello,
How would I set a certain merchant to be the first priority to list a product and if another store has the same product in the data feed it would be dropped as the main merchant has the item already.
Is there a way to do that?
So lets say merchant Jane doe has deer spraying 101 book and I upload another datafeed for the competitor store john doe has the same exact book with the exact title would not be added as Jane Doe store has priority over all the others.
Is that possible?
Is it possible to have priority 1,2,3,4,5 in the merchants. Some of the reasons could be better inventory/conversions on the higher ones, higher commissions % listed in order.
Thank you,
Michael
Can I also set that each merchant would only show the product once?
Hi Mike,
It's a simple change.. use something like:
if (!$importRecord["merchant"]) return;
$preferredMerchants = array("Merchant 1","Merchant 2","Merchant 3");
foreach($preferredMerchants as $preferredMerchant)
{
if ($importRecord["merchant"] == $preferredMerchant) break;
$sql = "SELECT id FROM `".$config_databaseTablePrefix."products` WHERE name='".database_safe($importRecord["name"])."' AND merchant <> '".database_safe($preferredMerchant)."'";
if (database_querySelect($sql,$result))
{
$sql = "DELETE FROM `".$config_databaseTablePrefix."products` WHERE id='".database_safe($result[0]["id"])."'";
database_queryModify($sql,$result);
break;
}
}
Duplicate prevention together with this should already be ensuring that a product only occurs once. As before edit the second line of the mod with the list of merchants in preferred order; and make sure to import in that order of course!
Cheers,
David.
--
PriceTapestry.com
Hi Mike,
It's easy to add the logic to do this within the import record handler function in includes/admin.php. In that file, look for the following code at around line 297:
if (!$importRecord["merchant"]) return;
...and REPLACE that with
if (!$importRecord["merchant"]) return;
$preferredMerchant = "Merchant Name"; // change this!!
if ($importRecord["merchant"] <> $preferredMerchant)
{
$sql = "SELECT id FROM `".$config_databaseTablePrefix."products` WHERE name='".database_safe($importRecord["name"])."' AND merchant <> '".database_safe($preferredMerchant)."'";
if (database_querySelect($sql,$result))
{
$sql = "DELETE FROM `".$config_databaseTablePrefix."products` WHERE id='".database_safe($result[0]["id"])."'";
database_queryModify($sql,$result);
}
}
For this to work, the preferred merchant must be imported first of course to ensure that it can be checked for each product during import of subsequent feeds...
Cheers,
David.
--
PriceTapestry.com