Hi,
I am trying "Product Mapping RegExp" for the first time and have a question.
For example I am wanting to map products together for the Samsung Galaxy S8 Mobile Phone.
Ideally to do this, I would like to search for products that contain all three words "samsung", "galaxy" & "s8" in the product title as well as being in the price range $400-$800. Having a price range gets rid of accessories for the phone.
Is it possible to include a price range in a regexp?
So far, I have:
Brand: /Samsung/i
RegExp: /(\b(Samsung).+(Galaxy).+(S8)\b)/Ui
Thanks David for the detailed reply. I was expecting a Yes or No - I forget that you provide such great support.
BTW: It would be amazing if the manual page for "Product Mapping by RegExp" could include more common RegExp examples that people use.
Hi,
Sure, a min / max price trigger can be added to Product Mapping by RegExp easily - first create and run the following dbmod.php script to add the new fields;
<?php
require("includes/common.php");
$sql = "ALTER TABLE `".$config_databaseTablePrefix."productsmap_regexp`
ADD trigger_min_price DECIMAL(10,2) NOT NULL DEFAULT '0.00',
ADD trigger_max_price DECIMAL(10,2) NOT NULL DEFAULT '0.00'
";
database_queryModify($sql,$result);
print "Done.";
?>
Edit admin/productsmap_regexp_configure.php and look for the following code at line 49:
`trigger_brand` = '".database_safe($_POST["trigger_brand"])."',
...and REPLACE with:
`trigger_brand` = '".database_safe($_POST["trigger_brand"])."',
`trigger_min_price` = '".database_safe($_POST["trigger_min_price"])."',
`trigger_max_price` = '".database_safe($_POST["trigger_max_price"])."',
And then the following code at line 147:
if ($apply)
...and REPLACE with:
if (($productmap["trigger_min_price"] > 0) && ($importRecord["price"] < $productmap["trigger_min_price"])) $apply = FALSE;
if (($productmap["trigger_max_price"] > 0) && ($importRecord["price"] > $productmap["trigger_max_price"])) $apply = FALSE;
if ($apply)
And then the following code at line 264:
widget_textBox("Brand","trigger_brand",FALSE,$productmap["trigger_brand"],"RegExp",12);
...and REPLACE with:
widget_textBox("Brand","trigger_brand",FALSE,$productmap["trigger_brand"],"RegExp",12);
widget_textBox("Min Price","trigger_min_price",FALSE,$productmap["trigger_min_price"],"",12);
widget_textBox("Max Price","trigger_max_price",FALSE,$productmap["trigger_max_price"],"",12);
Edit includes/admin.php and look for the following code at line 323:
$productmap["trigger_max_price"])) $apply = FALSE;
if ($apply)
...and REPLACE with:
if (($productmap["trigger_min_price"] > 0) && ($importRecord["price"] < $productmap["trigger_min_price"])) $apply = FALSE;
if (($productmap["trigger_max_price"] > 0) && ($importRecord["price"] > $productmap["trigger_max_price"])) $apply = FALSE;
if ($apply)
Hope this helps!
Cheers,
David.
--
PriceTapestry.com