Sure - the most important consideration is that an index is added to the "ean" field so that the database can implement the OR clause in the SELECT SQL without needing a full table scan.
Assuming that you have added "ean" as a custom field, firstly create the following dbmod.php and run once from the top level folder of your Price Tapestry installation to create the index:
<?php require("includes/common.php"); $sql = "CREATE INDEX ean ON `".$config_databaseTablePrefix."products` (ean)"; database_queryModify($sql,$result); print "Done."; ?>
With that in place, edit the plugin file pto_product.php and look for the following code at line 17:
$sql = "SELECT * FROM `".$pto_config_databaseTablePrefix."products` WHERE normalised_name = '".$wpdb->escape($pto_product)."' ORDER BY price";
...and REPLACE with:
$sql = "SELECT * FROM `".$pto_config_databaseTablePrefix."products` WHERE normalised_name = '".$wpdb->escape($pto_product)."' OR ean = '".$wpdb->escape($pto_product)."' ORDER BY price";
You will then be able to use an EAN value in the products / prices shortcodes in place of a product name...
Hi,
Sure - the most important consideration is that an index is added to the "ean" field so that the database can implement the OR clause in the SELECT SQL without needing a full table scan.
Assuming that you have added "ean" as a custom field, firstly create the following dbmod.php and run once from the top level folder of your Price Tapestry installation to create the index:
<?php
require("includes/common.php");
$sql = "CREATE INDEX ean ON `".$config_databaseTablePrefix."products` (ean)";
database_queryModify($sql,$result);
print "Done.";
?>
With that in place, edit the plugin file pto_product.php and look for the following code at line 17:
$sql = "SELECT * FROM `".$pto_config_databaseTablePrefix."products` WHERE normalised_name = '".$wpdb->escape($pto_product)."' ORDER BY price";
...and REPLACE with:
$sql = "SELECT * FROM `".$pto_config_databaseTablePrefix."products` WHERE normalised_name = '".$wpdb->escape($pto_product)."' OR ean = '".$wpdb->escape($pto_product)."' ORDER BY price";
You will then be able to use an EAN value in the products / prices shortcodes in place of a product name...
Cheers,
David.
--
PriceTapestry.com