Page 1 of 1

Emailing an order form

Posted: Mon Oct 18, 2010 8:47 am
by lostinthecode
Hey guys, this was touched briefly on my last post but I think the thread is dead, I need help trying to make the order form on my website email the order instead of sending it to our credit card processing system.

Here is the code snippet that shows what the submit button looks like:

Code: Select all

  </fieldset>
        <?php } ?>

        <div>
            <input type="checkbox" name="customer_agreed" id="customer_agreed"> I understand and agree to the <a href="/terms/">terms and conditions</a>  of this sale.<br><br>
            <input type="submit" name="customer_order_new" id="customer_order_new" value="Submit Order">
        </div>
    </form>

    <?php
}
Here is the snippet that shows where customer_order_new gets called:

Code: Select all

          $cart->saveCart();
            if (count($cart->cart_items) > 0) {
                $cart->loadItemInfo();
                displayCheckoutForm($_POST);
            } else {
                unset($cart);
                header("Location: /");
            }
        } elseif ((array_key_exists("customer_order_new", $_POST)) && (! empty($_POST["customer_order_new"]))) {
            if ((! array_key_exists("customer_agreed", $_POST)) || (strcmp($_POST["customer_agreed"], "on"))) {
                echo "<p>You must first agree to the terms and conditions governing the use of this website.</p>\n";
                displayCheckoutForm($_POST);
            } else {
                $custid = 0;
                if (! $user->isAuthenticated()) {
                    if (! empty($_POST["customer_pass1"])) {
                        if (($cid = $customers->Create($_POST))) {
                            $custid = $cid;
                        } else {
                            echo "<p>" . $_SESSION["msg"] . "</p>\n";
                            unset($_SESSION["msg"]);
                            displayCheckoutForm($_POST);
                        }
                    }
                } else {
                    $customers->Fetch("customer_user = {$user->user_id}");
                    $cust = current($customers->customers);
                    if ($cust) {
                        $custid = $cust->customer_id;
                        if (! $customers->Edit($custid, $_POST)) {
                            echo "<p>" . $_SESSION["msg"] . "</p>\n";
                            unset($_SESSION["msg"]);
                            displayCheckoutForm($_POST);
                        }
                    } else {
                        if (($cid = $customers->Create($_POST))) {
                            $custid = $cid;
                        } else {
                            echo "<p>" . $_SESSION["msg"] . "</p>\n";
                            unset($_SESSION["msg"]);
                            displayCheckoutForm($_POST);
Thanks in advance for any help.

Re: Emailing an order form

Posted: Tue Oct 19, 2010 6:48 am
by greyhoundcode
But what is the problem, or what is it you wish to improve upon?