Upgrade order_editor to v5.0.7 - 18 Nov 2009 - (add qtpro)

Description

in catalog/install/oscmax.sql
find
INSERT INTO configuration VALUES (1308, 'CT_ORDER_EDITOR_DEFAULT_PAYMENT_METHOD', 'ORDER_EDITOR_DEFAULT_PAYMENT_METHOD', 'Please Select...', 'CD_ORDER_EDITOR_CREDIT_CARD', 70, 6, NULL, now(), NULL, 'tep_cfg_pull_down_payment_methods(');

after that add

INSERT into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) values ('CT_ORDER_EDITOR_USE_QTPRO', 'ORDER_EDITOR_USE_QTPRO', 'true', 'CD_ORDER_EDITOR_USE_QTPRO', '70', '7', now(), now(), NULL, 'tep_cfg_select_option(array(\'true\', \'false\'),');

---------------------------------------- in admin/includes/languages/english/configuration.php
find
define('CD_ORDER_EDITOR_DEFAULT_PAYMENT_METHOD', 'Order Editor will display the selected payment method by default in the order editor.');

add after

define('CT_ORDER_EDITOR_USE_QTPRO', 'Use QTPro contribution?');
define('CD_ORDER_EDITOR_USE_QTPRO', 'Leave this set to false unless you have QTPro Installed.');
-------------------------------------------------- in admin/edit_orders.php line 175
find
} else {

change to

// QT Pro Addon BOF
if (ORDER_EDITOR_USE_QTPRO == 'true') {
$attrib_q = tep_db_query("select distinct op.products_id, po.products_options_id, pov.products_options_values_id
from products_options po, products_options_values pov, products_options_values_to_products_options po2pov, orders_products_attributes opa, orders_products op
where op.orders_id = '" . $oID . "'
and op.orders_products_id = '" . $orders_products_id . "'
and products_options_values_name = opa.products_options_values
and pov.products_options_values_id = po2pov.products_options_values_id
and po.products_options_id = po2pov.products_options_id
and products_options_name = opa.products_options");
while($attrib_set = tep_db_fetch_array($attrib_q)) {
// corresponding to each option find the attribute ids ( opts and values id )
$products_stock_attributes[] = $attrib_set['products_options_id'].'-'.$attrib_set['products_options_values_id'];
}
sort($products_stock_attributes, SORT_NUMERIC); // Same sort as QT Pro stock
$products_stock_attributes = implode($products_stock_attributes, ',');
// update the stock
tep_db_query("update ".TABLE_PRODUCTS_STOCK." set products_stock_quantity = products_stock_quantity - ".$quantity_difference . " where products_id= '" . $order_products['products_id'] . "' and products_stock_attributes='".$products_stock_attributes."'");
}
// QT Pro Addon EOF
} else {

on line 196 find

} else {

and change to

// QT Pro Addon BOF
if (ORDER_EDITOR_USE_QTPRO == 'true') {
$attrib_q = tep_db_query("select distinct op.products_id, po.products_options_id, pov.products_options_values_id
from products_options po, products_options_values pov, products_options_values_to_products_options po2pov, orders_products_attributes opa, orders_products op
where op.orders_id = '" . $oID . "'
and op.orders_products_id = '" . $orders_products_id . "'
and products_options_values_name = opa.products_options_values
and pov.products_options_values_id = po2pov.products_options_values_id
and po.products_options_id = po2pov.products_options_id
and products_options_name = opa.products_options");
while($attrib_set = tep_db_fetch_array($attrib_q)) {
// corresponding to each option find the attribute ids ( opts and values id )
$products_stock_attributes[] = $attrib_set['products_options_id'].'-'.$attrib_set['products_options_values_id'];
}
sort($products_stock_attributes, SORT_NUMERIC); // Same sort as QT Pro stock
$products_stock_attributes = implode($products_stock_attributes, ',');
// update the stock
tep_db_query("update ".TABLE_PRODUCTS_STOCK." set products_stock_quantity = products_stock_quantity + ".$products_details["qty"] . " where products_id= '" . $order_products['products_id'] . "' and products_stock_attributes='".$products_stock_attributes."'");
}
// QT Pro Addon EOF
} else {

------------------------------------------------- in admin/edit_orders_add_product.php line 185

find
}

and change to

// QT Pro Addon BOF
if (ORDER_EDITOR_USE_QTPRO == 'true') {
if (isset($_POST['add_product_options'])) {
foreach($_POST['add_product_options'] as $option_id => $option_value_id) {
$products_stock_attributes[] = $option_id . '-'. $option_value_id;
} // for loop
sort($products_stock_attributes, SORT_NUMERIC); // Same sort as QT Pro stock
$products_stock_attributes = implode($products_stock_attributes, ',');
$stock_chk_q = tep_db_query("select * from " . TABLE_PRODUCTS_STOCK . " where products_id=" . $_POST['add_product_products_id']. " and products_stock_attributes='".$products_stock_attributes."'");
$stock_chk_arr = tep_db_fetch_array($stock_chk_q);
$new_quantity = $stock_chk_arr['products_stock_quantity'] - $_POST['add_product_quantity'];
// update the stock
tep_db_query("update ".TABLE_PRODUCTS_STOCK." set products_stock_quantity = ".$new_quantity." where products_id=" . $_POST['add_product_products_id']. " and products_stock_attributes='".$products_stock_attributes."'");
}
}
// QT Pro Addon EOF
}

-----------------------------------------------------------
in edit_orders_ajax.php line 71

find
} else {

and change to

// QT Pro Addon BOF
if (ORDER_EDITOR_USE_QTPRO == 'true') {
$attrib_q = tep_db_query("select distinct op.products_id, po.products_options_id, pov.products_options_values_id
from products_options po, products_options_values pov, products_options_values_to_products_options po2pov, orders_products_attributes opa, orders_products op
where op.orders_id = '" . $_GET['oID'] . "'
and op.orders_products_id = '" . $_GET['pid'] . "'
and products_options_values_name = opa.products_options_values
and pov.products_options_values_id = po2pov.products_options_values_id
and po.products_options_id = po2pov.products_options_id
and products_options_name = opa.products_options");
while($attrib_set = tep_db_fetch_array($attrib_q)) {
// corresponding to each option find the attribute ids ( opts and values id )
$products_stock_attributes[] = $attrib_set['products_options_id'].'-'.$attrib_set['products_options_values_id'];
}
sort($products_stock_attributes, SORT_NUMERIC); // Same sort as QT Pro stock
$products_stock_attributes = implode($products_stock_attributes, ',');
// update the stock
tep_db_query("update ".TABLE_PRODUCTS_STOCK." set products_stock_quantity = products_stock_quantity - ".$quantity_difference . " where products_id= '" . $orders_product_info['products_id'] . "' and products_stock_attributes='".$products_stock_attributes."'");
}
// QT Pro Addon EOF
} else {

----------------------------------------
line 91 delete wiersz

--------------- on line 149 find

} else {

and change to:

// QT Pro Addon BOF
if (ORDER_EDITOR_USE_QTPRO == 'true') {
$attrib_q = tep_db_query("select distinct op.products_id, po.products_options_id, pov.products_options_values_id
from products_options po, products_options_values pov, products_options_values_to_products_options po2pov, orders_products_attributes opa, orders_products op
where op.orders_id = '" . $_GET['oID'] . "'
and op.orders_products_id = '" . $_GET['pid'] . "'
and products_options_values_name = opa.products_options_values
and pov.products_options_values_id = po2pov.products_options_values_id
and po.products_options_id = po2pov.products_options_id
and products_options_name = opa.products_options");
while($attrib_set = tep_db_fetch_array($attrib_q)) {
$products_stock_attributes[] = $attrib_set['products_options_id'].'-'.$attrib_set['products_options_values_id'];
}
sort($products_stock_attributes, SORT_NUMERIC); // Same sort as QT Pro stock
$products_stock_attributes = implode($products_stock_attributes, ',');
// update the stock
tep_db_query("update ".TABLE_PRODUCTS_STOCK." set products_stock_quantity = products_stock_quantity + ".$order['products_quantity'] . " where products_id= '" . (int)$order['products_id'] . "' and products_stock_attributes='".$products_stock_attributes."'");
}
// QT Pro Addon EOF
} else {

------------------------------------------------------------------------ on line 313

find

} elseif ( (tep_not_null($ot_value)) && (tep_not_null($ot_title)) ) { // this modifies if (!strstr($ot_class, 'ot_custom')) { //3

and change to:

} elseif ( (tep_not_null($ot_value)) && (tep_not_null($ot_title)) ) { // this modifies if (!strstr($ot_class, 'ot_custom')) //3

-------------------------------------------------------------------------- on line 355
find
} //end if (is_array($_POST['update_totals'])) { //1

and change to:
} //end if (is_array($_POST['update_totals'])) //1
--------------------------------------------------------------------------
on line 418 find

} //end if ($order->totals[$i]['class'] == 'ot_shipping') {

and change to:
} //end if ($order->totals[$i]['class'] == 'ot_shipping')

---------------------------------------------------------------------------
on line 509 find
<?php }//end if ($action == 'reload_shipping') {

and change to:
<?php }//end if ($action == 'reload_shipping')

---------------------------------------------------------------------------
on line 632 find
<?php } // end if ($action == 'insert_new_comment') {
and change to:
<?php } // end if ($action == 'insert_new_comment')

--------------------------------------------------------------------------
on line 898 find
<?php } //end if ($action == 'new_order_email') { ?>
and change to:
<?php } //end if ($action == 'new_order_email') ?>

--------------------------------------------------------------------------

Environment

None

Steps to reproduce

None

Status

Assignee

Unassigned

Reporter

greg

Labels

None

Severity

Tweak

Components

Affects versions

v2.5.2

Priority

Configure