static function getOrderRef($refnr) { $is_group = basket_plus::getUserIsGroup(); if ($is_group) { $user = identity::active_user(); //get user_basket setting $user_basket = ORM::factory("bp_user_basket")->where("id", "=", $user->id)->find(); if ($refnr == 1) { $order_ref = $user_basket->extra_order_info_lbl; } elseif ($refnr == 2) { $order_ref = $user_basket->extra_order_info_lbl2; } } if ($order_ref == "") { if ($refnr == 1) { $order_ref = t("Order reference"); } elseif ($refnr == 2) { $order_ref = t("Order reference 2"); } } return $order_ref; }
private function getCheckoutForm($basket) { // $basket = Session_Basket::get(); //labels for fields $input1_lbl = t("Title"); $input2_lbl = t("Initials/First name"); $input3_lbl = t("Insertion"); $input4_lbl = t("Name"); $input5_lbl = t("Street"); $input6_lbl = t("House Number / Name"); $input7_lbl = t("Suburb"); $input8_lbl = t("Postal code"); $input9_lbl = t("Town or City"); $input10_lbl = t("E-mail Address"); $input11_lbl = t("Telephone Number"); $input12_lbl = t("Order reference"); $input13_lbl = t("Order reference 2"); $input14_lbl = t("Additional comments"); $input15_lbl = t("I agree with the General Terms"); $input16_lbl = t("Use PayPal for payment"); $input17_lbl = t("State or Province"); $input18_lbl = t("Country"); //get user-defined labels for order reference with pickup $is_group = basket_plus::getUserIsGroup(); if ($is_group) { $user = identity::active_user(); //get user_basket setting $user_basket = ORM::factory("bp_user_basket")->where("id", "=", $user->id)->find(); $extra_order_info_lbl = $user_basket->extra_order_info_lbl; if ($extra_order_info_lbl != "") { $input12_lbl = $extra_order_info_lbl; } $extra_order_info_lbl2 = $user_basket->extra_order_info_lbl2; if ($extra_order_info_lbl2 != "") { $input13_lbl = $extra_order_info_lbl2; } } //NOTE: mandatory field checks in JavaScript in the view 'checkout_html.php' //labels for mandatory fields $input2_lbl .= "*"; //initials $input4_lbl .= "*"; //name $input10_lbl .= "*"; //email $input11_lbl .= "*"; //phone $input15_lbl .= "*"; //general terms //labels for mandatory fields with p&p (mail) $pickup = $basket->pickup; $postage = $basket->postage_cost(); if (!$pickup && $postage > 0) { $input5_lbl .= "*"; //street $input6_lbl .= "*"; //house $input8_lbl .= "*"; //postalcode $input9_lbl .= "*"; //city } elseif ($pickup && $postage > 0) { $input12_lbl .= "*"; $input13_lbl .= "*"; } //create the form and add fields //NOTE: the order below determines the order on the form $form = new Forge("basket_plus/confirm", "", "post", array("id" => "checkout", "name" => "checkout")); $group = $form->group("contact")->label(t("Contact Details")); $group->input("title")->label($input1_lbl)->id("title"); $group->input("initials")->label($input2_lbl)->id("initials"); $group->input("insertion")->label($input3_lbl)->id("insertion"); $group->input("fname")->label($input4_lbl)->id("fname"); $group->input("street")->label($input5_lbl)->id("street"); $group->input("house")->label($input6_lbl)->id("house"); //show field only when configured if (basket_plus::getBasketVar(USE_ADDRESS_SUBURB)) { $group->input("suburb")->label($input7_lbl)->id("suburb"); } else { $group->hidden("suburb")->id("suburb"); } $group->input("postalcode")->label($input8_lbl)->id("postalcode"); $group->input("town")->label($input9_lbl)->id("town"); //show field only when configured if (basket_plus::getBasketVar(USE_ADDRESS_PROVINCE)) { $group->input("province")->label($input17_lbl)->id("province"); } else { $group->hidden("province")->id("province"); } //show field only when configured if (basket_plus::getBasketVar(USE_ADDRESS_COUNTRY)) { $group->input("country")->label($input18_lbl)->id("country"); } else { $group->hidden("country")->id("country"); } $group->input("email")->label($input10_lbl)->id("email"); $group->input("phone")->label($input11_lbl)->id("phone"); //show reference fields only with pickup if ($pickup && $postage > 0) { $group->input("order_ref1")->label($input12_lbl)->id("order_ref1"); $group->input("order_ref2")->label($input13_lbl)->id("order_ref2"); } else { $group->hidden("order_ref1")->label($input12_lbl)->id("order_ref1"); $group->hidden("order_ref2")->label($input13_lbl)->id("order_ref2"); } $group->input("comments")->label($input14_lbl)->id("comments"); $group->checkbox("agreeterms")->label($input15_lbl)->id("agreeterms"); //show field only when configured if (basket_plus::getBasketVar(USE_PAYPAL)) { $group->checkbox("paypal")->label($input16_lbl)->id("paypal"); } else { $group->hidden("paypal")->id("paypal"); } return $form; }