/** * get_checkout function. * * @access public * @return void */ public function get_checkout() { $html = ''; $types = array(); $products = array(); if (is_array($this->cart_items) && !empty($this->cart_items)) { foreach ($this->cart_items as $item) { $type = new Product_Type($item->product_type); if ($type != 'cone') { $types[] = '<input type="hidden" name="cart_product_types[]" value="' . $item->product_id . '" />'; } $products[] = '<input type="hidden" name="cart_product[]" value="' . $item->product_id . '" />'; } } $data['checkout']['cart_total'] = $this->get_cart_total(); $data['checkout']['types'] = $types; $data['checkout']['products'] = $products; return Template_Helper::render_template(__TEMPLATE_PATH__, 'checkout', $data); }
<?php require_once '../../functions.php'; $data = $_POST; $resp = new Ajax_Response($data['action'], true); if (!empty($data) && is_array($data)) { $type = new Product_Type($data['product_type']); if ($type instanceof Product_Type) { $data['type_name'] = $type->product_type_slug; $data['action'] = 'add_to_cart'; $data['fields'] = $type->get_product_form_fields($type); $resp->set_status(true); $resp->set_data(array('new_form' => Template_Helper::render_template(__TEMPLATE_PATH__, 'product_choice_form', $data))); } else { $resp->set_message('Could not load fields for ' . ucfirst($type_name) . '. Please try again.'); } } echo $resp->encode_response(); die;
/** * build_register_form function. * * @access public * @static * @return void */ public static function build_register_form() { $html = ''; $data['login']['mode'] = 'register'; $data['login']['btn'] = 'Register'; $data['login']['action'] = 'user_register'; $html .= Template_Helper::render_template(__TEMPLATE_PATH__, 'login-form', $data); return $html; }