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 ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
#1
| |||
| |||
| 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_ ()/() |
|
#2
| |||
| |||
| 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 |
|
#3
| |||
| |||
| 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_ ()/() |
|
#4
| |||
| |||
| 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>) 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 |
|
#5
| |||
| |||
| 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_ ()/() |
|
#6
| |||
| |||
| 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_ ()/() |
|
#7
| |||
| |||
| lets try this one more time... Inside your index.php or whatever non-osc page you have include the following 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 |
| Thread Tools | |
| |
| ||||
| Posted By | For | Type | Date | |
| Pages tagged with "osc" on del.icio.us | This thread | Refback | 10-01-2007 03:44 PM | |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Specials Page not updating in admin? | Redeye_Joe | osCMax v2 Installation issues | 3 | 02-06-2006 07:17 AM |
| Specials page, how to show in html bts | gamefreak7 | osCMax v2 Features Discussion | 1 | 08-31-2005 07:29 AM |
| MS2-Max Bug in main page specials??? | midwestwebsites | osCMax v1.7 Discussion | 4 | 06-16-2004 11:11 AM |
| Bug - specials.php page displays to few products | Redbeard | osCMax v1.7 Discussion | 1 | 11-09-2003 11:11 AM |
| spécials in first page | talme | osCommerce 2.2 Modification Help | 1 | 02-19-2003 01:21 AM |