You are here:  » CSV acting strange, and merchant logo after price?

Support Forum



CSV acting strange, and merchant logo after price?

Submitted by evismaniac on Wed, 2008-04-30 17:51 in

Afternoon!

Purchased the script last week and have a site well in production! All looking good other than a couple of daft questions!

I have modified quite a few bits and bobs and have managed to get the merchant logo on the price comparison page no problem!

But I also want it to display the merchant logo (a different logo which I have have placed in a different folder) after the price. So for example it would say:

best price £49.99
From
{cheapest merchants logo here}

I have copied the code I have used from the prices.php but it displays each of the merchants. Im guessing it is something to do with the 'foreach' (im rubbish with php btw) Here is the code im talking about (which i have attempted to modify myself).

I did try just adding the php 'img' code but nothing was displayed at all. After adding the 'foreach' code the logo appeared but for all merchants not just the cheapest. Im guessing something needs to be changed here, but not sure what!

              <?php if ($priceProduct["price"] == $mainProduct["price"]): ?>
                <a href='<?php print tapestry_buyURL($priceProduct); ?>' <?php print javascript_statusBar(translate("go to")." ".$priceProduct["merchant"]); ?> target="_blank"><strong><?php foreach ($prices["products"] as $product): ?>
    <?php
        print "<img border='0' src='".$config_baseHREF."logos_link/".$product["merchant"]."' alt='".$product["merchant"]."' title='"."Click here to visit this store!"."' />";
      ?>
    <?php endforeach; ?></strong></a>

Secondly, I have only had success importing XML feeds. If I attempt to add a CSV file when it comes to registering it is all messed up. The description continues into the price and deeplink fields, and upon importing the feed and viewing the site, nothing is matched up correctly. Any ideas?

Great script BTW! Looking forward to getting my first site up using it!

Cheers for any help!!!

Submitted by support on Thu, 2008-05-01 07:46

Hi,

For the cheapest logo - no need to use the foreach, and instead of $product use $priceProduct as at this point you are already in a loop where each $priceProduct is a merchant with the product at the cheapest price.... Try this:

              <?php if ($priceProduct["price"] == $mainProduct["price"]): ?>
                <a href='<?php print tapestry_buyURL($priceProduct); ?>' <?php print javascript_statusBar(translate("go to")." ".$priceProduct["merchant"]); ?> target="_blank"><strong>
    <?php
        print "<img border='0' src='".$config_baseHREF."logos_link/".$priceProduct["merchant"]."' alt='".$priceProduct["merchant"]."' title='"."Click here to visit this store!"."' />";
      ?>
</strong></a>

Regarding the CSV problem, this sounds like auto-detection did not pick up quoted text - which can happen if the data itself is quoted but the header row is not! The easiest thing to do is to select the correct format from the drop-down box on Feed Registration (Step 1) instead of taking the auto-detected format string. If it's comma separated, the most likely one to use is "Quoted Text - Header Row - Comma Separated" - but you can simply use the back button to try different options until the sample data shown looks correct...

Cheers,
David.

Submitted by evismaniac on Sat, 2008-05-03 09:15

Thanks David, the logo is working great now!!!! :D

I will have a play around with the different feed settings to see which one works.

It is a lot easier to modify a CSV file than is is the XML, unless there is a simpler way to go through XML files to only show what products you want in there?

Thanks again, much appreciated!

Submitted by support on Sun, 2008-05-04 10:30

Hi,

Yes - CSV will be much easier to manage by editing the file directly, as many XML documents are formatted without any white space (although some are), which means it would be difficult to handle in a normal text editor.

Cheers,
David.