You are here:  » Couple of questions from a n00b


Couple of questions from a n00b

Submitted by Jannii on Sat, 2006-11-04 15:00 in

Hi,

I installed Price Tapestry a couple of days ago and have imported some feeds. All looks OK in the basic setup. Can I ask a couple of silly questions ? Can the feed files be deleted from the server once imported into the database ? (One of my feeds is over 100MB and my server space isn't huge) Having got the search function working fine as a standalone function, I'm now working on incorporating it into a Xmas website I'm building but how do I set up the Price comparison function? Which script is it ?

Also does anyone know where I could find a Wish List script ?

Thanks

Jan

Submitted by support on Sat, 2006-11-04 19:24

Hello Jan,

Yes - you can delete a feed once it has been imported. When you come to update that merchant, as long as you upload the feed with the same filename as it had previously you will not have to re-register. Note that whilst the feed is absent you will see the "De-Register" link on the admin page, but as long as you do not de-register the merchant and all products will remain in the database.

The Price Comparison function is combined with the search function - they are one and the same thing really, so you probably already have the majority of the price comparison code integrated - it's just a matter of how you display the results.

If you study the basic search SQL in search.php, you will notice that aggregate functions are used, such as "MIN(price) as minPrice" etc. These are the fields that you can use when displaying the results in order to show the price comparison. You can see how it is done by looking at the code in html/searchresults.php. One of the aggregate fields in the result set is "numMerchants" - and you will see how the script looks at this value to decide whether to show "More Information" or "Compare Prices" - and in the case of the latter you can show minPrice, maxPrice or whatever combination you wish.

Cheers!
David.

Submitted by Jannii on Mon, 2006-11-06 00:30

Thanks David.

Submitted by support on Mon, 2006-11-06 07:09

Hi Jan,

You need to make all the paths to your images absolute - as they could appear on any page of the site so you don't know what relative path to generate. Make sure that all your image URLs start with / and provide the full path to the file, for example:

<img src='/images/top1.jpg' />

...for your top banner. That will make sure that it is displayed correct on all pages.

Each page in Price Tapestry is constructed as follows:

<?php
  
// main code
  // display header, menu, search form and banner
  
require("html/header.php");
  require(
"html/menu.php");
  require(
"html/searchform.php");
  require(
"html/banner.php");
  
// display HTML modules require for this page, for example:
  
require("html/searchresults.php");
  
// display footer
  
require("html/footer.php");
?>

If you are creating custom code that you want displayed at the top of the script, you can make the changes in html/header.php (after the opening HTML tag). Likewise, the additional HTML for the bottom should go in html/footer.php.

The "Product Search Results"... text is displayed by the html/banner.php module, which you can see comes after the html/header.php module so if you make changes only in html/header.php it should be fine.

Cheers,
David.

Submitted by Jannii on Mon, 2006-11-06 16:01

Hi again David,

I have added the images to header.php but the product search header still comes out at the top so I may have to rearange the order the modules are called in.

At the moment I have added HTML image statements with absolute paths but this is what is not working on the product pages with mod rewrite.
(When clicking on the properties of where the image should be it shows the path as /product/images/picname.jpg when the product directory doesn't actually exist. Therefore it can't find the image file which is in the images directory under the root. I think it's going to be a case of suck it and see to try and get it looking correct but the info above is very helpful.

Thanks

Jan

Submitted by support on Mon, 2006-11-06 16:06

Hi Jan,

Did you fix the images? The reason the path shows /products/images/picname.jpg is because you must still be using a relative URL for the image (something like images/picname.jpg) - and this is why it won't work with mod-rewrite because the browser thinks you are in the /products/ directory and so looks for the image folder relative to that.

All you need to do to fix it is put a forward slash at the beginning of the image url which forces it to be an absolute URL (i.e. relative to the top level of your website). If you do this, the path will be shown as /images/picname.jpg which is what you want, for example:

Won't work: (because it uses a relative path to picname.jpg)

<img src='images/picname.jpg' />

Will work: (the extra / makes it an absolute path to picname.jpg)

<img src='/images/picname.jpg' />

Hope this helps!
David.

Submitted by Jannii on Tue, 2006-11-07 13:47

Hi David,

I managed to sort the pics out (I worked out I'd missed off the slash before reading your message -oops)

Thanks