X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   How to make product.tpl as the real first page ? (https://forum.x-cart.com/showthread.php?t=19478)

Chuchen 01-25-2006 12:28 AM

How to make product.tpl as the real first page ?
 
I would like to sell only one product on a website (one product for one month, one another product for the next month, etc.).

So please, how to make product.tpl as the real first page to show the last and only one product I sell ? This way, my customer could see directly product.tpl page at www.mynextsite.com (I don't like to use a redirection).

I can't find this information on the forum, so thank you very much if it is possible :)[/b]

pauldodman 01-25-2006 12:37 AM

One way to do this would be, having removed index.html index.php is now your new start page.
Now edit index.php and change home.php to the path of your product.
e.g.

Code:

header("Location: product.php? productid=76&cat=103&page=1&featured");

Chuchen 01-25-2006 09:19 AM

Thank you for your answer :)

Unfortunately, I don't want to do redirection. Do you think I can call the product.php page : index.php or home.php ?

Jon 01-25-2006 09:38 AM

Make a copy of product.php and rename it home.php

In home.php after the include of auth.php put:

$productid = "X";

Where X is the productid of the product you want to display.

Chuchen 01-25-2006 11:58 AM

Thank you very very much Jon, I will try tomorrow :)

Chuchen 01-29-2006 09:04 AM

After few tests, it works great ! Thank you again. Now, I'm trying to write a little bit of PHP to get always the last product ID instead of write it each time on the new home.php file.

Do you think it's a good idea ?

Jon 01-29-2006 08:07 PM

[Removed]

Chuchen 01-29-2006 09:35 PM

Thank you Jon ! :D

I must write your code under "define('OFFERS_DONT_SHOW_NEW',1);
require "./auth.php";" isn't it ?

Jon 01-29-2006 09:51 PM

[Removed]

Chuchen 01-29-2006 09:57 PM

I've got this message :

"INVALID SQL: 1064 : You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE 1 ORDER BY DESC LIMIT 1' at line 1
SQL QUERY FAILURE: SELECT productid from WHERE 1 ORDER BY DESC LIMIT 1

If the page is not updated in a 5 seconds, please follow this link: continue >>"

and after I can read this message on the home.php page :

Access denied !
You are not allowed to access that resource!
Error ID: 33


Maybe the mistake come from the "where 1" ?

Jon 01-29-2006 10:04 PM

I'm sorry, it's late at night. This one will work, I promise :D

Code:

$productid = func_query_first("SELECT productid from $sql_tbl[products] WHERE 1 ORDER BY productid DESC LIMIT 1");
$productid = $productid[productid];


Chuchen 01-29-2006 10:11 PM

:D This time I've got this message :

"If the page is not updated in a 5 seconds, please follow this link: continue >> INVALID SQL: 1064 : You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE 1 ORDER BY productid DESC LIMIT 1' at line 1
SQL QUERY FAILURE: SELECT productid from WHERE 1 ORDER BY productid DESC LIMIT 1


If the page is not updated in a 5 seconds, please follow this link: continue >>"

(sorry to bother you Jon :oops: )

This is the code :

Code:

define('OFFERS_DONT_SHOW_NEW',1);
require "./auth.php";


$productid = func_query_first("SELECT productid from $sql_tbl[xc_products] WHERE 1 ORDER BY productid DESC LIMIT 1");
$productid = $productid[productid];

#
# Put all product info into $product array
#


Jon 01-29-2006 10:16 PM

Don't change this code:

Code:

$sql_tbl[products]

Chuchen 01-29-2006 10:19 PM

Everything works great now ! Thank you Jon ! :D

Ah damned, there is a mistake on the top of the home.php page. I can read "If the page is not updated in a 5 seconds, please follow this link: continue >>" 8O

Jon 01-30-2006 07:05 AM

I've tested my exact code on 4.0.x and it should not cause the problem, there must be something else going on, sorry you're on your own from here.

Chuchen 01-30-2006 08:18 AM

No problem Jon, I will try to see if I can do something about that. Thank you again for help :D


All times are GMT -8. The time now is 11:53 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.