static function photo_top($theme)
 {
     if (!basket_plus::getBasketVar(USE_SIDE_BAR_ONLY)) {
         if (bp_product::isForSale($theme->item()->id)) {
             $view = new View("add_to_basket.html");
             $view->item = $theme->item();
             return $view->render();
         }
     }
     return "";
 }
 /**
  * the index page of the user homes admin
  */
 public function templates()
 {
     $form = basket_plus::get_template_form();
     if (request::method() == "post") {
         access::verify_csrf();
         if ($form->validate()) {
             basket_plus::extractTemplateForm($form);
             message::success(t("Basket Module Configured!"));
         }
     } else {
         basket_plus::populateTemplateForm($form);
     }
     $view = new Admin_View("admin.html");
     $view->content = new View("admin_templates.html");
     $view->content->form = $form;
     print $view;
 }
 static function install()
 {
     $db = Database::instance();
     //===========================================================
     // Create the basket tables
     //===========================================================
     //add table postage_bands
     $db->query("CREATE TABLE IF NOT EXISTS {bp_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                 `via_download` BOOLEAN default false,\n                 PRIMARY KEY (`id`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
     //add table products
     $db->query("CREATE TABLE IF NOT EXISTS {bp_products} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `name` TEXT NOT NULL,\n                 `cost` DECIMAL(10,2) default 0,\n                 `description` varchar(1024),\n                 `bp_postage_band_id` int(9) default 1,\n                 PRIMARY KEY (`id`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
     //add table product_overrides
     $db->query("CREATE TABLE IF NOT EXISTS {bp_product_overrides} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `item_id` int(9) NOT NULL,\n                 `none` BOOLEAN default false,\n                 PRIMARY KEY (`id`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
     //add table item_products
     $db->query("CREATE TABLE IF NOT EXISTS {bp_item_products} (\n                 `id` int(9) NOT NULL auto_increment,\n                 `product_override_id` int(9) NOT NULL,\n                 `product_id` int(9) NOT NULL,\n                 `include` BOOLEAN default false,\n                 `cost` DECIMAL(10,2) default -1,\n                 PRIMARY KEY (`id`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
     //add table ipn_messages
     $db->query("CREATE TABLE IF NOT EXISTS {bp_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;");
     //add table orders
     //@TODO: create 'order lines' and create reference from order
     $db->query("CREATE TABLE IF NOT EXISTS {bp_orders} (\n                `id` int(9) NOT NULL auto_increment,\n                `customerid` int(9) NOT NULL,\n\t\t\t\t\t\t\t\t`status` int(9) DEFAULT 0,\n                `name` varchar(512),\n                `email` varchar(256),\n                `cost` DECIMAL(10,2) default 0,\n                `payment_method` int(9) DEFAULT 0,\n                `delivery_method` int(9) DEFAULT 0,\n                `text` mediumtext NOT NULL,\n\t\t\t\t\t\t\t\t`internal_text` varchar(2048),\n                PRIMARY KEY (`id`))\n                ENGINE=InnoDB DEFAULT CHARSET=utf8;");
     //add table customers
     $db->query("CREATE TABLE IF NOT EXISTS {bp_customers} (\n                `id` int(9) NOT NULL AUTO_INCREMENT,\n                `title` varchar(32) DEFAULT NULL,\n                `name` varchar(256) NOT NULL,\n                `initials` varchar(64) DEFAULT NULL,\n                `insertion` varchar(16) DEFAULT NULL,\n                `street` varchar(128) DEFAULT NULL,\n                `housenumber` varchar(32) DEFAULT NULL,\n                `postalcode` varchar(16) DEFAULT NULL,\n                `suburb` varchar(128) DEFAULT NULL,\n                `town` varchar(128) DEFAULT NULL,\n                `province` varchar(128) DEFAULT NULL,\n                `country` varchar(128) DEFAULT NULL,\n                `email` varchar(128) NOT NULL,\n                `phone` varchar(16) DEFAULT NULL,\n                `order_ref1` varchar(64) DEFAULT NULL,\n                `order_ref2` varchar(32) DEFAULT NULL,\n                `deliverypref` tinyint(2) DEFAULT NULL,\n                 PRIMARY KEY (`id`))\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
     //add table order_logs
     $db->query("CREATE TABLE IF NOT EXISTS {bp_order_logs} (\n                 `id` int(9) NOT NULL,\n                 `status` int(9) NOT NULL,\n                 `event` int(9) NOT NULL,\n                 `timestamp` int(9) NOT NULL)\n                 ENGINE=InnoDB DEFAULT CHARSET=utf8;");
     //add table user_baskets
     $db->query("CREATE TABLE IF NOT EXISTS {bp_user_baskets} (\n                  `id` int(9) NOT NULL,\n\t\t\t\t\t\t\t\t\t`is_group` BOOLEAN default false,\n                  `pickup_location` varchar(64) default NULL,\n                  `extra_order_info_lbl` varchar(32) default NULL,\n                  `extra_order_info` varchar(32) default NULL,\n                  `extra_order_info2` varchar(32) default NULL,\n                  `extra_order_info_lbl2` varchar(32) default NULL,\n                  PRIMARY KEY (`id`),\n                  UNIQUE KEY(`id`))\n                  DEFAULT CHARSET=utf8;");
     //add table email_templates
     $db->query("CREATE TABLE IF NOT EXISTS {bp_email_templates} (\n                  `id` int(9) NOT NULL AUTO_INCREMENT,\n                  `name` varchar(32) NOT NULL,\n                  `email_text` varchar(2048) default NULL,\n                  `email_html` mediumtext default NULL,\n                  PRIMARY KEY (`id`),\n                  UNIQUE KEY(`id`))\n                  DEFAULT CHARSET=utf8;");
     //Set fixed basket variables
     basket_plus::setBasketVar("meta_tag", str_replace('$', '"', '<meta http-equiv=$Content-Type$ content=$text/html; charset=UTF-8$ />'));
     //Initialise basket variables in the default language
     //error_reporting(E_ALL);
     $language = module::get_var("gallery", "default_locale");
     $is_reset = true;
     basket_plus_installer_local::initBasketProducts($language, $is_reset);
     basket_plus_installer_local::initBasketMailTemplates($language, $is_reset);
     basket_plus_installer_local::initBasketVars($language, $is_reset);
     //do the module administration
     module::set_version('basket_plus', 1);
 }
 static function send_cancellation_confirmation($order)
 {
     basket_plus::send_order_update($order, ORDER_CANCELLED_EMAIL_SUBJECT, ORDER_CANCELLED_EMAIL);
 }
 public function paypal_complete($id)
 {
     $order = ORM::factory("bp_order")->where("id", "=", $id)->find();
     $order->status = Bp_Order_Model::PAYMENT_CONFIRMED;
     $order->save();
     bp_order_log::log($order, Bp_Order_Log_Model::PAID);
     // Send payment confirmation
     basket_plus::send_payment_confirmation($order);
     // house keeping
     $basket = Session_Basket::get();
     $basket->clear();
     $this->_complete($order);
 }
 function validate_ipn($key)
 {
     // parse the paypal URL
     $url_parsed = parse_url($this->paypal_url);
     // generate the post string from the _POST vars as well as load the
     // _POST vars into an array so we can play with them from the calling
     // script.
     $post_string = 'cmd=_notify-validate';
     foreach ($_POST as $field => $value) {
         $this->ipn_data["{$field}"] = $value;
         $value = urlencode(stripslashes($value));
         $value = preg_replace('/(.*[^%^0^D])(%0A)(.*)/i', '${1}%0D%0A${3}', $value);
         $post_string .= '&' . $field . '=' . $value;
     }
     // open the connection to paypal
     $fp = fsockopen($this->secure_url, 443, $err_num, $err_str, 30);
     if (!$fp) {
         // could not open the connection.  If logging is on, the error message
         // will be in the log.
         $this->last_error = "fsockopen error no. {$errnum}: {$errstr}";
         $this->log_ipn_results($key, false);
         return false;
     } else {
         // Post the data back to paypal
         fputs($fp, "POST " . $url_parsed['path'] . " HTTP/1.1\r\n");
         fputs($fp, "Host: " . $url_parsed['host'] . "\r\n");
         fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
         fputs($fp, "Content-length: " . strlen($post_string) . "\r\n\r\n");
         //fputs($fp, "Connection: close\r\n\r\n");
         fputs($fp, $post_string . "\r\n\r\n");
         // loop through the response from the server and append to variable
         while (!feof($fp)) {
             $this->ipn_response .= fgets($fp, 1024);
         }
         fclose($fp);
         // close connection
     }
     if (stristr($this->ipn_response, "VERIFIED") === false) {
         // Invalid IPN transaction.  Check the log for details.
         $this->last_error = 'IPN Validation Failed. ' . $url_parsed['host'] . '\\' . $url_parsed['path'];
         $this->log_ipn_results($key, false);
         return false;
     } else {
         // Valid IPN transaction.
         // check recievers e-mail
         $business = basket_plus::getBasketVar(PAYPAL_ACCOUNT);
         if ($this->ipn_data['receiver_email'] != $business) {
             $this->last_error = 'receivers e-mail did not match ' . $business;
             $this->log_ipn_results($key, false);
             return false;
         }
         // if confirmed check message has not been received already
         if ($this->ipn_data['payment_status'] == "Completed") {
             $message = ORM::factory("bp_ipn_message")->where('key', "=", $key)->where('status', "=", 'completed')->where('txn_id', "=", $this->ipn_data['txn_id'])->find();
             if ($message->loaded()) {
                 $this->last_error = 'Message already received.';
                 $this->log_ipn_results($key, false);
                 return false;
             }
         }
         $this->log_ipn_results($key, true);
         return true;
     }
 }
 public function clear()
 {
     if (isset($this->contents)) {
         foreach ($this->contents as $key => $item) {
             unset($this->contents[$key]);
         }
     }
     // get default pickup setting
     $this->pickup = basket_plus::getBasketVar(IS_PICKUP_DEFAULT);
 }
" 
									class="g-button2"><span class="ui-icon ui-icon-trash"></span></a></td>
							</tr>
						<?php 
        }
        ?>
					<tr class="<?php 
        echo text::alternate("gOddRow", "gEvenRow");
        ?>
">
						<td><b><?php 
        echo t("Total");
        ?>
</b></td>
						<td id="total"><b><?php 
        echo $basket->pickup ? basket_plus::formatMoneyForWeb($total + $postage) : basket_plus::formatMoneyForWeb($total);
        ?>
</b></td>
						<td></td>
					</tr>
				</table>
			</div><br/>
			<p><a class="g-button right ui-icon-left ui-state-default ui-corner-all ui-state-hover" 
				href="<?php 
        echo url::site("basket_plus/view_basket");
        ?>
" title="<?php 
        echo t("Checkout");
        ?>
">
				<span class="ui-icon ui-icon-cart"></span><?php 
</b></td>
          <td></td>
          <td style="text-align:right;" id="total"><b><?php 
    echo $basket->pickup ? basket_plus::formatMoneyForWeb($total) : basket_plus::formatMoneyForWeb($total + $postage);
    ?>
</b></td>
          <td></td>
        </tr>
        <?php 
    /* line with pickup choice: show only when postage > 0; when pickup is changed, trigger script (see top) */
    ?>
        <?php 
    if ($postage > 0) {
        ?>
          <?php 
        if (basket_plus::getBasketVar(ALLOW_PICKUP)) {
            ?>
            <tr class="bp-table-noborder">
              <td colspan="5"><input id="pickup" type="checkbox" <?php 
            echo $basket->pickup ? "checked" : "";
            ?>
/><?php 
            echo t(" Select if you wish to pick up the photos.");
            ?>
</td>
            </tr>
          <?php 
        }
        ?>
        <?php 
    }
<?php

defined("SYSPATH") or die("No direct script access.");
?>

<?php 
if ($theme->page_type != 'basket') {
    ?>
  <?php 
    if (basket_plus::can_view_orders()) {
        ?>
			<a href="<?php 
        echo url::site("basket_plus/view_Orders");
        ?>
"
				 title="<?php 
        echo t("View Orders");
        ?>
">View Orders</a>
  <?php 
    }
    ?>
  <?php 
    if (isset($basket) && isset($basket->contents) && $basket->size() > 0) {
        ?>
		<div id="basket">
				<a href="<?php 
        echo url::site("basket_plus/view_basket");
        ?>
"
					 title="<?php 
    echo $product->id;
    ?>
" class="<?php 
    echo text::alternate("gOddRow", "gEvenRow");
    ?>
">
        <td id="product-<?php 
    echo $product->id;
    ?>
" class="core-info ">
          <?php 
    echo html::clean($product->name);
    ?>
</td>
        <td><?php 
    echo basket_plus::formatMoneyForWeb($product->cost);
    ?>
</td>
        <td><?php 
    echo html::clean($product->description);
    ?>
</td>
        <td><?php 
    echo html::clean($product->bp_postage_band->name);
    ?>
</td>
        <td class="g-actions"><a href="<?php 
    echo url::site("admin/product_lines/edit_product_form/{$product->id}");
    ?>
"
          open_text="<?php 
    echo text::alternate("gOddRow", "gEvenRow");
    ?>
">
        <td id="product-<?php 
    echo $postage_band->id;
    ?>
" class="core-info "><?php 
    echo html::clean($postage_band->name);
    ?>
</td>
				<td><?php 
    echo basket_plus::formatMoneyForWeb($postage_band->flat_rate);
    ?>
</td>
				<td><?php 
    echo basket_plus::formatMoneyForWeb($postage_band->per_item);
    ?>
</td>
        <td class="core-info "><input id="via_download" type="checkbox" disabled="disabled" 
								<?php 
    if ($postage_band->via_download) {
        ?>
checked="checked"<?php 
    }
    ?>
				/></td>
				<td class="g-actions"><a href="<?php 
    echo url::site("admin/postage_bands/edit_postage_band_form/{$postage_band->id}");
    ?>
"
          open_text="<?php 
				<?php 
echo basket_plus::getDeliveryMethodHtml($delivery_method, $label_strong);
?>
				<?php 
if ($basket->paypal) {
    $payment_method = Bp_Order_Model::PAYMENT_PAYPAL;
    ?>
				<?php 
} else {
    $payment_method = Bp_Order_Model::PAYMENT_OFFLINE;
    ?>
				<?php 
}
?>
				<?php 
echo basket_plus::getPaymentMethodHtml($payment_method, $label_strong);
?>
				<br/>	
				<?php 
if ($basket->order_ref1 != "") {
    $user = identity::active_user();
    $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 == "") {
        $extra_order_info_lbl = t("Order reference");
    }
    ?>
						<strong><?php 
    echo t($extra_order_info_lbl);
    ?>
</strong>:&nbsp;<?php 
 static function getProductArray($id)
 {
     $producta = array();
     // check for product override
     $product_override = ORM::factory("bp_product_override")->where('item_id', "=", $id)->find();
     if (!$product_override->loaded()) {
         // no override found so check parents
         // check parents for product override
         $item = ORM::factory("item", $id);
         $parents = $item->parents();
         foreach ($parents as $parent) {
             // check for product override
             $temp_override = ORM::factory("bp_product_override")->where('item_id', "=", $parent->id)->find();
             if ($temp_override->loaded()) {
                 $product_override = $temp_override;
                 //break;
             }
         }
     }
     $products = ORM::factory("bp_product")->find_all();
     foreach ($products as $product) {
         $show = true;
         $cost = $product->cost;
         if ($product_override->loaded()) {
             $show = !$product_override->none;
             $item_product = ORM::factory("bp_item_product")->where('product_override_id', "=", $product_override->id)->where('product_id', "=", $product->id)->find();
             if ($item_product->loaded()) {
                 $cost = $item_product->cost;
                 if (!$show) {
                     $show = $item_product->include;
                 }
             }
         }
         if ($show) {
             $producta[$product->id] = html::clean($product->description) . " (" . basket_plus::formatMoneyForWeb($cost) . ")";
         }
     }
     return $producta;
 }
        }
      }
    }
  }
</SCRIPT>

<div class="g-block">
<h2><?php 
echo t("Delivery and Contact (Step 1 of 3)");
?>
</h2>
  <div id="b-complete">
  <?php 
$payment_details = basket_plus::getBasketVar(PAYMENT_OPTIONS);
$webshop = basket_plus::getBasketVar(WEBSHOP);
$payment_details = basket_plus::replaceStrings($payment_details, array("webshop" => $webshop));
/* here the payment options text is loaded */
if ($payment_details) {
    ?>
    <div class="basket-right" id="payment">
      <h3> <?php 
    echo t("Payment Options");
    ?>
</h3>
      <?php 
    echo $payment_details;
    ?>
    </div>
  <?php 
}
/* here the form is loaded */
    $total = $total + $order->cost;
}
?>
      <tr class="order-status-<?php 
echo $order->status;
?>
">
        <td></td>
        <td></td>
        <td></td>
        <td style="text-align:right;"><b><?php 
echo t("Total");
?>
</b></td>
        <td style="text-align:right;"><b><?php 
echo basket_plus::formatMoneyForWeb($total);
?>
</b></td>
      </tr>     
  </table>
</div>
<div class="scrollable" style="text-align:left;float:left;padding:0;font-size:12px;display:block;"><pre id="order_text"></pre>
</div>

<SCRIPT language="JavaScript">
var doc,printButton,orderText,csrf;
$(window).load(new function(){
  doc=document.show_order;
  printButton=$("#print_button");
  orderText=$("#order_text");
  csrf="?csrf="+doc.csrf.value
    static function initBasketVars($language, $isReset)
    {
        $db = Database::instance();
        /* basket config settings */
        if ($isReset) {
            $db->query("DELETE FROM {vars} WHERE `module_name`='basket_plus'");
        }
        //==========================
        // SETTINGS FOR ENGLISH
        if ($language == "en_US" or $language == "en_UK") {
            basket_plus::setBasketVar(WEBSITE, "www.basketplusphoto.com");
            basket_plus::setBasketVar(WEBSHOP, "BasketPlusPhoto.com");
            basket_plus::setBasketVar(WEBSHOP_OWNER, "Photographer Mr X");
            basket_plus::setBasketVar(WEBSHOP_ADDRESS, "999, A-Street");
            basket_plus::setBasketVar(WEBSHOP_POSTALCODE, "99999");
            basket_plus::setBasketVar(WEBSHOP_CITY, "Photo City Photo Country");
            basket_plus::setBasketVar(WEBSHOP_PHONE, "555 1234");
            basket_plus::setBasketVar(WEBSHOP_DETAILS, "<strong>%webshop</strong><br />\n<strong>%webshop_owner</strong><br />\n%webshop_address<br />\n%webshop_postalcode %webshop_city<br />\n<br />\n<strong>Contact</strong><br />\n%email_contact<br />\n%webshop_phone");
            basket_plus::setBasketVar(EMAIL_FROM, "BasketPlusPhoto.com <*****@*****.**>");
            basket_plus::setBasketVar(EMAIL_ORDER, "order@basketplusphoto.com, 999 A-Street Photo City Photo Country");
            basket_plus::setBasketVar(EMAIL_CONTACT, "*****@*****.**");
            basket_plus::setBasketVar(CURRENCY, "USD");
            basket_plus::setBasketVar(DATE_TIME_FORMAT, "m/d/Y g:i A");
            basket_plus::setBasketVar(DECIMAL_SEPARATOR, ".");
            basket_plus::setBasketVar(USE_SIDE_BAR_ONLY, "1");
            basket_plus::setBasketVar(ALLOW_PICKUP, "1");
            basket_plus::setBasketVar(IS_PICKUP_DEFAULT, "0");
            basket_plus::setBasketVar(PICKUP_LOCATION, "BasketPlusPhoto.com, Order desk");
            basket_plus::setBasketVar(USE_PAYPAL, "1");
            basket_plus::setBasketVar(PAYPAL_ACCOUNT, "*****@*****.**");
            basket_plus::setBasketVar(PAYPAL_TEST_MODE, "1");
            basket_plus::setBasketVar(ORDER_PREFIX, "2013-");
            basket_plus::setBasketVar(ORDER_BANK_ACCOUNT, "1234567890");
            basket_plus::setBasketVar(ORDER_BANK_ACCOUNT_OWNER, "Photographer");
            basket_plus::setBasketVar(PAYMENT_OPTIONS, str_replace('$', '"', '<p>Please fulfil the order payment by transferring the order amount into the bank account of %webshop.<br />
You will find payment instructions in the order confirmation e-mail.</p>
<br />
<h3>General Terms</h3>
<p>Our General Terms are available for review under <a href=$/downloads/General_Terms_2013.pdf$ target=$_blank$>this link</a>.</p>'));
            basket_plus::setBasketVar(ADDRESS_FORMAT, "%house %street %suburb<br />\n%town %province %postalcode<br />\n%country<br />");
            basket_plus::setBasketVar(USE_ADDRESS_SUBURB, "1");
            basket_plus::setBasketVar(USE_ADDRESS_PROVINCE, "1");
            basket_plus::setBasketVar(USE_ADDRESS_COUNTRY, "1");
            /* basket template settings */
            basket_plus::setBasketVar(PAYMENT_DETAILS, str_replace('$', '"', '<h3 class="h3">Payment</h3>
															<p style="font-family: verdana, sans-serif; font-size: 11px; color: rgb(80, 84, 80); line-height: 19px; border: none; margin-top: 5px; vertical-align: top;">
																Please fulfil the order payment by transferring the order amount into the bank account of %webshop.<br /><br />
																Total amount: <strong>%total_cost</strong><br />
																Bank account: <strong>%order_bank_account</strong><br />
																 in the name of: <strong>%order_bank_account_owner</strong><br />
																 reference: <strong>order number %order_number</strong><br />
															</p>'));
            basket_plus::setBasketVar(CUSTOMER_DETAILS, " %full_name<br />\n %address<br />\n E-mail: %email<br />\n Phone: %phone<br />");
            basket_plus::setBasketVar(ORDER_COMPLETE_PAGE, "<p>Thank you for your order. Your order number is </b>%order_number</b>.</p>\n<br />\n<p>%webshop has sent a confirmation e-mail with the order details and payment instructions.</p>\n<p>We will process your order when the payment has been received.</p>");
            basket_plus::setBasketVar(ORDER_PAID_COMPLETE_PAGE, "<p>Thank you for your order. Your order number is </b>%order_number</b>.</p>\n<br />\n<p>%webshop has sent a confirmation e-mail with the order details.</p>\n<p>Your payment has been received. You will receive an e-mail when the order is delivered or ready for pickup.</p>");
            basket_plus::setBasketVar(ORDER_THANKYOU, "Dear %full_name,<br>\n<br>\nThank you for your order. Below, you find the order details and payment instructions.<br>\nDelivery is expected in 10 working days after receival of the payment by %webshop.<br>\n<br>\n%order_email_closing");
            basket_plus::setBasketVar(ORDER_DETAILS, '<h3 class="h3">Order details</h3>
<p>
	Order number: <strong>%order_number</strong><br />
	Ordered on: <strong>%order_datetime</strong><br />
	<br>
	<strong>Order for</strong><br />
	%customer_details <!-- // replace with html -->
	%cost_details <!-- // replace with html -->
	%delivery_method <!-- // replace with html -->
	%comments <!-- // displayed only if the customer provided comments AND/OR ref/ref2 is filled\\-->															
</p>');
            basket_plus::setBasketVar(ORDER_COMPLETE_EMAIL_SUBJECT, "Your order %order_number with %webshop");
            basket_plus::setBasketVar(ORDER_PAID_EMAIL_SUBJECT, "Update of your order %order_number with %webshop: payment received");
            basket_plus::setBasketVar(ORDER_PAID_EMAIL, "Dear %name,<br>\n<br>\n%webshop received your payment of %total_cost and will process order %order_number. <br>\nYou will receive an e-mail when the order is delivered or ready for pickup. <br>\n<br>\n%order_email_closing");
            basket_plus::setBasketVar(ORDER_PAID_DELIVERED_EMAIL_SUBJECT, "Update of your order %order_number with %webshop: payment received");
            basket_plus::setBasketVar(ORDER_PAID_DELIVERED_EMAIL, "Dear %name,<br>\n<br>\n%webshop received your payment of %total_cost. The order has already been delivered.<br>\nWe'd like to thank you again for your order and wish you happy photo viewing!<br>\n<br>\n%order_email_closing");
            basket_plus::setBasketVar(ORDER_LATE_PAYMENT_EMAIL_SUBJECT, "Update of your order %order_number with %webshop: waiting payment");
            basket_plus::setBasketVar(ORDER_LATE_PAYMENT_EMAIL, "Dear %name,<br>\n<br>\nSome time ago, you ordered at %webshop order %order_number.<br>\nOur records show that the amount of <strong>%total_cost</strong> has not been fulfilled yet. Please note that we will only process your order when the payment has been received.<br>\n<br>\nYou can transfer the amount due into the bank account <strong>%order_bank_account</strong> in the name of <strong>%order_bank_account_owner</strong> with reference to <strong>order number %order_number</strong>.<br>\n<br>\nIf you have already sent this payment, please disregard this notice.<br>\n<br>\n%order_email_closing");
            basket_plus::setBasketVar(ORDER_DELIVERED_EMAIL_SUBJECT, "Update of your order %order_number with %webshop: order shipped");
            basket_plus::setBasketVar(ORDER_DELIVERED_EMAIL, "Dear %name,<br>\n<br>\nYour order %order_number has been %delivery_method. <br>\nWe'd like to thank you again for your order and wish you happy photo viewing!<br>\n<br>\n%order_email_closing");
            basket_plus::setBasketVar(ORDER_DELIVERED_NOTPAID_EMAIL_SUBJECT, "Update of your order %order_number with %webshop: order shipped without payment");
            basket_plus::setBasketVar(ORDER_DELIVERED_NOTPAID_EMAIL, "Dear %name,<br>\n<br>\nYour order %order_number has been %delivery_method, although the amount of %total_cost has not been fulfilled according to our records. <br>\n<br>\nYou can transfer the amount due into the bank account <strong>%order_bank_account</strong> in the name of <strong>%order_bank_account_owner</strong> with reference to <strong>order number %order_number</strong>.<br>\n<br>\nIf you have already sent this payment, please disregard this notice.<br>\n<br>\n%order_email_closing");
            basket_plus::setBasketVar(ORDER_DELAYED_EMAIL_SUBJECT, "Update of your order %order_number with %webshop: order delayed");
            basket_plus::setBasketVar(ORDER_DELAYED_EMAIL, "Dear %name,<br>\n<br>\nYour order %order_number has been delayed due to unexpected circumstances.<br> \nWe apologize for the delay and will do our very best to deliver you order as soon as possible.<br>");
            basket_plus::setBasketVar(ORDER_CANCELLED_EMAIL_SUBJECT, "Update of your order %order_number with %webshop: order cancelled");
            basket_plus::setBasketVar(ORDER_CANCELLED_EMAIL, "Dear %name,<br>\n<br>\n%Your order %order_number has been cancelled.<br>\n<br>\n%order_email_closing");
            basket_plus::setBasketVar(ORDER_EMAIL_CLOSING, "If you have any questions or remarks, please contact us by e-mail on %email_order.<br>\n<br>\nWith kind regards,<br>\n%webshop - %webshop_owner");
        } elseif ($language == "nl_NL") {
            basket_plus::setBasketVar(WEBSITE, "www.basketplusphoto.com");
            basket_plus::setBasketVar(WEBSHOP, "BasketPlusPhoto.com");
            basket_plus::setBasketVar(WEBSHOP_OWNER, "Fotograaf Basket Plus");
            basket_plus::setBasketVar(WEBSHOP_ADDRESS, "Postlaan 1");
            basket_plus::setBasketVar(WEBSHOP_POSTALCODE, "8888 ZZ");
            basket_plus::setBasketVar(WEBSHOP_CITY, "Poststad");
            basket_plus::setBasketVar(WEBSHOP_PHONE, "06-1122 3344");
            basket_plus::setBasketVar(WEBSHOP_DETAILS, "<strong>%webshop</strong><br />\n<strong>%webshop_owner</strong><br />\n%webshop_address<br />\n%webshop_postalcode %webshop_city<br />\n<br />\n<strong>Contact</strong><br />\n%email_contact<br />\n%webshop_phone");
            basket_plus::setBasketVar(EMAIL_FROM, "BasketPlusPhoto.com <*****@*****.**>");
            basket_plus::setBasketVar(EMAIL_ORDER, "*****@*****.**");
            basket_plus::setBasketVar(EMAIL_CONTACT, "*****@*****.**");
            basket_plus::setBasketVar(USE_SIDE_BAR_ONLY, "1");
            basket_plus::setBasketVar(CURRENCY, "EUR");
            basket_plus::setBasketVar(DATE_TIME_FORMAT, "d-m-Y G:i");
            basket_plus::setBasketVar(DECIMAL_SEPARATOR, ",");
            basket_plus::setBasketVar(ALLOW_PICKUP, "1");
            basket_plus::setBasketVar(IS_PICKUP_DEFAULT, "0");
            basket_plus::setBasketVar(PICKUP_LOCATION, "BasketPlusPhoto.com, Postlaan 1, 8888 ZZ Poststad");
            basket_plus::setBasketVar(USE_PAYPAL, "0");
            basket_plus::setBasketVar(PAYPAL_ACCOUNT, "*****@*****.**");
            basket_plus::setBasketVar(PAYPAL_TEST_MODE, "1");
            basket_plus::setBasketVar(ORDER_PREFIX, "2013-");
            basket_plus::setBasketVar(ORDER_BANK_ACCOUNT, "NL00INGB0000123456 (P123456)");
            basket_plus::setBasketVar(ORDER_BANK_ACCOUNT_OWNER, "B. Plus, Poststad");
            basket_plus::setBasketVar(PAYMENT_OPTIONS, str_replace('$', '"', '<p>U kunt betalen via overmaking op de bankrekening van %webshop.<br />
Instructies vindt u in de bevestigingsmail van de bestelling.</p><br />
<br />
<h3>Algemene voorwaarden</h3>
<p>U kunt de Algemene voorwaarden via deze <a href=$/downloads/Algemene_voorwaarden_2012.pdf$ target=$_blank$>link</a> bekijken.</p><br />'));
            basket_plus::setBasketVar(ADDRESS_FORMAT, "%street %house<br />\n%postalcode %town<br />");
            basket_plus::setBasketVar(USE_ADDRESS_SUBURB, "0");
            basket_plus::setBasketVar(USE_ADDRESS_PROVINCE, "0");
            basket_plus::setBasketVar(USE_ADDRESS_COUNTRY, "0");
            /* basket template settings */
            basket_plus::setBasketVar(PAYMENT_DETAILS, str_replace('$', '"', '<h3 class="h3">Betaling</h3>
															<p style="font-family: verdana, sans-serif; font-size: 11px; color: rgb(80, 84, 80); line-height: 19px; border: none; margin-top: 5px; vertical-align: top;">
																U kunt betalen door het totaalbedrag over te maken op de bankrekening van %webshop.<br /><br />
																Totaalbedrag: <strong>%total_cost</strong><br />
																Rekeningnummer: <strong>%order_bank_account</strong><br />
																&nbsp;t.n.v. <strong>%order_bank_account_owner</strong><br />
																&nbsp;o.v.v. <strong>bestelnummer %order_number</strong><br />
															</p>'));
            basket_plus::setBasketVar(CUSTOMER_DETAILS, " %full_name<br />\n %address<br />\n E-mail: %email<br />\n Telefoon: %phone<br />");
            basket_plus::setBasketVar(ORDER_COMPLETE_PAGE, "<p>Hartelijk dank voor uw bestelling. Uw bestelnummer is </b>%order_number</b>.</p>\n<br />\n<p>%webshop heeft een bevestigingsmail verzonden met de gegevens van uw bestelling en de betalingsinformatie.</p>\n<p>Wij verwerken de bestelling zodra de betaling is ontvangen.</p>\n<br />\n<p>Voor vragen of opmerkingen over uw bestelling kunt u contact opnemen via %email_order</p>");
            basket_plus::setBasketVar(ORDER_PAID_COMPLETE_PAGE, "<p>Hartelijk dank voor uw bestelling. Uw bestelnummer is </b>%order_number</b>.</p>\n<br />\n<p>%webshop heeft een bevestigingsmail verzonden met de gegevens van uw bestelling.</p>\n<p>Uw betaling is ontvangen. U ontvangt een e-mail zodra de bestelling naar u wordt verzonden of klaar ligt om af te halen.</p>");
            basket_plus::setBasketVar(ORDER_THANKYOU, "Beste %full_name,<br>\n<br>\nHartelijk dank voor uw bestelling. De bestelgegevens en betalingsinformatie vindt u hieronder.<br>\nDe aflevering vindt plaats circa 10 werkdagen nadat uw betaling is ontvangen door %webshop.<br>\n<br>\n%order_email_closing\n<br>\n%order_email_closing");
            basket_plus::setBasketVar(ORDER_DETAILS, '<h3 class="h3">Bestelgegevens</h3>
<p style="font-family: verdana, sans-serif; font-size: 11px; color: rgb(80, 84, 80); line-height: 19px; border: none; margin-top: 5px; vertical-align: top;">
	Bestelnummer: <strong>%order_number</strong><br />
	Besteld op: <strong>%order_datetime</strong><br />
	<br>
	<strong>Bestemd voor</strong><br />
	%customer_details <!-- // replace with html -->
	%cost_details <!-- // replace with html -->
	%delivery_method <!-- // replace with html -->
	%comments <!-- // displayed only if the customer provided comments AND/OR ref/ref2 is filled\\-->															
</p>');
            basket_plus::setBasketVar(ORDER_COMPLETE_EMAIL_SUBJECT, "Uw bestelling %order_number bij %webshop");
            basket_plus::setBasketVar(ORDER_PAID_EMAIL_SUBJECT, "Update van uw bestelling %order_number bij %webshop: betaling ontvangen");
            basket_plus::setBasketVar(ORDER_PAID_EMAIL, "Beste %name,<br>\n<br>\n%webshop heeft uw betaling van %total_cost ontvangen en zal bestelling %order_number verwerken. <br>\nU ontvangt een e-mail zodra de bestelling naar u wordt verzonden of klaar ligt om af te halen. <br>\n<br>\n%order_email_closing");
            basket_plus::setBasketVar(ORDER_PAID_DELIVERED_EMAIL_SUBJECT, "Update van uw bestelling %order_number bij %webshop: betaling ontvangen");
            basket_plus::setBasketVar(ORDER_PAID_DELIVERED_EMAIL, "Beste %name,<br>\n<br>\n%webshop heeft uw betaling van %total_cost ontvangen. De foto's zijn al eerder afgeleverd.<br>\nNogmaals dank voor uw bestelling en veel plezier met de foto's!<br>\n<br>\n%order_email_closing");
            basket_plus::setBasketVar(ORDER_LATE_PAYMENT_EMAIL_SUBJECT, "Update van uw bestelling %order_number bij %webshop: wacht op betaling");
            basket_plus::setBasketVar(ORDER_LATE_PAYMENT_EMAIL, "Beste %name,<br>\n<br>\nEnige tijd geleden heeft u bij %webshop bestelling %order_number geplaatst.<br>\nUit onze administratie blijkt dat het bedrag van <strong>%total_cost</strong> nog niet is voldaan. Wij maken u erop attent dat wij pas na ontvangst van de betaling de bestelling verwerken.<br>\n<br>\nU kunt het openstaande bedrag overmaken op rekening <strong>%order_bank_account</strong> tnv <strong>%order_bank_account_owner</strong> ovv <strong>bestelnummer %order_number</strong>.<br>\n<br>\nMocht deze herinnering uw betaling hebben gekruist, dan kunt u deze als niet verzonden beschouwen.<br>\n<br>\n%order_email_closing");
            basket_plus::setBasketVar(ORDER_DELIVERED_EMAIL_SUBJECT, "Update van uw bestelling %order_number bij %webshop: bestelling verstuurd");
            basket_plus::setBasketVar(ORDER_DELIVERED_EMAIL, "Beste %name,<br>\n<br>\nUw bestelling %order_number is %delivery_method. <br>\nNogmaals dank voor uw bestelling en veel plezier met de foto's!<br>\n<br>\n%order_email_closing");
            basket_plus::setBasketVar(ORDER_DELIVERED_NOTPAID_EMAIL_SUBJECT, "Update van uw bestelling %order_number bij %webshop: bestelling verstuurd zonder betaling");
            basket_plus::setBasketVar(ORDER_DELIVERED_NOTPAID_EMAIL, "Beste %name,<br>\n<br>\nUw bestelling %order_number is %delivery_method, hoewel het bedrag van %total_cost volgens onze administratie nog niet is voldaan. <br>\n<br>\nWij verzoeken u het openstaande bedrag zo spoedig mogelijk te voldoen. U kunt het openstaande bedrag overmaken op rekening <strong>%order_bank_account</strong> tnv <strong>%order_bank_account_owner</strong> ovv <strong>bestelnummer %order_number</strong>.<br>\n<br>\nMocht dit bericht uw betaling hebben gekruist, dan kunt u dit verzoek negeren.<br>\n<br>\nVoor vragen of opmerkingen over uw bestelling of de betaling kunt u contact opnemen via %email_order.<br>");
            basket_plus::setBasketVar(ORDER_DELAYED_EMAIL_SUBJECT, "Update van uw bestelling %order_number bij %webshop: bestelling vertraagd");
            basket_plus::setBasketVar(ORDER_DELAYED_EMAIL, "Beste %name,<br>\n<br>\nUw bestelling %order_number is door omstandigheden vertraagd.<br> \nWij doen ons best de bestelling zo snel mogelijk af te leveren.<br>\n<br>\n%order_email_closing");
            basket_plus::setBasketVar(ORDER_CANCELLED_EMAIL_SUBJECT, "Update van uw bestelling %order_number bij %webshop: bestelling geannuleerd");
            basket_plus::setBasketVar(ORDER_CANCELLED_EMAIL, "Beste %name,<br>\n<br>\n%webshop heeft uw bestelling %order_number geannuleerd.<br>");
            basket_plus::setBasketVar(ORDER_EMAIL_CLOSING, "Voor vragen of opmerkingen over uw bestelling kunt u contact opnemen via %email_order.<br>\n<br>\nMet vriendelijke groet,<br>\n%webshop - %webshop_owner");
        }
    }
 public function title()
 {
     return basket_plus::getBasketVar(ORDER_PREFIX) . $this->id . " " . $this->name . " " . t($this->status());
 }