Ejemplo n.º 1
0
 static function get_edit_form_admin($product)
 {
     $form = new Forge("admin/product_lines/edit_product/{$product->id}", "", "post", array("id" => "gEditProductForm"));
     $group = $form->group("edit_product")->label(t("Edit Product"));
     $group->input("name")->label(t("Name"))->id("gProductName")->value($product->name);
     $group->inputs["name"]->error_messages("in_use", t("There is already a product with that name"));
     $group->input("cost")->label(t("Cost"))->id("gCost")->value($product->cost);
     $group->input("description")->label(t("Description"))->id("gDescription")->value($product->description);
     $group->dropdown("postage_band")->label(t("Postage Band"))->options(bp_postage_band::getPostageArray())->selected($product->bp_postage_band_id);
     $group->submit("")->value(t("Modify Product"));
     return $form;
 }
 static function initBasketProducts($language, $isReset)
 {
     $db = Database::instance();
     //if it's a reset request, empty the tables
     if ($isReset) {
         $db->query("DELETE FROM {bp_postage_bands}");
         $db->query("DELETE FROM {bp_products}");
         $db->query("DELETE FROM {bp_product_overrides}");
         $db->query("DELETE FROM {bp_item_products}");
     }
     //Add postage_bands if the table is empty
     $postage_band = ORM::factory("bp_postage_band")->where("id", "=", 1)->find();
     if (!$postage_band->loaded()) {
         //==========================
         // SETTINGS FOR ENGLISH
         if ($language == "en_US" or $language == "en_UK") {
             // name, fixed cost, per item cost, is download
             bp_postage_band::create("No posting cost", 0, 0, false);
             bp_postage_band::create("Default posting cost", 2, 0, false);
             bp_postage_band::create("Posting by e-mail (free)", 0, 0, true);
         } elseif ($language == "nl_NL") {
             // name, fixed cost, per item cost, is download
             bp_postage_band::create("Geen verzendkosten", 0, 0, false);
             bp_postage_band::create("Standaard verzendkosten", 2, 0, false);
             bp_postage_band::create("Verzending via e-mail (gratis)", 0, 0, true);
         }
     }
     //Add products if the table is empty
     $product = ORM::factory("bp_product")->where("id", "=", 1)->find();
     if (!$product->loaded()) {
         //==========================
         // SETTINGS FOR ENGLISH
         if ($language == "en_US" or $language == "en_UK") {
             //get posting band id for mail
             $postage = ORM::factory("bp_postage_band")->where("name", "=", "Default posting cost")->find();
             // name, cost, descr, postageband id
             bp_product::create("4x6", 6, "Print 4x6 inch glossy", $postage->id);
             bp_product::create("8x10", 9, "Print 8x10 inch glossy", $postage->id);
             //get posting band id for e-mail
             $postage = ORM::factory("bp_postage_band")->where("name", "=", "Posting by e-mail (free)")->find();
             bp_product::create("Original", 10, "Original high resolution photo file", $postage->id);
         } elseif ($language == "nl_NL") {
             //get posting band id for mail
             $postage = ORM::factory("bp_postage_band")->where("name", "=", "Standaard verzendkosten")->find();
             // name, cost, descr, postageband id
             bp_product::create("13x18", 6, "Afdruk 13x18 cm glanzend", $postage->id);
             bp_product::create("20x30", 9, "Afdruk 20x30 cm glanzend", $postage->id);
             //get posting band id for e-mail
             $postage = ORM::factory("bp_postage_band")->where("name", "=", "Verzending via e-mail (gratis)")->find();
             bp_product::create("Origineel", 10, "Originele fotobestand in hoge resolutie", $postage->id);
         }
     }
 }
 public function edit_postage_band_form($id)
 {
     $postage = ORM::factory("bp_postage_band", $id);
     if (!$postage->loaded()) {
         kohana::show_404();
     }
     $form = bp_postage_band::get_edit_form_admin($postage);
     print $form;
 }