Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2010
    Posts
    51
    Plugin Contributions
    0

    Default define_checkout_success

    I have two different products that I need to send customers to two different checkout_success pages. Is there a way for me to build an intermediary page (before "define_checkout_success") that will check the product_id and do one of two things depending on the result?

    example:
    I have two products:
    1 is a digital magazine (digital meaning online version) that requires a username and password.
    1 is a print magazine that requires nothing (we simply ship the magazine to them).

    If the customer purchases the digital version, they should go to define_checkout_success_digital.php which I have already created. That page sends their username and password to our third party fulfillment company and returns a login page for the customer to login.

    If it's a print product they should redirect to define_checkout_success_print. In which case I simply have some text that displays shipping times and what not.

    If they purchase both they should still go to define_checkout_success_digital.

    I'm sooo stuck.
    Any ideas would be greatly appreciated.

    Matt

    btw - here is the code I tried. it's obviously not working:

    PHP Code:
    <?PHP
     error_reporting
    (E_ALL);
      
    // ini_set('display_errors','On'); 
    require 'db.inc.php';
    $db mysql_connect(MYSQL_HOSTMYSQL_USERMYSQL_PASSWORD) or
        die (
    'Unable to connect. Check your connection parameters.');

    // Retrieve all the data from the "zen_cart.pm_customers" table
    $result mysql_query("SELECT * FROM zen_cart.pm_customers WHERE customers_id=" $_SESSION['customer_id']) or
        die(
    mysql_error());  

    // store the record of the "zen_cart.pm_customers" table into $row
    $row mysql_fetch_array($result);

    $result mysql_query("SELECT * FROM zen_cart.pm_products WHERE products_id=" $row['products_id']) or
            die(
    mysql_error());  

    if (
    $row['products_id'] == "4")
    {
        
    //go to define_checkout_success_digital
        
    header ("location: "/digital/includes/languages/english/html_includes/classic/define_checkout_success_digital.php"");
    }
    else
    {
        
    //else go to define_checkout_success_print
        
    header ("location: "/digital/includes/languages/english/html_includes/classic/define_checkout_success_print.php"");
    }
    ?>
    Last edited by inestine; 19 Nov 2010 at 10:35 PM. Reason: added code

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,896
    Plugin Contributions
    96

    Default Re: define_checkout_success

    Instead of having two "checkout_success" pages, why not use the existing checkout_success and just customize the content based on what the customer has purchased?

    Create a new file /includes/modules/pages/checkout_success/header_php_type.php:

    Code:
      define('PRODUCT_ID_DIGITAL', '1'); // ... whatever the digital product's id is
      $products_type_query = "SELECT products_id
                         FROM " . TABLE_ORDERS_PRODUCTS . "
                         WHERE orders_id = :ordersID";
       
      $products_type_query = $db->bindVars($products_type_query, ':ordersID', $orders_id, 'integer');
      $products_type = $db->Execute($products_type_query);
    
      $product_type_digital = false;
      while (!$products_type->EOF) {
         if ($products_type->fields['products_id'] == PRODUCT_ID_DIGITAL) {
           $product_type_digital = true;
         }
         $products_type->MoveNext();
      }
    Then, modify /includes/templates/YOURTEMPLATE/templates/tpl_checkout_success_default.php to check the $product_type_digital flag and format the page based on whether there is/isn't a digital product in the order.
    Last edited by lat9; 20 Nov 2010 at 09:51 PM. Reason: Fix error

 

 

Similar Threads

  1. Please help, I ruined my define_checkout_success.php
    By MommyMilk® in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 3 Nov 2010, 03:35 PM
  2. Variables that are passed to define_checkout_success.php
    By babyandme in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 9 Sep 2008, 11:21 PM
  3. define_checkout_success.php
    By Goofster in forum General Questions
    Replies: 0
    Last Post: 9 Jul 2008, 12:49 PM
  4. Where is '$define_checkout_success' defined??
    By jronis in forum Installing on a Linux/Unix Server
    Replies: 13
    Last Post: 29 Aug 2006, 02:30 AM

Posting Permissions

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