本文整理汇总了PHP中tep_db_num_rows函数的典型用法代码示例。如果您正苦于以下问题:PHP tep_db_num_rows函数的具体用法?PHP tep_db_num_rows怎么用?PHP tep_db_num_rows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tep_db_num_rows函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: query
function query($returns_id)
{
$returns_query = tep_db_query("SELECT * FROM " . TABLE_RETURNS . " WHERE returns_id = '" . tep_db_input($returns_id) . "'");
$returns = tep_db_fetch_array($returns_query);
$refund_payment_query = tep_db_query("SELECT * FROM " . TABLE_RETURN_PAYMENTS . " where returns_id = '" . tep_db_input($returns_id) . "'");
$refund_payment = tep_db_fetch_array($refund_payment_query);
$this->returnid = $returns['returns_id'];
$this->orderid = $returns['order_id'];
$this->info = array('currency' => $returns['currency'], 'currency_value' => $returns['currency_value'], 'payment_method' => $returns['payment_method'], 'rma_value' => $returns['rma_value'], 'order_id' => $returns['order_id'], 'cc_type' => $returns['cc_type'], 'cc_owner' => $returns['cc_owner'], 'cc_number' => $returns['cc_number'], 'cvvnumber' => $returns['cvvnumber'], 'cc_expires' => $returns['cc_expires'], 'comments' => $returns['comments'], 'date_purchased' => $returns['date_purchased'], 'orders_status' => $returns['returns_status'], 'date_finished' => $returns['date_finished'], 'customer_method' => $refund_payment['customer_method'], 'refund_method' => $refund_payment['refund_payment_name'], 'payment_reference' => $refund_payment['refund_payment_reference'], 'refund_amount' => 0, 'refund_date' => $refund_payment['refund_payment_date'], 'refund_gv_id' => $returns['refund_gv_id'], 'last_modified' => $returns['last_modified'], 'return_reason' => $returns['returns_reason']);
$this->customer = array('name' => $returns['customers_name'], 'company' => $returns['customers_company'], 'street_address' => $returns['customers_street_address'], 'suburb' => $returns['customers_suburb'], 'city' => $returns['customers_city'], 'postcode' => $returns['customers_postcode'], 'state' => $returns['customers_state'], 'country' => $returns['customers_country'], 'format_id' => $returns['customers_address_format_id'], 'telephone' => $returns['customers_telephone'], 'fax' => $returns['customers_fax'], 'email_address' => $returns['customers_email_address']);
$this->delivery = array('name' => $returns['delivery_name'], 'company' => $returns['delivery_company'], 'street_address' => $returns['delivery_street_address'], 'suburb' => $returns['delivery_suburb'], 'city' => $returns['delivery_city'], 'postcode' => $returns['delivery_postcode'], 'state' => $returns['delivery_state'], 'country' => $returns['delivery_country'], 'format_id' => $returns['delivery_address_format_id']);
$this->billing = array('name' => $returns['billing_name'], 'company' => $returns['billing_company'], 'street_address' => $returns['billing_street_address'], 'suburb' => $returns['billing_suburb'], 'city' => $returns['billing_city'], 'postcode' => $returns['billing_postcode'], 'state' => $returns['billing_state'], 'country' => $returns['billing_country'], 'format_id' => $returns['billing_address_format_id']);
$returns_products_query = tep_db_query("SELECT * FROM " . TABLE_RETURNS_PRODUCTS_DATA . " WHERE returns_id ='" . tep_db_input($returns_id) . "'");
while ($returned_products = tep_db_fetch_array($returns_products_query)) {
$this->products = array('qty' => $returned_products['products_quantity'], 'name' => $returned_products['products_name'], 'model' => $returned_products['products_model'], 'tax' => $returned_products['products_tax'], 'price' => $returned_products['products_price'], 'id' => $returned_products['products_id'], 'refund_shipping' => $returned_products['refund_shipping'], 'restock_quantity' => $returned_products['restock_quantity'], 'refund_amount' => $returned_products['refund_amount'], 'exchange_amount' => $returned_products['exchange_amount'], 'refund_shipping_amount' => $returned_products['refund_shipping_amount'], 'final_price' => $returned_products['products_price']);
$this->info['refund_amount'] += $returned_products['refund_amount'];
}
// # END while
$this->exchange = array();
$returns_products_query = tep_db_query("SELECT * FROM " . TABLE_ORDERS_PRODUCTS . " \r\n\t\t\t\t\t\t\t\t\t\t\t\t WHERE exchange_returns_id ='" . tep_db_input($returns_id) . "'\r\n\t\t\t\t\t\t\t\t\t\t\t\t");
while ($returned_products = tep_db_fetch_array($returns_products_query)) {
$this->exchange[] = array('orders_products_id' => $returned_products['orders_products_id'], 'qty' => $returned_products['products_quantity'], 'name' => $returned_products['products_name'], 'model' => $returned_products['products_model'], 'tax' => $returned_products['products_tax'], 'price' => $returned_products['products_price'], 'final_price' => $returned_products['products_price'], 'id' => $returned_products['products_id'], 'free_shipping' => $returned_products['free_shipping'], 'separate_shipping' => $returned_products['separate_shipping'], 'weight' => $returned_products['products_weight']);
$attributes_query = tep_db_query("SELECT * FROM " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " \r\n\t\t\t\t\t\t\t\t\t\t\t WHERE orders_id = '" . $this->orderid . "' \r\n\t\t\t\t\t\t\t\t\t\t\t AND orders_products_id = '" . (int) $returned_products['orders_products_id'] . "'\r\n\t\t\t\t\t\t\t\t\t\t\t");
if (tep_db_num_rows($attributes_query)) {
while ($attributes = tep_db_fetch_array($attributes_query)) {
$this->exchange[sizeof($this->exchange) - 1]['attributes'][] = array('option' => $attributes['products_options'], 'value' => $attributes['products_options_values'], 'orders_products_attributes_id' => $attributes['orders_products_attributes_id']);
}
// # END while $attributes
}
// # END if tep_db_num_rows
}
// # END $returned_products
}
示例2: OSCOM_PayPal_HS_Cfg_prepare_order_status_id
function OSCOM_PayPal_HS_Cfg_prepare_order_status_id()
{
global $OSCOM_PayPal;
$this->title = $OSCOM_PayPal->getDef('cfg_hs_prepare_order_status_id_title');
$this->description = $OSCOM_PayPal->getDef('cfg_hs_prepare_order_status_id_desc');
if (!defined('OSCOM_APP_PAYPAL_HS_PREPARE_ORDER_STATUS_ID')) {
$check_query = tep_db_query("select orders_status_id from orders_status where orders_status_name = 'Preparing [PayPal Pro HS]' limit 1");
if (tep_db_num_rows($check_query) < 1) {
$status_query = tep_db_query("select max(orders_status_id) as status_id from orders_status");
$status = tep_db_fetch_array($status_query);
$status_id = $status['status_id'] + 1;
$languages = tep_get_languages();
foreach ($languages as $lang) {
tep_db_query("insert into orders_status (orders_status_id, language_id, orders_status_name) values ('" . $status_id . "', '" . $lang['id'] . "', 'Preparing [PayPal Pro HS]')");
}
$flags_query = tep_db_query("describe orders_status public_flag");
if (tep_db_num_rows($flags_query) == 1) {
tep_db_query("update orders_status set public_flag = 0 and downloads_flag = 0 where orders_status_id = '" . $status_id . "'");
}
} else {
$check = tep_db_fetch_array($check_query);
$status_id = $check['orders_status_id'];
}
} else {
$status_id = OSCOM_APP_PAYPAL_HS_PREPARE_ORDER_STATUS_ID;
}
$this->default = $status_id;
}
示例3: output
public function output($step = 0)
{
global $temp_orders_id;
$html = '';
if ($temp_orders_id > 0) {
$to_query = tep_db_query('SELECT * FROM temp_orders WHERE orders_id = "' . $temp_orders_id . '"');
if (tep_db_num_rows($to_query) > 0) {
$to = tep_db_fetch_array($to_query);
$html .= '<div class="billing_address">';
$html .= '<h3 class="billing_address_title">' . Translate($this->config['title']) . '</h3>';
if (!empty($this->config['description'])) {
$html .= '<p class="billing_address_description">' . Translate($this->config['description']) . '</p>';
}
$html .= '<blockquote>';
$html .= '<address>';
//name
$html .= '<strong>' . $to['billing_name'] . '</strong><br />';
//street
$html .= $to['billing_street_address'] . '<br />';
//city + postcode + country
$html .= $to['billing_postcode'] . ' ' . $to['billing_city'] . ' ' . tep_get_country_name($to['billing_country']) . '<br />';
$html .= '</address>';
$html .= '</blockquote>';
$html .= '</div>';
//end billing_address
}
}
return $html;
}
示例4: execute
function execute()
{
global $HTTP_GET_VARS, $HTTP_POST_VARS, $oscTemplate, $customer_id, $order_id;
if (tep_session_is_registered('customer_id')) {
$global_query = tep_db_query("select global_product_notifications from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int) $customer_id . "'");
$global = tep_db_fetch_array($global_query);
if ($global['global_product_notifications'] != '1') {
if (isset($HTTP_GET_VARS['action']) && $HTTP_GET_VARS['action'] == 'update') {
if (isset($HTTP_POST_VARS['notify']) && is_array($HTTP_POST_VARS['notify']) && !empty($HTTP_POST_VARS['notify'])) {
$notify = array_unique($HTTP_POST_VARS['notify']);
foreach ($notify as $n) {
if (is_numeric($n) && $n > 0) {
$check_query = tep_db_query("select products_id from " . TABLE_PRODUCTS_NOTIFICATIONS . " where products_id = '" . (int) $n . "' and customers_id = '" . (int) $customer_id . "' limit 1");
if (!tep_db_num_rows($check_query)) {
tep_db_query("insert into " . TABLE_PRODUCTS_NOTIFICATIONS . " (products_id, customers_id, date_added) values ('" . (int) $n . "', '" . (int) $customer_id . "', now())");
}
}
}
}
}
$products_displayed = array();
$products_query = tep_db_query("select products_id, products_name from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int) $order_id . "' order by products_name");
while ($products = tep_db_fetch_array($products_query)) {
if (!isset($products_displayed[$products['products_id']])) {
$products_displayed[$products['products_id']] = tep_draw_checkbox_field('notify[]', $products['products_id']) . ' ' . $products['products_name'];
}
}
$products_notifications = implode('<br />', $products_displayed);
ob_start();
include DIR_WS_MODULES . 'content/' . $this->group . '/templates/product_notifications.php';
$template = ob_get_clean();
$oscTemplate->addContent($template, $this->group);
}
}
}
示例5: query
function query($order_id)
{
global $languages_id;
$order_query = tep_db_query("select o.*, s.orders_status_name from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_STATUS . " s where o.orders_id = '" . (int) $order_id . "' and o.orders_status = s.orders_status_id and s.language_id = '" . (int) $languages_id . "'");
$order = tep_db_fetch_array($order_query);
$totals_query = tep_db_query("select title, text, class from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int) $order_id . "' order by sort_order");
while ($totals = tep_db_fetch_array($totals_query)) {
$this->totals[] = array('title' => $totals['title'], 'text' => $totals['text'], 'class' => $totals['class']);
}
$this->info = array('total' => null, 'currency' => $order['currency'], 'currency_value' => $order['currency_value'], 'payment_method' => $order['payment_method'], 'cc_type' => $order['cc_type'], 'cc_owner' => $order['cc_owner'], 'cc_number' => $order['cc_number'], 'cc_expires' => $order['cc_expires'], 'date_purchased' => $order['date_purchased'], 'status' => $order['orders_status_name'], 'orders_status' => $order['orders_status'], 'last_modified' => $order['last_modified']);
foreach ($this->totals as $t) {
if ($t['class'] == 'ot_total') {
$this->info['total'] = $t['text'];
break;
}
}
$this->customer = array('name' => $order['customers_name'], 'company' => $order['customers_company'], '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']);
$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']);
$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']);
$index = 0;
$orders_products_query = tep_db_query("select orders_products_id, products_name, products_model, products_price, products_tax, products_quantity, final_price from " . TABLE_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'], 'name' => $orders_products['products_name'], 'model' => $orders_products['products_model'], 'tax' => $orders_products['products_tax'], 'price' => $orders_products['products_price'], 'final_price' => $orders_products['final_price']);
$subindex = 0;
$attributes_query = tep_db_query("select products_options, products_options_values, options_values_price, price_prefix from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int) $order_id . "' and orders_products_id = '" . (int) $orders_products['orders_products_id'] . "'");
if (tep_db_num_rows($attributes_query)) {
while ($attributes = tep_db_fetch_array($attributes_query)) {
$this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'], 'value' => $attributes['products_options_values'], 'prefix' => $attributes['price_prefix'], 'price' => $attributes['options_values_price']);
$subindex++;
}
}
$index++;
}
}
示例6: build_cds_list_menu
function build_cds_list_menu($startid = 0, $ulstyle = '')
{
global $languages_id;
if ($ulstyle != '') {
$ulstyle = ' id="' . $ulstyle . '"';
}
$cds_menu = '';
//loop through category id to find all subcategories and pages
$cds_pages_query = tep_db_query("SELECT c.categories_id as 'ID', \r\n cd.categories_name as 'Name',\r\n c.categories_parent_id as 'ParentID',\r\n c.category_append_cdpath as 'Append',\r\n c.categories_url_override as 'URL',\r\n c.categories_url_override_target as 'Target',\r\n c.pages_group_access as 'Group', 'c' as 'type',\r\n c.categories_sort_order as 'Sort'\r\n FROM pages_categories c \r\n LEFT JOIN pages_categories_description cd \r\n ON c.categories_id = cd.categories_id \r\n WHERE c.categories_parent_id = '" . $startid . "' \r\n AND c.categories_status = '1'\r\n AND c.categories_in_menu = '1'\r\n AND cd.language_id = '" . (int) $languages_id . "'\r\n UNION\r\n SELECT p.pages_id as 'ID', \r\n pd.pages_menu_name as 'Name',\r\n p2c.categories_id as 'ParentID',\r\n p.pages_append_cdpath as 'Append',\r\n p.pages_url as 'URL',\r\n p.pages_url_target as 'Target',\r\n p.pages_group_access as 'Group', 'p' as 'type',\r\n p.pages_sort_order as 'Sort'\r\n FROM pages p, \r\n pages_description pd, \r\n pages_to_categories p2c \r\n WHERE p.pages_id = pd.pages_id \r\n AND pd.language_id ='" . (int) $languages_id . "'\r\n AND p.pages_id = p2c.pages_id \r\n AND p.pages_status = '1'\r\n AND pd.pages_menu_name <> ''\r\n AND p.pages_in_menu = '1'\r\n AND p2c.categories_id ='" . $startid . "'\r\n ORDER BY Sort ");
$rows_count = tep_db_num_rows($cds_pages_query);
if ($rows_count > 0) {
$cds_menu .= "\n" . ' <ul' . $ulstyle . '>' . "\n";
$ulstyle = '';
while ($cds_pages_data = tep_db_fetch_array($cds_pages_query)) {
$cds_menu .= ' <li>' . cds_build_menu_url($cds_pages_data['ID'], $cds_pages_data['Name'], $cds_pages_data['type'], $cds_pages_data['URL'], $cds_pages_data['Append'], $cds_pages_data['Target']);
if ($cds_pages_data['type'] == 'c' && $cds_pages_data['URL'] == '') {
//we found a subcategory, loop, loop, loop.......
$cds_menu .= build_cds_list_menu($cds_pages_data['ID']);
}
$cds_menu .= '</li>' . "\n";
}
$cds_menu .= ' </ul>' . "\n";
}
return $cds_menu;
}
示例7: execute
function execute()
{
global $HTTP_GET_VARS, $current_category_id, $languages_id, $oscTemplate;
if (isset($current_category_id) && $current_category_id > 0) {
$best_sellers_query = tep_db_query("select distinct p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '" . (int) $languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and '" . (int) $current_category_id . "' in (c.categories_id, c.parent_id) order by p.products_ordered desc, pd.products_name limit " . MAX_DISPLAY_BESTSELLERS);
} else {
$best_sellers_query = tep_db_query("select distinct p.products_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '" . (int) $languages_id . "' order by p.products_ordered desc, pd.products_name limit " . MAX_DISPLAY_BESTSELLERS);
}
if (tep_db_num_rows($best_sellers_query) >= MIN_DISPLAY_BESTSELLERS) {
$bestsellers_list = '<ol style="margin: 0; padding-left: 25px;">';
while ($best_sellers = tep_db_fetch_array($best_sellers_query)) {
$bestsellers_list .= '<li><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id']) . '">' . $best_sellers['products_name'] . '</a></li>';
}
$bestsellers_list .= '</ol>';
if ($this->group == 'boxes_footer') {
$data = '<div class="col-sm-3 col-lg-2">' . ' <div class="footerbox best-sellers">' . ' <h2>' . MODULE_BOXES_BEST_SELLERS_BOX_TITLE . '</h2>';
} else {
$data = '<div class="panel panel-default">' . ' <div class="panel-heading">' . MODULE_BOXES_BEST_SELLERS_BOX_TITLE . '</div>';
}
$data .= ' <div class="panel-body">' . $bestsellers_list . '</div>';
$data .= '</div>';
if ($this->group == 'boxes_footer') {
$data .= '</div>';
}
$oscTemplate->addBlock($data, $this->group);
}
}
示例8: execute
function execute()
{
global $customer_id, $languages_id, $PHP_SELF, $oscTemplate;
if (tep_session_is_registered('customer_id')) {
// retreive the last x products purchased
$orders_query = tep_db_query("select distinct op.products_id from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op, " . TABLE_PRODUCTS . " p where o.customers_id = '" . (int) $customer_id . "' and o.orders_id = op.orders_id and op.products_id = p.products_id and p.products_status = '1' group by products_id order by o.date_purchased desc limit " . MAX_DISPLAY_PRODUCTS_IN_ORDER_HISTORY_BOX);
if (tep_db_num_rows($orders_query)) {
$product_ids = '';
while ($orders = tep_db_fetch_array($orders_query)) {
$product_ids .= (int) $orders['products_id'] . ',';
}
$product_ids = substr($product_ids, 0, -1);
$customer_orders_string = '<ul class="list-unstyled">';
$products_query = tep_db_query("select products_id, products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id in (" . $product_ids . ") and language_id = '" . (int) $languages_id . "' order by products_name");
while ($products = tep_db_fetch_array($products_query)) {
$customer_orders_string .= '<li><span class="pull-right"><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=cust_order&pid=' . $products['products_id']) . '"><span class="glyphicon glyphicon-shopping-cart"></span></a></span><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products['products_id']) . '">' . $products['products_name'] . '</a></li>';
}
$customer_orders_string .= '</ul>';
if ($this->group == 'boxes_footer') {
$data = '<div class="col-sm-3 col-lg-2">' . ' <div class="footerbox order-history">' . ' <h2>' . MODULE_BOXES_ORDER_HISTORY_BOX_TITLE . '</h2>';
} else {
$data = '<div class="panel panel-default">' . ' <div class="panel-heading">' . MODULE_BOXES_ORDER_HISTORY_BOX_TITLE . '</div>';
}
$data .= ' <div class="panel-body">' . $customer_orders_string . '</div>';
$data .= '</div>';
if ($this->group == 'boxes_footer') {
$data .= '</div>';
}
$oscTemplate->addBlock($data, $this->group);
}
}
}
示例9: query
function query($order_id)
{
$order_query = tep_db_query("select * from " . TABLE_ORDERS . " where orders_id = '" . (int) $order_id . "'");
$order = tep_db_fetch_array($order_query);
$totals_query = tep_db_query("select * from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int) $order_id . "' order by sort_order");
while ($totals = tep_db_fetch_array($totals_query)) {
$this->totals[] = array('title' => $totals['title'], 'text' => $totals['text'], 'class' => $totals['class'], 'value' => $totals['value'], 'sort_order' => $totals['sort_order'], 'orders_total_id' => $totals['orders_total_id']);
}
$this->info = array('currency' => $order['currency'], 'currency_value' => $order['currency_value'], 'payment_method' => $order['payment_method'], 'cc_type' => $order['cc_type'], 'cc_owner' => $order['cc_owner'], 'cc_number' => $order['cc_number'], 'cc_expires' => $order['cc_expires'], 'shipping_tax' => $order['shipping_tax'], 'date_purchased' => $order['date_purchased'], 'orders_status' => $order['orders_status'], 'last_modified' => $order['last_modified']);
$this->customer = array('name' => $order['customers_name'], 'company' => $order['customers_company'], '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']);
$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']);
$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']);
$countryid = tep_get_country_id($this->delivery["country"]);
$zoneid = tep_get_zone_id($countryid, $this->delivery["state"]);
$index = 0;
$orders_products_query = tep_db_query("\n SELECT \n\t op.orders_products_id, \n\t op.products_name, \n\t op.products_model, \n\t op.products_price,\n\t op.products_tax, \n\t op.products_quantity, \n\t op.final_price, \n\t p.products_tax_class_id,\n\t p.products_weight\n FROM " . TABLE_ORDERS_PRODUCTS . " op\n LEFT JOIN " . TABLE_PRODUCTS . " p\n ON op.products_id = p.products_id\n 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'], 'name' => $orders_products['products_name'], 'model' => $orders_products['products_model'], 'tax' => $orders_products['products_tax'], 'tax_description' => tep_get_tax_description($orders_products['products_tax_class_id'], $countryid, $zoneid), 'price' => $orders_products['products_price'], 'final_price' => $orders_products['final_price'], 'weight' => $orders_products['products_weight'], 'orders_products_id' => $orders_products['orders_products_id']);
$subindex = 0;
$attributes_query = tep_db_query("select * from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_id = '" . (int) $order_id . "' and orders_products_id = '" . (int) $orders_products['orders_products_id'] . "'");
if (tep_db_num_rows($attributes_query)) {
while ($attributes = tep_db_fetch_array($attributes_query)) {
$this->products[$index]['attributes'][$subindex] = array('option' => $attributes['products_options'], 'value' => $attributes['products_options_values'], 'prefix' => $attributes['price_prefix'], 'price' => $attributes['options_values_price'], 'orders_products_attributes_id' => $attributes['orders_products_attributes_id']);
$subindex++;
}
}
$index++;
}
}
示例10: __construct
function __construct(&$current_page_number, $max_rows_per_page, &$sql_query, &$query_num_rows)
{
if (empty($current_page_number)) {
$current_page_number = 1;
}
// # scrub any white space found in incoming queries!
if ($sql_query) {
$sql_query = preg_replace("/\\s+/", " ", $sql_query);
}
//error_log(print_r($sql_query,1));
$pos_to = strlen($sql_query);
$pos_from = strripos($sql_query, ' from', 0);
$pos_order_by = strripos($sql_query, ' order by', $pos_from);
if ($pos_order_by < $pos_to && $pos_order_by != false) {
$pos_to = $pos_order_by;
}
$pos_limit = strripos($sql_query, ' limit', $pos_from);
if ($pos_limit < $pos_to && $pos_limit != false) {
$pos_to = $pos_limit;
}
$pos_procedure = strripos($sql_query, ' procedure', $pos_from);
if ($pos_procedure < $pos_to && $pos_procedure != false) {
$pos_to = $pos_procedure;
}
$offset = $max_rows_per_page * ($current_page_number - 1);
$sql_query .= " limit " . $offset . ", " . $max_rows_per_page;
$reviews_count_query = tep_db_query("select 0 " . substr($sql_query, $pos_from, $pos_to - $pos_from));
//$reviews_count = tep_db_fetch_array($reviews_count_query);
$query_num_rows = (int) tep_db_num_rows($reviews_count_query);
$this->current_page_number = $current_page_number;
$this->max_rows_per_page = $max_rows_per_page;
$this->query_num_rows = $query_num_rows;
}
示例11: processXMLFile
function processXMLFile($xml_file)
{
global $timestamp, $logger;
$xmlt = new xml_tools();
$xml = $xmlt->loadFile($xml_file);
$order_date = $timestamp;
$segments_id = (int) $xml->LOCAL_INFO->SEGMENT_ID;
$group_name = (string) $xml->LOCAL_INFO->GROUP_NAME;
$refill_orders = $xml->REFILL_ORDERS->ORDER;
$counter = 0;
foreach ($refill_orders as $ro) {
$products_id = (int) $ro->PRODUCTS_ID;
$articles_id = (int) $ro->ARTICLES_ID;
$products_ean = $ro->PRODUCTS_EAN;
$quantity = (int) $ro->QUANTITY;
$trans_type = (string) (strtoupper($ro->TRANS_TYPE) == 'NULL' ? '' : $ro->TRANS_TYPE);
$trans_id = (int) $ro->TRANS_ID;
//CREATE DEPOT ORDERS
$q_check = "SELECT depot_orders_id FROM depot_orders " . " WHERE segments_id = {$segments_id}" . " AND trans_type = '' AND trans_id = {$trans_id}";
$r_check = tep_db_query($q_check);
//ONLY CREATE ORDER WHICH NOT IMPORTED
if (tep_db_num_rows($r_check) == 0) {
$class_do = new depot_orders();
$class_do->newOrder($segments_id, $products_id, $articles_id, $products_ean, $quantity, $order_date, $trans_type, $trans_id, $group_name);
$counter++;
}
}
$logger->write("{$counter} orders imported");
unlink($xml_file);
$logger->write("xml deleted");
return $counter;
}
示例12: amazonGetBoxAvailable
function amazonGetBoxAvailable($jng_sp_id, $order_id, $destination_id)
{
/* Rule:
* maximum PO per box = 5
*/
$time_stamp = time();
$date_today = date('Y-m-d', $time_stamp);
$scanned_time = date('Y-m-d H:i:s', $time_stamp);
$total_po_per_package = 5;
$q_check = "SELECT packaging_box FROM orders_use_packaging_box" . " WHERE date_allocation = '{$date_today}' AND order_id = '{$order_id}'" . " AND shipping_id = '{$destination_id}' AND jng_sp_id = {$jng_sp_id}";
$res_check = tep_db_query($q_check);
if (tep_db_num_rows($res_check) > 0) {
$dt = tep_db_fetch_array($res_check);
$packaging_box = $dt['packaging_box'];
} else {
//Allocate it
$q = "SELECT order_id FROM orders_use_packaging_box" . " WHERE date_allocation = '{$date_today}' AND shipping_id = '{$destination_id}'" . " AND jng_sp_id = {$jng_sp_id}";
$res = tep_db_query($q);
$po_allocated_total = tep_db_num_rows($res);
$po_allocated_next = $po_allocated_total + 1;
$packaging_box = ceil($po_allocated_next / $total_po_per_package);
$data = array();
$data['date_allocation'] = $date_today;
$data['jng_sp_id'] = $jng_sp_id;
$data['order_id'] = $order_id;
$data['shipping_id'] = $destination_id;
$data['packaging_box'] = $packaging_box;
$data['scanned_time'] = $scanned_time;
tep_db_perform('orders_use_packaging_box', $data);
}
return $packaging_box;
}
示例13: execute
function execute()
{
global $PHP_SELF, $oscTemplate, $product_check, $languages_id, $currency;
if ($product_check['total'] > 0) {
$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_image, p.products_price, p.products_quantity, p.products_tax_class_id, p.products_date_available from products p, products_description pd where p.products_id = '" . (int) $_GET['products_id'] . "' and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int) $languages_id . "'");
if (tep_db_num_rows($product_info_query) === 1) {
$product_info = tep_db_fetch_array($product_info_query);
$data = array('og:type' => 'product', 'og:title' => $product_info['products_name'], 'og:site_name' => STORE_NAME);
$product_description = substr(trim(preg_replace('/\\s\\s+/', ' ', strip_tags($product_info['products_description']))), 0, 197) . '...';
$data['og:description'] = $product_description;
$products_image = $product_info['products_image'];
$pi_query = tep_db_query("select image from products_images where products_id = '" . (int) $product_info['products_id'] . "' order by sort_order limit 1");
if (tep_db_num_rows($pi_query) === 1) {
$pi = tep_db_fetch_array($pi_query);
$products_image = $pi['image'];
}
$data['og:image'] = tep_href_link('images/' . $products_image, '', 'NONSSL', false, false);
if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
$products_price = $this->format_raw($new_price);
} else {
$products_price = $this->format_raw($product_info['products_price']);
}
$data['product:price:amount'] = $products_price;
$data['product:price:currency'] = $currency;
$data['og:url'] = tep_href_link('product_info.php', 'products_id=' . $product_info['products_id'], 'NONSSL', false);
$data['product:availability'] = $product_info['products_quantity'] > 0 ? MODULE_HEADER_TAGS_PRODUCT_OPENGRAPH_TEXT_IN_STOCK : MODULE_HEADER_TAGS_PRODUCT_OPENGRAPH_TEXT_OUT_OF_STOCK;
$result = '';
foreach ($data as $key => $value) {
$result .= '<meta property="' . tep_output_string_protected($key) . '" content="' . tep_output_string_protected($value) . '" />' . PHP_EOL;
}
$oscTemplate->addBlock($result, $this->group);
}
}
}
示例14: execute
function execute()
{
global $HTTP_GET_VARS, $languages_id, $oscTemplate;
if (isset($HTTP_GET_VARS['products_id'])) {
$manufacturer_query = tep_db_query("select m.manufacturers_id, m.manufacturers_name, m.manufacturers_image, mi.manufacturers_url from " . TABLE_MANUFACTURERS . " m left join " . TABLE_MANUFACTURERS_INFO . " mi on (m.manufacturers_id = mi.manufacturers_id and mi.languages_id = '" . (int) $languages_id . "'), " . TABLE_PRODUCTS . " p where p.products_id = '" . (int) $HTTP_GET_VARS['products_id'] . "' and p.manufacturers_id = m.manufacturers_id");
if (tep_db_num_rows($manufacturer_query)) {
$manufacturer = tep_db_fetch_array($manufacturer_query);
$manufacturer_info_string = NULL;
if (tep_not_null($manufacturer['manufacturers_image'])) {
$manufacturer_info_string .= '<div>' . tep_image(DIR_WS_IMAGES . $manufacturer['manufacturers_image'], $manufacturer['manufacturers_name']) . '</div>';
}
if (tep_not_null($manufacturer['manufacturers_url'])) {
$manufacturer_info_string .= '<div class="text-center"><a href="' . tep_href_link(FILENAME_REDIRECT, 'action=manufacturer&manufacturers_id=' . $manufacturer['manufacturers_id']) . '" target="_blank">' . sprintf(MODULE_BOXES_MANUFACTURER_INFO_BOX_HOMEPAGE, $manufacturer['manufacturers_name']) . '</a></div>';
}
$data = NULL;
if ($this->group == 'boxes_product_page') {
$data .= '<div class="col-sm-4 product_box hidden-xs">';
}
$data .= '<div class="panel panel-default">' . ' <div class="panel-heading">' . MODULE_BOXES_MANUFACTURER_INFO_BOX_TITLE . '</div>' . ' <div class="panel-body">' . $manufacturer_info_string . '</div>';
$data .= ' <div class="panel-footer clearfix"><a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturer['manufacturers_id']) . '">' . MODULE_BOXES_MANUFACTURER_INFO_BOX_OTHER_PRODUCTS . '</a></div>';
$data .= '</div>';
if ($this->group == 'boxes_product_page') {
$data .= '</div>';
}
$oscTemplate->addBlock($data, $this->group);
}
}
}
示例15: updateStatus
function updateStatus($upload_id, $status, $update_by = '')
{
$update_time = date('Y-m-d H:i:s');
tep_db_query("UPDATE jng_sp_upload SET upload_status='{$status}', status_update_time='{$update_time}', status_update_by='{$update_by}' WHERE jng_sp_upload_id={$upload_id}");
//Check if upload status update is "Success" (S)
if ($status == 'S') {
//Get all catalog id included in this upload for image upload and update the image_uploaded status to 1
$catalog_query = tep_db_query("SELECT jng_sp_catalog_id FROM jng_sp_upload_image WHERE jng_sp_upload_id={$upload_id}");
if (tep_db_num_rows($catalog_query) > 0) {
$jcid = array();
while ($row = tep_db_fetch_array($catalog_query)) {
$jcid[] = $row['jng_sp_catalog_id'];
}
$jcid_filter = implode(',', $jcid);
tep_db_query("UPDATE jng_sp_catalog SET image_uploaded='1' WHERE jng_sp_catalog_id IN ({$jcid_filter})");
}
//Get all catalog id included in this upload and upload last_active_status accordingly and price_uploaded to 1
$catalog_query = tep_db_query("SELECT jng_sp_catalog_id, active_status FROM jng_sp_upload_product_status WHERE jng_sp_upload_id={$upload_id}");
if (tep_db_num_rows($catalog_query) > 0) {
$active_status = array();
while ($row = tep_db_fetch_array($catalog_query)) {
if (!isset($active_status[$row['active_status']])) {
$active_status[$row['active_status']] = array();
}
$active_status[$row['active_status']][] = $row['jng_sp_catalog_id'];
}
foreach ($active_status as $status => $jcid) {
$jcid_filter = implode(',', $jcid);
tep_db_query("UPDATE jng_sp_catalog SET last_active_status='{$status}', price_uploaded='1' WHERE jng_sp_catalog_id IN ({$jcid_filter})");
}
}
} else {
tep_db_query("DELETE FROM jng_sp_otde_removed_ean WHERE jng_sp_upload_id={$upload_id}");
}
}