On our site we have a static php home page that exists outside the store. Is there a way to add some code on that page that will display specials or a featured product?
Thanks,
WebWise
This is a discussion on Specials on non-osC Max php page within the osCmax v2 Customization/Mods forums, part of the osCmax v2.0 Forums category; On our site we have a static php home page that exists outside the store. Is there a way to ...
On our site we have a static php home page that exists outside the store. Is there a way to add some code on that page that will display specials or a featured product?
Thanks,
WebWise
Save the world, Ride a bike.
o_
()/()
what you seem to be asking is what is the minimum necessary to pull in the specials. You only look at a window that is opened outside the normal browser to see the minimum code required. That window is the "receipt" that gets displayed at the end of a sale. The code in there supplies a template for all the minimal things that are necessary to display a stand along piece of OSC.
so endith the lesson
<think>sometimes I just sit's and thinks</think>
"Here you are with a hand full of holes, a thumb up your ass, and a big grin to pass the time of day with." - TWB
Where do I find the code for this "receipt" window/box so that I can place the content (such as the specials box or a featured product) into it? I assume I can then place this stand alone code on our site's php home page outside our store.
Save the world, Ride a bike.
o_
()/()
It's called print_order.php
It's in /catalog
This is the code that is run when a person completes a transaction and wants a receipt. It creates a popup window with just a receipt for the order.
Now, let's strip out all the code that prints the receipt (ie: the <body>)
That is the barebones version. take the area that is commented out and replace it with the call to the function you want to use (special, featured products, whatever).Code:<?php /* my core */ require('includes/application_top.php'); if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } /* this can be stripped out and replaced with your call to the special function or whatever... if (!isset($HTTP_GET_VARS['order_id']) || (isset($HTTP_GET_VARS['order_id']) && !is_numeric($HTTP_GET_VARS['order_id']))) { tep_redirect(tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL')); } $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " wher e orders_id = '" . tep_db_input($oID) . "'"); $customer_info_query = tep_db_query("select customers_id from " . TABLE_ORDERS . " where orders_id = '". (int)$HTTP_GET_VARS['order_id'] . "'"); $customer_info = tep_db_fetch_array($customer_info_query); if ($customer_info['customers_id'] != $customer_id) { tep_redirect(tep_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL')); } require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ORDERS_PRINTABLE_INFO); $breadcrumb->add(NAVBAR_TITLE_1, tep_href_link(FILENAME_ACCOUNT, '', 'SSL')); $breadcrumb->add(NAVBAR_TITLE_2, tep_href_link(FILENAME_ACCOUNT_HISTORY, '', ' SSL')); $breadcrumb->add(sprintf(NAVBAR_TITLE_3, $HTTP_GET_VARS['order_id']), tep_href _link(FILENAME_ORDERS_PRINTABLE_INFO, 'order_id=' . $HTTP_GET_VARS['order_id'], 'SSL')); require(DIR_WS_CLASSES . 'order.php'); $order = new order($HTTP_GET_VARS['order_id']); */ ?> <link rel="stylesheet" type="text/css" href="stylesheet.css"> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
Now, all you have to do is include this code in your index.php page and VIOLA! you have included a portion of OSC into your other pages.
so endith the lesson
<think>sometimes I just sit's and thinks</think>
"Here you are with a hand full of holes, a thumb up your ass, and a big grin to pass the time of day with." - TWB
By replacing a call to the desired function do you mean replae all instances of "order" with "special". It seems a lot of that code deals with customer ids which seem unecessary for displaying a specials box on an outside page. It seems the following two lines are the only releveant ones:
require(DIR_WS_CLASSES . 'order.php');
$order = new order($HTTP_GET_VARS['order_id']);
However simply including these with the appropriate changes isn't enough either.
The "Infoboxes outside OSC" contribution found on the oscommerce site seems to work for the "what's new" box but not specials. Here is the code from the contribution:
<?php
/*
Author: David Vance
Email: dv@josheli.com
Date: March 15, 2003
OSC 2.2 MS1
PHP Version 4.3.1
This snippet allows you to place an info box (or other osc things i suppose) elsewhere on your site (outside of OSC, though it must be the same site as OSC).
There must be no html or php output above the application_top.php include (unless you use buffering, etc.), or you will get "headers already sent" errors.
Sample: http://www.josheli.com/new.php
*/
//saves current working directory for later return
$cwd=getcwd();
//changes current working directory to osc root install directory;
//something like: /home/david/www/catalog/ but not DIR_FS_CATALOG
chdir('shop');
//need all of application_top's configurations and includes
//NO OUTPUT ABOVE THIS POINT!
include('includes/application_top.php');
ob_start(); //start buffering
include(DIR_WS_BOXES.'specials.php');//include the file for the box you want
$sbox=ob_get_contents();//save it in a variable for later use
ob_clean();//clean the buffer
include(DIR_WS_BOXES.'whats_new.php');//include another file for the box you want
$wbox=ob_get_contents();//save it in a variable for later use too
ob_end_clean();//stop buffering
//replace relative image paths with absolute urls (you may not need this. i did.)
$sbox=str_replace("src=\"images", "src=\"<A href="http://74.53.88.227/shop/images",$sbox">shop/images",$sbox);
//$wbox=str_replace("src=\"images", "src=\"<A href="http://74.53.88.227/shop/images",$wbox">shop/images",$wbox);
chdir($cwd);//change back to original working directory
//********* COPY THE CODE ABOVE TO THE TOP OF THE FILE YOU WANT YOUR BOX IN *******\\
?>
Save the world, Ride a bike.
o_
()/()
It seems that the only relevant lines to showing the specials outside of osc are the requre and $order= lines at the end.
We have the "Infoboxes outside OSC" contribution on the page and it displays the "what's new" page but not the specials. I put two test specials in the db and they don't appear in the Site Index page, just the store index page.
Save the world, Ride a bike.
o_
()/()
lets try this one more time...
Inside your index.php or whatever non-osc page you have include the following
Is that a simple enough explanation? In order to get the osc code to run you only have to pick up the application top and bottom and then include the osc function call.Code:<?php /* my core */ require('includes/application_top.php'); if (!tep_session_is_registered('customer_id')) { $navigation->set_snapshot(); tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL')); } /* insert your call to the special function or whatever... */ ?> <link rel="stylesheet" type="text/css" href="stylesheet.css"> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>
so endith the lesson
<think>sometimes I just sit's and thinks</think>
"Here you are with a hand full of holes, a thumb up your ass, and a big grin to pass the time of day with." - TWB
Bookmarks