Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

use php functions outside catalog


Guest

Recommended Posts

Posted

Hi, i have my shop installed in htdocs/shop and my landing pages is htdocs/index.php. What i'm trying to do is incorporate some of the boxes from the left column on my landing page (featured products etc) to more tightly intergrate the shop/LP. I know i could just use the shop, but i'm planning on including alot more on my site, which is all still to come.

 

Could someone recommend how to do this i tried copy/pasting the initial php code from shop/index.php and changed the path to application_top but i get errors finding configure.php.

 

Thanks

 

Lou

Posted

/*

Header to allow use of catalog files

*/

$cwd=getcwd();

chdir('/home/mysite/public_html/catalog/');

define('STYLESHEET', 'catalog/stylesheet.css' );

require('includes/application_top.php');

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Posted

Thanks, although it doesn't load the stylesheet or images.

 

You can see here: index2.php

 

my code is:

 

<?php

/*

/*

Header to allow use of catalog files

*/

$cwd=getcwd();

chdir('/home/fhlinux146/p/prettyplanters.co.uk/user/htdocs/shop/');

define('STYLESHEET', 'shop/stylesheet.css' );

require('includes/application_top.php');

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);

?>

Posted
it doesn't load the stylesheet

 

Add within head section:

 

<link rel="stylesheet" type="text/css" href="<?php echo STYLESHEET; ?>">

 

For images you must include the path to the catalog, not just images/, catalog/images/

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Posted

Thanks, all working now.

 

However noticed once i started to add this code to my non-catalog page, at the same time my shop started playing up, i can't access it because of this error:

 

Fatal error: Call to a member function add_current_page() on a non-object in /home/fhlinux146/p/prettyplanters.co.uk/user/htdocs/shop/includes/application_top.php on line 312

 

and if i comment out the offending code block (// navigation history) the shop works again, i get this when i click on 'My account':

 

Fatal error: Call to a member function set_snapshot() on a non-object in /home/fhlinux146/p/prettyplanters.co.uk/user/htdocs/shop/account.php on line 16.

 

could it be related to the new defines in index2.php?

 

Thanks for the help

 

Lou

Posted

It could be related to data in your browser cache, try clearing it then retest, also see http://www.oscommerce.com/forums/index.php?sho...=0#entry1264847

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Posted

Spot on :thumbsup:

 

That worked perfectly, thanks for the help.

 

Lou

Posted

I've just noticed another issue, i'm using the shopping cart box outside catalog (on my index.php) but it doesn't update with the shopping cart info when returning to index.php from shop/index.php, returning to the shop still shows the shopping cart contents, but it's empty on the landing page (index.php).

 

Is thiss to do with session id's or cookies, i'm forcing cookie use via admin, but i'm assuming the landing page doesn't read cookies.

my code is:

<?php

/*

/*

Header to allow use of catalog files

*/

$cwd=getcwd();

chdir('/home/fhlinux146/p/prettyplanters.co.uk/user/htdocs/shop/');

define('STYLESHEET', 'shop/stylesheet.css' );

define('DIR_WS_IMAGES', 'shop/images/' );

require('includes/application_top.php');

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT);

?>

 

you can try it here prettyplanters.co.uk

 

Thanks

Posted

Your site is much too slow to load to test, perhaps you need a better server.

 

This problem is usually resolved by force cookie, but is usualy due to failure to use tep_href_link for all links.

 

You may well find you don't get it with an improved server.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Posted

yeah, i'm looking into finding a new host, fasthosts are crap. No ssl, can't install ultimate seo because they don't allow changes to htaccess and their php/mysql goes well slow quite often.

 

I'll try what you mentioned, got force cookies on tho.

 

Thanks for all your help, really appreciated.

 

Lou

Posted

I use https://www.5quidhost.co.uk/ they have a free option which is good till you need more bandwidth, you only need a domain to get going.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...