$this->info = array('id' => $order['orders_id'], 'code' => $order['orders_code'], 'currency' => $order['currency'], 'currency_value' => $order['currency_value'], 'payment_method' => $order['payment_method'], 'payment_method_class' => $order['payment_method_class'], 'cc_type' => $order['cc_type'], 'cc_owner' => $order['cc_owner'], 'cc_number' => $order['cc_number'], 'cc_expires' => $order['cc_expires'], 'check_account_type' => $order['check_account_type'], 'check_bank_name' => $order['check_bank_name'], 'check_routing_number' => $order['check_routing_number'], 'check_account_number' => $order['check_account_number'], 'date_purchased' => $order['date_purchased'], 'orders_status' => $order['orders_status'], 'last_modified' => $order['last_modified'], 'payer_requisites' => $order['payer_requisites'], 'self_delivery' => $order['delivery_self_address'], 'delivery_transfer' => $order['delivery_transfer'], 'delivery_transfer_days' => $order['delivery_transfer_days'], 'comments' => $comments['comments'], 'enabled_ssl' => $order['orders_ssl_enabled'], 'shops_id' => $order['shops_id']); $this->customer = array('type' => tep_not_null($order['customers_company']) ? 'corporate' : 'private', 'name' => $order['customers_name'], 'street_address' => $order['customers_street_address'], 'suburb' => $order['customers_suburb'], 'city' => $order['customers_city'], 'postcode' => $order['customers_postcode'], 'state' => $order['customers_state'], 'country' => $order['customers_country'], 'format_id' => $order['customers_address_format_id'], 'telephone' => $order['customers_telephone'], 'email_address' => $order['customers_email_address'], 'id' => $order['customers_id'], 'referer' => $order['customers_referer']); $this->customer = array_merge($this->customer, $company); $this->delivery = array('name' => $order['delivery_name'], 'company' => $order['delivery_company'], 'street_address' => $order['delivery_street_address'], 'suburb' => $order['delivery_suburb'], 'city' => $order['delivery_city'], 'postcode' => $order['delivery_postcode'], 'state' => $order['delivery_state'], 'country' => $order['delivery_country'], 'format_id' => $order['delivery_address_format_id'], 'telephone' => $order['delivery_telephone'], 'date' => $order['delivery_date'] == '0000-00-00' ? '' : $order['delivery_date'], 'time' => $order['delivery_time'], 'delivery_method' => $order['delivery_method'], 'delivery_method_class' => $order['delivery_method_class'], 'delivery_self_address' => $order['delivery_self_address'], 'delivery_self_address_id' => $order['delivery_self_address_id']); $this->billing = array('name' => $order['billing_name'], 'company' => $order['billing_company'], 'street_address' => $order['billing_street_address'], 'suburb' => $order['billing_suburb'], 'city' => $order['billing_city'], 'postcode' => $order['billing_postcode'], 'state' => $order['billing_state'], 'country' => $order['billing_country'], 'format_id' => $order['billing_address_format_id'], 'telephone' => $order['billing_telephone']); $index = 0; $orders_products_query = tep_db_query("select * from " . TABLE_TEMP_ORDERS_PRODUCTS . " where orders_id = '" . (int) $order_id . "'"); while ($orders_products = tep_db_fetch_array($orders_products_query)) { $this->products[$index] = array('qty' => $orders_products['products_quantity'], 'id' => $orders_products['products_id'], 'name' => $orders_products['products_name'], 'model' => $orders_products['products_model'], 'manufacturer' => $orders_products['manufacturers_name'], 'year' => $orders_products['products_year'], 'type' => $orders_products['products_types_id'], 'code' => $orders_products['products_code'], 'weight' => $orders_products['products_weight'], 'tax' => $orders_products['products_tax'], 'price' => $orders_products['products_price'], 'final_price' => $orders_products['final_price']); $index++; } } } $orders_query = tep_db_query("select orders_id from " . TABLE_TEMP_ORDERS . ""); while ($orders = tep_db_fetch_array($orders_query)) { tep_upload_order($orders['orders_id'], ',', UPLOAD_DIR . 'orders2/'); } if (isset($HTTP_GET_VARS['oID'])) { if ($order_exists) { $order = new order($oID); if ($order->info['currency_value'] > 10) { $round_to = 3; } elseif ($order->info['currency_value'] < 0.1) { $round_to = 0; } else { $round_to = 1; } } } $orders_statuses = array(); $orders_status_array = array();
$min_specials_date_added = date('Y-m-d H:i:s', $max_specials_date - 60 * 60 * 24 * 7); $query = tep_db_query("select p.products_id, (if(p.products_listing_status=1, 8, 0) + if(s.specials_types_id, if(s.specials_types_id=1, 4, if(s.specials_types_id=2, 3, 0)), 0) + if(p.products_image_exists=1, 2, 0)) as new_sort_order from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on (s.products_id = p.products_id and s.specials_types_id in ('1', '2') and s.specials_date_added >= '" . tep_db_input($min_specials_date_added) . "') where 1 order by new_sort_order desc"); $s = 1; while ($row = tep_db_fetch_array($query)) { // tep_db_query("update " . TABLE_PRODUCTS . " set sort_order = '" . (int)$s . "' where products_id = '" . (int)$row['products_id'] . "'"); $s++; // echo $row['products_id'] . ' - ' . $row['new_sort_order'] . ' - ' . tep_get_products_name($row['products_id']) . '<br>' . "\n"; } die; require DIR_WS_CLASSES . 'currencies.php'; $currencies = new currencies(); include DIR_WS_CLASSES . 'order.php'; tep_set_time_limit(36000); $orders_query = tep_db_query("select orders_id from " . TABLE_ORDERS . " where date_purchased >= '2011-05-17 00:00:00'"); while ($orders = tep_db_fetch_array($orders_query)) { tep_upload_order($orders['orders_id']); } die; tep_db_select_db('setbook_ua'); $geozone_id = 1; $zone_country_id = 178; $zone_factor = ''; $zone_delivery_time = ''; $new_geozone_id = 2; tep_db_query("delete from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . (int) $geozone_id . "'"); tep_db_query("delete from " . TABLE_CITIES_TO_GEO_ZONES . " where geo_zone_id = '" . (int) $geozone_id . "'"); $zones_query = tep_db_query("select * from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . (int) $new_geozone_id . "'"); while ($zones = tep_db_fetch_array($zones_query)) { tep_db_query("insert into " . TABLE_ZONES_TO_GEO_ZONES . " (zone_country_id, zone_id, geo_zone_id, zone_factor, zone_delivery_time, date_added) values ('" . (int) $zone_country_id . "', '" . (int) $zones['zone_id'] . "', '" . (int) $geozone_id . "', '" . (double) $zone_factor . "', '" . tep_db_prepare_input($zone_delivery_time) . "', now())"); $new_subzone_id = tep_db_insert_id(); tep_db_query("replace into " . TABLE_CITIES_TO_GEO_ZONES . " (city_id, association_id, geo_zone_id, date_added) select city_id, '" . (int) $new_subzone_id . "', '" . (int) $geozone_id . "', now() from " . TABLE_CITIES_TO_GEO_ZONES . " where geo_zone_id = '" . (int) $new_geozone_id . "' and association_id = '" . (int) $zones['association_id'] . "'");
$from_date = '0000-00-00'; } $data = array('<?xml version="1.0" encoding="utf-8"?>' . "\n" . '<request>' . "\n" . '<operation>get_incremental_update</operation>' . "\n" . '<last_update_time>' . $from_date . ' 00:00:00</last_update_time>' . "\n" . '</request>' => ''); $url = 'https://api.letmeprint.ru:443/api/shop/key/d19177552788ff64af9cca8273cdf596'; //api.letmeprint.ru/api/shop/key/ // echo $result = tep_request_html($url, 'POST', $data); $nvpStr_ = '<?xml version="1.0" encoding="utf-8"?>' . "\n" . '<request>' . "\n" . '<operation>get_incremental_update</operation>' . "\n" . '<last_update_time>' . $from_date . ' 00:00:00</last_update_time>' . "\n" . '</request>'; $result = sendTransactionToGateway($url, $nvpStr_); $fp = fopen(UPLOAD_DIR . 'csv/books.xml', 'w'); fwrite($fp, $result); fclose($fp); die('OK'); } elseif ($HTTP_GET_VARS['action'] == 'upload_order') { $order_id = (int) $HTTP_GET_VARS['order_id']; include DIR_WS_CLASSES . 'order.php'; tep_upload_order($order_id); die('OK'); } ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?> > <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?> "> <title><?php echo TITLE;