Results 1 to 7 of 7

Specials on non-osC Max php page

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 ...

      
  1. #1
    New Member
    Join Date
    Sep 2007
    Location
    Fennimore, WI, USA
    Posts
    7
    Rep Power
    0


    Default Specials on non-osC Max php page

    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. #2
    osCMax Development Team met00's Avatar
    Join Date
    Oct 2005
    Location
    wherever I happen to be at the moment
    Posts
    854
    Blog Entries
    2
    Rep Power
    21


    Default Re: Specials on non-osC Max php page

    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. #3
    New Member
    Join Date
    Sep 2007
    Location
    Fennimore, WI, USA
    Posts
    7
    Rep Power
    0


    Default Re: Specials on non-osC Max php page

    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. #4
    osCMax Development Team met00's Avatar
    Join Date
    Oct 2005
    Location
    wherever I happen to be at the moment
    Posts
    854
    Blog Entries
    2
    Rep Power
    21


    Default Re: Specials on non-osC Max php page

    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'); ?>
    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).

    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. #5
    New Member
    Join Date
    Sep 2007
    Location
    Fennimore, WI, USA
    Posts
    7
    Rep Power
    0


    Default Re: Specials on non-osC Max php page

    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. #6
    New Member
    Join Date
    Sep 2007
    Location
    Fennimore, WI, USA
    Posts
    7
    Rep Power
    0


    Default Re: Specials on non-osC Max php page

    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. #7
    osCMax Development Team met00's Avatar
    Join Date
    Oct 2005
    Location
    wherever I happen to be at the moment
    Posts
    854
    Blog Entries
    2
    Rep Power
    21


    Default Re: Specials on non-osC Max php page

    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'); ?>
    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.
    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

Similar Threads

  1. Specials Page not updating in admin?
    By Redeye_Joe in forum osCmax v2 Installation issues
    Replies: 3
    Last Post: 02-06-2006, 07:17 AM
  2. Specials page, how to show in html bts
    By gamefreak7 in forum osCMax v2 Features Discussion
    Replies: 1
    Last Post: 08-31-2005, 08:29 AM
  3. MS2-Max Bug in main page specials???
    By midwestwebsites in forum osCmax v1.7 Discussion
    Replies: 4
    Last Post: 06-16-2004, 12:11 PM
  4. Bug - specials.php page displays to few products
    By Redbeard in forum osCmax v1.7 Discussion
    Replies: 1
    Last Post: 11-09-2003, 11:11 AM
  5. spécials in first page
    By talme in forum osCommerce 2.2 Modification Help
    Replies: 1
    Last Post: 02-19-2003, 01:21 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •