Hi David,
As I have started to import multiple feeds, I have come across two issues that I could use your help with:
1) Duplicate product names/different products - I found that if two or more products have the same name in a feed, even though they have different product id's, image url's, buy url's, etc., only one product will be imported. I tested this by adjusting the file names to be unique and it fixed the issue but I hate to rename the merchants' products - is there another solution for this?
2) How does the price comparison work? Now that I have a few feeds in place, I have some duplication of products across multiple merchants but can't seem to figure out how to have both vendors displayed under a single product description. Is there some documentation on this somewhere that I just haven't found yet?
Thanks for your help,
Rich
Thanks David, I will try the Text After filter to deal with the duplication within a single feed.
Followup on the price comparison - if I do find a way to match up product names across merchants to use the price comparison, which description is chosen for the product information? The first? The longest? Any tips on controlling that would be great...
Also, how extensive a change would it be to manke the price comparison based on a UPC field instead of the product description? That should be common across merchants, provided you can get it from them.
Thanks,
Rich
Hi,
The description used on the product page is that of the cheapest product. Unfortunately, the description shown on the search results page is undefined because it depends upon how MySQL has built the index (this is complex, because it uses a GROUP BY clause).
Regarding comparison by a product code (UPC / SKU etc.), some users have modified Price Tapestry to do this. Firstly, you have to add the field to the system by extending the database, and modifying the import script to bring in the new field. To do this, follow the instructions in this thread:
http://www.pricetapestry.com/node/313
Then, you need to modify the search and product pages to use the new field:
http://www.pricetapestry.com/node/775
The above page contains instructions for modifying products.php and search.php, but because of the sideways scroll, the brief instructions for the latter are off to the right - so look out for them carefully!
Hope this helps!
Cheers,
David.
Thanks David!
Is there a specific place where you define the use of the cheapest product's description for the product page? I'd like to change it to be the longest description.
Rich
Hi,
The description is currently displayed by the following code (line 26) in html/product.php:
<p><?php print $mainProduct["description"]; ?></p>
At this point, the array of products (cheapest to most expensive) is in the $product["products"] array, so you can replace the above line with the following code to walk through this array and pick out the longest description:
<?php
$description = "";
foreach($product["products"] as $descProduct)
{
if (strlen($descProduct["description"]) > strlen($description))
{
$description = $descProduct["description"];
}
}
print $description;
?>
Just one thing to be aware of - I have come across several instances where merchant specific information relating to the price / delivery info or special offers etc. exist in the description field. By doing this, there is the potential for "mis-information" to be displayed, so it might be worth checking over your merchants to make sure that their descriptions are factual and don't contain offer specific details...!
Hope this helps,
Cheers,
David.
Thanks David, I will use that code as soon as I figure out how to make more of the product names match up without having duplication within an individual merchant.
I am pushing my site live and am having trouble getting PT to work comletely. I had been working in a folder structure /html/www2 where html is the root and www2 was my dev folder, and /html/www2/shopping was where I set up PT. I moved all of the files and folders in www2 up a level to the root to go live and two things are broken:
1) For some reason, the default.css isn't working on any of the PT pages. It has always been in the same folder as index.php and is in the same path to header.php as it has been since I installed so I don't know what the problem is.
2) The home page displays ok other than the CSS, but any search returns an error. I have removed the /www2/ from the config.php file. What else needs to be changed? I have looked everywhere and I can't find any references to www2 anywhere.
You can see the issue at www.forcecollectors.com/shopping/ - please help.
Thanks,
Rich
Hello Rich,
Firstly, it looks like you haven't got Price Tapestry's .htaccess file in your /shopping/ directory - and if you have, you have not edited it to correct RewriteBase. If you have not yet created the file, copy htaccess.txt to .htaccess in your /shopping/ directory, and edit it as follows:
/shopping/.htaccess
RewriteBase /shopping/
In addition, your config.php needs to contain the correct $config_baseHREF, which in your setup should be:
$config_baseHREF = "/shopping/";
Fixing these 2 issues should get your site working!
Cheers,
David.
Thanks!!!! That worked like a charm. I had been using the full path to mny db that my host gave me and cutting it down to /shopping/ worked. A quick path change on the CSS file and it all looks right now. Thanks so much for all the great support!
Rich
This is an old post, but the code still works! My problem is that I am not following the above at all, I mean pasting it works, but I wanted to modify the code a bit...
Basically I want to leave the default description as it is, and I want to list all the rest of available for the product descriptions in a loop... something like:
DEFAULT DESCRIPTION IS UNCHANGED HERE...
MERCHANT 1 NAME - description of the product from merchant 1 goes here...
MERCHANT 2 NAME - description of the product from merchant 2 goes here...
MERCHANT 3 NAME - description of the product from merchant 3 goes here...
and so on until the rest of the loop.
So if I understand IF we are in the loop already the :
<?php
foreach($product["products"] as $descProduct)
print $descProduct["description"];
?>
Should work to loop the descriptions?... - But it does not... Any ideas what am I doing wrong??
Thanks in advance
Pasha
Hello Pasha,
Your code is absolutely fine - and to double check I just pasted it into html/product.php on my test server immediately after the following line:
<p><?php print $mainProduct["description"]; ?></p>
...and it displayed each description as expected. If you want to email me your modified file i'll check it over for you...
Cheers,
David.
David, it is funny how things just start working the second time I try them... - I have no idea why it did not work before !!
Ok so to summarize it all up, after this:
<?php
print $mainProduct["description"];
?>
I am running:
<?php
foreach($product["products"] as $descProduct)
print str_replace(($mainProduct["merchant"].' - '.$mainProduct["description"]), '', ($descProduct["merchant"].' - '.$descProduct["description"])).'<br /><br />';
?>
In order to have a loop like:
MERCHANT - description
MERCHANT2 - description2
without the first (mainProduct) description, which works fine, but feels like it slowed the page... - Is that an efficient way to do this??
Thanks a lot
Pasha
PS: if it is easier for you to get my product.php via email, just mention it and I will send it out...
Thanks again.
Hi Pasha,
That should be lightening quick - there's no database access involved at all. What you might be noticing is the browser holding back on rendering the page as there is more content than before...
Cheers,
David.
Hello Rich,
As the entire script (and the price comparison) is based on the product name field, only one product of any one name will be imported for any given merchant. If you have the situation where the product name is not sufficient to differentiate the product within a feed then the solution (if it is an option) is to add an additional field to the product name using the "Text After" filter in order to make it unique.
This is normally only possible in the scenario where, for example, you have a manufacturer field and a model number field which together make the product name. You would register the manufacturer as the product name, and then use "Text After" to combine it with the model number.
If they genuinely are different products you could add the product ID to the product name as described above. This would result in the ID being displayed alongside the product name (not ideal, but not a major issue), however this does affect the price comparison, as this based solely on product names, selecting the product name from the database for all merchants that have that product.
Hope this helps clear the situation up. There are limitations of course to this basic method, but the big price comparison sites employ small armies of people to manipulate merchant data before publishing them in order to match up products manually - something that is way outside the scope of this script...
If you would like me to have a look at the feed to see if I can recommend anything feel free to drop me an email with a link to the feed on your site - reply to your reg code or forum registration email is the easiest way to get me...
Cheers,
David.