static function upgrade($version) { $db = Database::instance(); if ($version == 1) { // fix for allowing decimel place in money $db->query("ALTER TABLE {products} CHANGE COLUMN `cost` `cost` DECIMAL(10,2) default 0;"); $db->query("ALTER TABLE {item_products} CHANGE COLUMN `cost` `cost` DECIMAL(10,2) default -1;"); // postage bands $db->query("ALTER TABLE {products} ADD COLUMN `postage_band_id` int(9) default 1"); $db->query("CREATE TABLE IF NOT EXISTS {postage_bands} (\n `id` int(9) NOT NULL auto_increment,\n `name` TEXT NOT NULL,\n `flat_rate` DECIMAL(10,2) default 0,\n `per_item` DECIMAL(10,2) default 0,\n PRIMARY KEY (`id`))\n ENGINE=InnoDB DEFAULT CHARSET=utf8;"); postage_band::create("No Postage", 0, 0); module::set_version("basket", $version = 2); } if ($version == 2) { $db->query("CREATE TABLE IF NOT EXISTS {orders} (\n `id` int(9) NOT NULL auto_increment,\n `text` TEXT NOT NULL,\n PRIMARY KEY (`id`))\n ENGINE=InnoDB DEFAULT CHARSET=utf8;"); basket::setPaymentDetails("<p>Use the following options to pay for this order.</p>\n<p>Send a chequre to..</p>\n<p>Visit the shop..</p>\n<p>By using internet banking..</p>"); basket::setOrderPrefix("ORDER"); basket::setOrderCompletePage("<p>Your order number is %order_number. To pay for this order please either:</p>\n<p> - Send a cheque for %total_cost to with reference %order_number..</p>\n<p> - Visit the shop and quote the order %order_number..</p>\n<p> - Transfer %total_cost using internet banking with reference %order_number..</p>\n<p>Order will be processed as soon as payment is received. You should receive an e-mail with your order details shortly.</p>"); basket::setOrderCompleteEmail("Hi %name,\n\nThank you for your order the order details are below. To pay for this order please either:\n\n- Send a cheque for %total_cost to with reference %order_number..\n- Visit the shop and quote the order %order_number..\n- Transfer %total_cost using internet banking with reference %order_number..\n\nOrder will be processed as soon as payment is received. For order pick-ups please visit..\n\nOrder Details\n-------------\n%order_details\n\nThanks"); basket::setOrderCompleteEmailSubject("Photography Order %order_number"); module::set_version("basket", $version = 3); } if ($version == 3) { $db->query("ALTER TABLE {orders} ADD COLUMN `status` int(9) DEFAULT 0;"); $db->query("CREATE TABLE IF NOT EXISTS {ipn_messages} (\n `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,\n `date` int(11) NOT NULL,\n `key` varchar(20) NOT NULL,\n `txn_id` varchar(20) NOT NULL,\n `status` varchar(20) NOT NULL,\n `success` bool default false,\n `text` text,\n PRIMARY KEY (`id`)\n ) ENGINE=InnoDB DEFAULT CHARSET=utf8;"); module::set_version("basket", $version = 4); } if ($version == 4) { $db->query("ALTER TABLE {orders} ADD COLUMN `name` varchar(1024);"); $db->query("ALTER TABLE {orders} ADD COLUMN `email` varchar(1024);"); $db->query("ALTER TABLE {orders} ADD COLUMN `method` int(9) DEFAULT 0;"); $db->query("ALTER TABLE {orders} ADD COLUMN `cost` DECIMAL(10,2) default 0"); module::set_version("basket", $version = 5); } }
static function extractForm($form) { $webshop = $form->configure->webshop->value; $website = $form->configure->website->value; $email = $form->configure->email->value; $is_side_bar = $form->configure->side_bar->value; $isPaypal = $form->configure->paypal->value; $paypal_account = $form->configure->paypal_account->value; $currency = $form->configure->currency->selected; $allow_pickup = $form->configure->allow_pickup->value; $pickup_location = $form->configure->pickup_location->value; $order_prefix = $form->configure->order_prefix->value; $order_bankaccount = $form->configure->order_bankaccount->value; $order_accountowner = $form->configure->order_accountowner->value; basket::setWebshop($webshop); basket::setWebsite($website); basket::setEmailAddress($email); basket::set_side_bar_only($is_side_bar); basket::setPaypal($isPaypal); basket::setPaypalAccount($paypal_account); basket::setCurrency($currency); basket::setAllowPickup($allow_pickup); basket::setPickupLocation($pickup_location); basket::setOrderPrefix($order_prefix); basket::setOrderBankAccount($order_bankaccount); basket::setOrderAccountOwner($order_accountowner); }
static function extractForm($form) { $email = $form->configure->email->value; $is_side_bar = $form->configure->side_bar->value; $isPaypal = $form->configure->paypal->value; $paypal_account = $form->configure->paypal_account->value; $currency = $form->configure->currency->selected; $allow_pickup = $form->configure->allow_pickup->value; $order_prefix = $form->configure->order_prefix->value; basket::setEmailAddress($email); basket::set_side_bar_only($is_side_bar); basket::setPaypal($isPaypal); basket::setPaypalAccount($paypal_account); basket::setCurrency($currency); basket::setAllowPickup($allow_pickup); basket::setOrderPrefix($order_prefix); }