Hi David!
Question. I want to group products automatically based on ISBN numbers (I have a book comparison website). Is there any mod out here that does anything similar like this?
Thanks for your great support and lots of patience.
Regards,
Johan Struijk
O wow, that saves me a HUGE amount of time trying to group all those books. Thumbs up David, way to go! :))
Hi, David,
I noticed that changing GROUP by name to GROUP by isbn creates a problem with product mapping. When I manually create a new product mapping and add several books to it, it groups them on the product page fine, displaying prices from different stores, but not on the search result page, where I still see each book listed separately, and not grouped under one. I've checked the code, and it's that specific change from "name" to "isbn" that creates this problem. Is there a way to fix that? Thank you.
Lana
Hi Johan,
No problem - the first step if you haven't done so already is to add isbn as a field to your site so that you can register the field for it and import it. To do this, following the instructions in the following thread:
http://www.pricetapestry.com/node/3094
With isbn in place (so you will have added `field_isbn` to your feeds table and `isbn` to your products table), you can now modify search to GROUP BY isbn in place of name. To do this, simply Search and Replace within search.php, Searching for:
GROUP BY name
...and REPLACE with:
GROUP BY isbn
Finally, products.php needs to be modified in the same way as the SKU mod to query first by product name, and then requery by ISBN. To do this, look for the following code beginning at around line 12:
$sql = "SELECT * FROM `".$config_databaseTablePrefix."products` WHERE normalised_name = '".database_safe($q)."' ORDER BY price";
$numRows = database_querySelect($sql,$rows);
...and REPLACE that with:
$sql = "SELECT isbn FROM `".$config_databaseTablePrefix."products` WHERE normalised_name = '".database_safe($q)."' LIMIT 1";
database_querySelect($sql,$rows);
$sql = "SELECT * FROM `".$config_databaseTablePrefix."products` WHERE isbn = '".database_safe($rows[0]["isbn"])."' ORDER BY price";
$numRows = database_querySelect($sql,$rows);
Cheers,
David.
--
PriceTapestry.com