function quickPay() { global $order, $user; if ($order->shipping_required) { redirect_to(array('controller' => 'cart', 'action' => 'checkout')); } if (empty($order->orderitem)) { flashAndFlow('error', 'There are no items in your cart.'); } // if we made it here it means that the item was add to the cart. expHistory::set('viewable', $this->params); // call each products checkout() callback & calculate total foreach ($order->orderitem as $item) { $product = new $item->product_type($item->product_id); $product->checkout(); } // setup the billing & shipping calculators info if ($product->requiresBilling) { $billing = new billing(); assign_to_template(array('billing' => $billing)); } if ($product->requiresShipping) { $shipping = new shipping(); $shipping->pricelist = $shipping->listPrices(); assign_to_template(array('shipping' => $shipping)); } assign_to_template(array('product' => $product, 'user' => $user, 'order' => $order)); }
function listPrices() { $shipping = new shipping(); $ar = new expAjaxReply(200, 'ok', $shipping->listPrices(), array('controller' => 'cart', 'action' => 'checkout')); $ar->send(); }