Hi David,
How can i make a shortcode for sku?
[pto product="sku:123456" prices="sku:123456"]
Thx
Henk
Hi David,
Sorry it doesn't show by sku only still by name when i try [pto product="sku:4008146387401"]
Thx
Henk
Hello Henk,
Ah - that's because ":" is removed by the normalisation; to allow this, perform a Search and Replace in pto.php of
$pto_product = pto_common_normalise($v);
with:
$pto_product = pto_common_normalise($v,":");
(4 instances)
You will then have support for sku:n for product, prices, reviews and search short codes.
Cheers,
David.
--
PriceTapestry.com
Hello Henk,
In your modified pto_product.php, look for the following code beginning at line 282:
$sql = "SELECT * FROM `".$pto_config_databaseTablePrefix."products` WHERE normalised_name = '".$wpdb->escape($pto_product)."' LIMIT 1";
if ($numRows = $wpdb->query($sql))
...and REPLACE with:
$sql = "SELECT * FROM `".$pto_config_databaseTablePrefix."products` WHERE normalised_name = '".$wpdb->escape($pto_product)."' LIMIT 1";
$parts = explode(":",$pto_product);
if ($parts[0]=="sku")
{
$sql = "SELECT * FROM `".$pto_config_databaseTablePrefix."products` WHERE sku = '".$wpdb->escape($parts[1])."' ORDER BY price";
$numRows = $wpdb->query($sql);
$product = $wpdb->last_result[0];
}
elseif ($numRows = $wpdb->query($sql))
Cheers,
David.
--
PriceTapestry.com