You are here:  » Products for front page

Support Forum



Products for front page

Submitted by Paul1107 on Sun, 2009-11-15 19:32 in

Hi David,

I was hoping you could help me with a mod similar to that you did for me in a previous installation of Price Tapestry by amending external.php

Specifically, a block of say 10-12 products in a grid view, each product which once clicked would then go through to a normal price comparison/similar products page for that item.

Is that possible at all? This particular site is using Price Tapestry in a sub-directory

Thanks For any help you can provide

Regards

Paul

Submitted by support on Mon, 2009-11-16 09:56

Hi Paul,

Were these random or fixed products?

Either way; it sounds like it's just the normal "Featured Products" functionality (which external.php) supports; and if random it would just require the random Featured Products mod merged in to your external.php. The mod is described in this thread:

http://www.pricetapestry.com/node/2276

...however in external.php, the line to change is near the end of the script around line 495.

In addition; to make the products display in a grid, this requires a modification to html/featured.php described in the following thread:

http://www.pricetapestry.com/node/284

If you're not sure about either of the changes; email me the external.php and includes/featured.php from this site and I'll modify them for you (don't forget to let me know if it's random or fixed featured products...)

Cheers,
David.

Submitted by Paul1107 on Mon, 2009-11-16 11:25

Thanks David,

Had a shot at this myself, and it works, but would like clarification on a couple of things.

featured products: I've entered the following thinking that it would give me 12 fixed results from featured products, but the results are random

$sql = "SELECT name,1 AS sequence FROM `".$config_databaseTablePrefix."products` ORDER BY sequence LIMIT 12";

Additional rows: again this is OK, but I've put 12 product results to show. by entering, 3 rows you get 4 columns, but I want 3 columns, which would indicated entering the value 4, as such:

<?php
        
if ($count++ == 4)
        {
          print 
"</tr><tr>";
          
$count 0;
        }
        
?>

But the results are 2 rows of 5 columns and 1 row of 2, do you know how I might get around that?

Thanks

Paul

Submitted by support on Mon, 2009-11-16 12:11

Hi Paul,

SELECT from the products table will return random results - if you want a fixed 12 products from Featured Products (even if there are more than 12), then it would only require a small change the original SQL; as follows:

$sql = "SELECT * FROM `".$config_databaseTablePrefix."featured` ORDER BY sequence LIMIT 12";

Regarding the rows; try replacing the code above with:

<?php
        $count++;
        if ($count == 3)
        {
          print "</tr><tr>";
          $count = 0;
        }
?>

Hope this helps!

Cheers,
David.

Submitted by Paul1107 on Mon, 2009-11-16 12:39

Hi David,

That's sorted it thanks!

In relation to same site, I don't know what I've done, but it is something to do with the .htaccess file.

I was trying to add the amazon.php to the site, once the amazon.php file did not work by simply adding it and changing to the most appropriate search index, I referred back to a mod you carried out on another site. Your mod involved adding instruction in the .htaccess file to trigger php5 in my server "SetEnv DEFAULT_PHP_VERSION 5". I uploaded the file with the command but the page then returned a 404 error, though the home page still looked OK. I reverted back to the original .htaccess file but it didn't fix it?

Do you know why that might be?

Thanks again for all your help

Regards

Paul

Submitted by support on Mon, 2009-11-16 12:43

Hi Paul,

Double-check that the rules in .htaccess match the current site; as it sounds like they may have become disconnected - in particular double check that RewriteBase is still correct (it should match the value in $config_baseHREF in config.php).

Otherwise, I'm wondering if it might be caching the PHP version statement - so if everything else looks OK it might be worth trying..

SetEnv DEFAULT_PHP_VERSION 4

Cheers,
David.

Submitted by Paul1107 on Mon, 2009-11-16 12:55

Hi David,

I am uploading to the root, and NOT the /products/ (the PT sub directory)? as I've checked your suggestions and put in the new command ad it's still showing a 404

Thanks

Paul

Submitted by support on Mon, 2009-11-16 13:32

Hi Paul,

Could you email me a couple of links showing the problem, and your .htaccess and i'll check it out for you!

Cheers,
David.