📄 upgrade_3.php
字号:
while ($categories = osc_db_fetch_array($categories_query)) {
osc_db_query("update categories set categories_image = substring('" . $categories['categories_image'] . "', 8) where categories_id = '" . $categories['categories_id'] . "'");
}
// manufacturers
$manufacturers_query = osc_db_query("select manufacturers_id, manufacturers_image from manufacturers where left(manufacturers_image, 7) = 'images/'");
while ($manufacturers = osc_db_fetch_array($manufacturers_query)) {
osc_db_query("update manufacturers set manufacturers_image = substring('" . $manufacturers['manufacturers_image'] . "', 8) where manufacturers_id = '" . $manufacturers['manufacturers_id'] . "'");
}
// products
$products_query = osc_db_query("select products_id, products_image from products where left(products_image, 7) = 'images/'");
while ($products = osc_db_fetch_array($products_query)) {
osc_db_query("update products set products_image = substring('" . $products['products_image'] . "', 8) where products_id = '" . $products['products_id'] . "'");
}
?>
<script language="javascript"><!--
changeStyle('images', 'normal');
changeText('imagesMarker', '*');
changeText('statusText', 'Updating Images .. done!');
changeStyle('languages', 'bold');
changeText('languagesMarker', '?');
changeText('statusText', 'Updating Languages');
//--></script>
<?php
flush();
osc_db_query("update languages set image = 'icon.gif'");
?>
<script language="javascript"><!--
changeStyle('languages', 'normal');
changeText('languagesMarker', '*');
changeText('statusText', 'Updating Languages .. done!');
changeStyle('manufacturers', 'bold');
changeText('manufacturersMarker', '?');
changeText('statusText', 'Updating Manufacturers');
//--></script>
<?php
flush();
osc_db_query("alter table manufacturers add date_added datetime null after manufacturers_image, add last_modified datetime null after date_added");
osc_db_query("create table manufacturers_info (manufacturers_id int(5) not null, languages_id int(5) not null, manufacturers_url varchar(255) not null, url_clicked int(5) not null default '0', date_last_click datetime, primary key (manufacturers_id, languages_id))");
?>
<script language="javascript"><!--
changeStyle('manufacturers', 'normal');
changeText('manufacturersMarker', '*');
changeText('statusText', 'Updating Manufacturers .. done!');
changeStyle('orders', 'bold');
changeText('ordersMarker', '?');
changeText('statusText', 'Updating Orders');
//--></script>
<?php
flush();
osc_db_query("alter table orders add customers_company varchar(32) after customers_name");
osc_db_query("alter table orders add delivery_company varchar(32) after delivery_name");
osc_db_query("alter table orders add billing_name varchar(64) not null after delivery_address_format_id");
osc_db_query("alter table orders add billing_company varchar(32) after billing_name");
osc_db_query("alter table orders add billing_street_address varchar(64) not null after billing_company");
osc_db_query("alter table orders add billing_suburb varchar(32) after billing_street_address");
osc_db_query("alter table orders add billing_city varchar(32) not null after billing_suburb");
osc_db_query("alter table orders add billing_postcode varchar(10) not null after billing_city");
osc_db_query("alter table orders add billing_state varchar(32) after billing_postcode");
osc_db_query("alter table orders add billing_country varchar(32) not null after billing_state");
osc_db_query("alter table orders add billing_address_format_id int(5) not null after billing_country");
osc_db_query("alter table orders change payment_method payment_method varchar(32) not null");
osc_db_query("alter table orders change date_purchased date_purchased datetime");
osc_db_query("alter table orders change last_modified last_modified datetime");
osc_db_query("alter table orders change orders_date_finished orders_date_finished datetime");
osc_db_query("alter table orders_products add column products_model varchar(12)");
osc_db_query("alter table orders_products change products_price products_price decimal(15,4) not null");
osc_db_query("alter table orders_products change final_price final_price decimal(15,4) not null");
osc_db_query("alter table orders_products_attributes change options_values_price options_values_price decimal(15,4) not null");
osc_db_query("create table orders_status ( orders_status_id int(5) default '0' not null, language_id int(5) default '1' not null, orders_status_name varchar(32) not null, primary key (orders_status_id, language_id), key idx_orders_status_name (orders_status_name))");
for ($i=0; $i<sizeof($languages); $i++) {
osc_db_query("insert into orders_status values ('1', '" . $languages[$i]['id'] . "', 'Pending')");
osc_db_query("insert into orders_status values ('2', '" . $languages[$i]['id'] . "', 'Processing')");
osc_db_query("insert into orders_status values ('3', '" . $languages[$i]['id'] . "', 'Delivered')");
}
osc_db_query("update orders set orders_status = '1' where orders_status = 'Pending'");
osc_db_query("update orders set orders_status = '2' where orders_status = 'Processing'");
osc_db_query("update orders set orders_status = '3' where orders_status = 'Delivered'");
$status = array();
$orders_status_query = osc_db_query("select distinct orders_status from orders where orders_status not in ('1', '2', '3')");
while ($orders_status = osc_db_fetch_array($orders_status_query)) {
$status[] = array('text' => $orders_status['orders_status']);
}
$orders_status_id = 4;
for ($i=0; $i<sizeof($status); $i++) {
for ($j=0; $j<sizeof($languages); $j++) {
osc_db_query("insert into orders_status values ('" . $orders_status_id . "', '" . $languages[$j]['id'] . "', '" . $status[$i]['text'] . "')");
}
osc_db_query("update orders set orders_status = '" . $orders_status_id . "' where orders_status = '" . $status[$i]['text'] . "'");
$orders_status_id++;
}
osc_db_query("alter table orders change orders_status orders_status int(5) not null");
osc_db_query("create table orders_status_history ( orders_status_history_id int(5) not null auto_increment, orders_id int(5) not null, orders_status_id int(5) not null, date_added datetime not null, customer_notified int(1) default '0', comments text, primary key (orders_status_history_id))");
$orders_query = osc_db_query("select orders_id, date_purchased, comments from orders where comments <> ''");
while ($order = osc_db_fetch_array($orders_query)) {
osc_db_query("insert into orders_status_history (orders_id, orders_status_id, date_added, comments) values ('" . $order['orders_id'] . "', '1', '" . $order['date_purchased'] . "', '" . $order['comments'] . "')");
}
osc_db_query("alter table orders drop comments");
$orders_products_query = osc_db_query("select op.orders_products_id, opa.orders_products_attributes_id, op.products_id from orders_products op, orders_products_attributes opa where op.orders_id = opa.orders_id");
while ($orders_products = osc_db_fetch_array($orders_products_query)) {
osc_db_query("update orders_products_attributes set orders_products_id = '" . $orders_products['orders_products_id'] . "' where orders_products_attributes_id = '" . $orders_products['orders_products_attributes_id'] . "' and orders_products_id = '" . $orders_products['products_id'] . "'");
}
osc_db_query("create table orders_products_download ( orders_products_download_id int(5) not null auto_increment, orders_id int(5) not null default '0', orders_products_id int(5) not null default '0', orders_products_filename varchar(255) not null, download_maxdays int(2) not null default '0', download_count int(2) not null default '0', primary key (orders_products_download_id))");
osc_db_query("create table orders_total ( orders_total_id int unsigned not null auto_increment, orders_id int not null, title varchar(255) not null, text varchar(255) not null, value decimal(15,4) not null, class varchar(32) not null, sort_order int not null, primary key (orders_total_id), key idx_orders_total_orders_id (orders_id))");
$i = 0;
$orders_query = osc_db_query("select orders_id, shipping_method, shipping_cost, currency, currency_value from orders");
while ($orders = osc_db_fetch_array($orders_query)) {
$o = array();
$total_cost = 0;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -