osCommerce custom PHP page
Posted
by Afrosimon
on Stack Overflow
See other posts from Stack Overflow
or by Afrosimon
Published on 2010-06-17T14:50:19Z
Indexed on
2010/06/17
14:53 UTC
Read the original article
Hit count: 417
php
|oscommerce
Hello!
One of my client has an old osCommerce website and while working on it I have to implement what I would call "custom php page", i.e. a page which query a MySQL table, not related to osCommerce, and list the result. I'm not sure of the version, this trick I have seen a lot didn't gave me any result : http://www.clubosc.com/how-to-know-what-version-of-oscommerce-you-are-using.html . And I'm having a hard time doing this seemingly simple task, since osCommerce doesn't allow any php code in the page creation, and I didn't find any module giving me this possibility (not that it is easy to search in this mess : http://addons.oscommerce.com/). At this point I figured it would be easier to just hack'n slash through the code and come up with a custom page :
I copied the index.php (the entry point in the application) :
<?php
require('includes/application_top.php');
if(!$smarty->is_cached($sContentPage, $sCachingGroup)) {
//we switch on the content recognition
require('includes/pages/' . $sContentClass . '.php');
}
$smarty->display($sContentPage, $sCachingGroup);
require(DIR_WS_INCLUDES . 'application_bottom.php');
?>
Here I gave a specific value to $sContentClass (with or without the if makes no difference) and customize the corresponding PHP file so it show my custom content but also initialize the same variable than those other PHP file in the pages/ folder. But alas, all of this curious and dubious code simply return me the home page. So here I am, is there an osCommerce Guru around here, or would anyone has a better idea (oh and I also posted on the osCommerce forum, but I'm still waiting for a response...)? Thanks a lot in advance.
© Stack Overflow or respective owner