function tep_get_reviews_type_info($reviews_types_id, $language_id, $field = 'reviews_types_name') { if (tep_db_field_exists(TABLE_REVIEWS_TYPES, $field)) { $type_info_query = tep_db_query("select " . tep_db_input($field) . " as field from " . TABLE_REVIEWS_TYPES . " where reviews_types_id = '" . (int) $reviews_types_id . "' and language_id = '" . (int) $language_id . "'"); $type_info = tep_db_fetch_array($type_info_query); return $type_info['field']; } else { return false; } }
function tep_get_metatags_info($metatags_content, $content_type, $content_id, $language_id = '') { global $languages_id; if (empty($language_id)) { $language_id = $languages_id; } if (!tep_db_field_exists(TABLE_METATAGS, $metatags_content)) { return false; } $query = tep_db_query("select " . tep_db_input($metatags_content) . " as value from " . TABLE_METATAGS . " where content_type = '" . tep_db_input($content_type) . "' and content_id = '" . (int) $content_id . "' and language_id = '" . (int) $language_id . "'"); $row = tep_db_fetch_array($query); return $row['value']; }
$old_shipping_method_class = $order->delivery['delivery_method_class']; $old_shipping_method = $order->delivery['delivery_method']; $sql_data_array = array('customers_name' => tep_db_prepare_input(stripslashes($update_customer_name)), 'customers_company' => tep_db_prepare_input(stripslashes($update_customer_company)), 'customers_company_full_name' => tep_db_prepare_input(stripslashes($HTTP_POST_VARS['company_full'])), 'customers_company_name' => tep_db_prepare_input(stripslashes($HTTP_POST_VARS['update_customer_company'])), 'customers_company_inn' => tep_db_prepare_input(stripslashes($HTTP_POST_VARS['company_inn'])), 'customers_company_kpp' => tep_db_prepare_input(stripslashes($HTTP_POST_VARS['company_kpp'])), 'customers_company_ogrn' => tep_db_prepare_input(stripslashes($HTTP_POST_VARS['company_ogrn'])), 'customers_company_okpo' => tep_db_prepare_input(stripslashes($HTTP_POST_VARS['company_okpo'])), 'customers_company_okogu' => tep_db_prepare_input(stripslashes($HTTP_POST_VARS['company_okogu'])), 'customers_company_okato' => tep_db_prepare_input(stripslashes($HTTP_POST_VARS['company_okato'])), 'customers_company_okved' => tep_db_prepare_input(stripslashes($HTTP_POST_VARS['company_okved'])), 'customers_company_okfs' => tep_db_prepare_input(stripslashes($HTTP_POST_VARS['company_okfs'])), 'customers_company_okopf' => tep_db_prepare_input(stripslashes($HTTP_POST_VARS['company_okopf'])), 'customers_company_address_corporate' => tep_db_prepare_input(stripslashes($HTTP_POST_VARS['company_address_corporate'])), 'customers_company_address_post' => tep_db_prepare_input(stripslashes($HTTP_POST_VARS['company_address_post'])), 'customers_company_telephone' => tep_db_prepare_input(stripslashes($HTTP_POST_VARS['company_telephone'])), 'customers_company_fax' => tep_db_prepare_input(stripslashes($HTTP_POST_VARS['company_fax'])), 'customers_company_bank' => tep_db_prepare_input(stripslashes($HTTP_POST_VARS['company_bank'])), 'customers_company_rs' => tep_db_prepare_input(stripslashes($HTTP_POST_VARS['company_rs'])), 'customers_company_ks' => tep_db_prepare_input(stripslashes($HTTP_POST_VARS['company_ks'])), 'customers_company_bik' => tep_db_prepare_input(stripslashes($HTTP_POST_VARS['company_bik'])), 'customers_company_general' => tep_db_prepare_input(stripslashes($HTTP_POST_VARS['company_general'])), 'customers_company_financial' => tep_db_prepare_input(stripslashes($HTTP_POST_VARS['company_financial'])), 'customers_street_address' => tep_db_prepare_input(stripslashes($update_customer_street_address)), 'customers_suburb' => tep_db_prepare_input(stripslashes($update_customer_suburb)), 'customers_city' => tep_db_prepare_input(stripslashes($update_customer_city)), 'customers_state' => tep_db_prepare_input(stripslashes($update_customer_state)), 'customers_postcode' => tep_db_prepare_input($update_customer_postcode), 'customers_country' => tep_db_prepare_input(stripslashes($update_customer_country)), 'customers_telephone' => tep_db_prepare_input($update_customer_telephone), 'customers_email_address' => tep_db_prepare_input($update_customer_email_address), 'billing_name' => tep_db_prepare_input(stripslashes($update_billing_name)), 'billing_company' => tep_db_prepare_input(stripslashes($update_billing_company)), 'billing_street_address' => tep_db_prepare_input(stripslashes($update_billing_street_address)), 'billing_suburb' => tep_db_prepare_input(stripslashes($update_billing_suburb)), 'billing_city' => tep_db_prepare_input(stripslashes($update_billing_city)), 'billing_state' => tep_db_prepare_input(stripslashes($update_billing_state)), 'billing_postcode' => tep_db_prepare_input($update_billing_postcode), 'billing_country' => tep_db_input(stripslashes($update_billing_country)), 'billing_telephone' => tep_db_prepare_input($update_billing_telephone), 'delivery_name' => tep_db_prepare_input(stripslashes($update_delivery_name)), 'delivery_company' => tep_db_prepare_input(stripslashes($update_delivery_company)), 'delivery_street_address' => tep_db_prepare_input(stripslashes($update_delivery_street_address)), 'delivery_suburb' => tep_db_prepare_input(stripslashes($update_delivery_suburb)), 'delivery_city' => tep_db_prepare_input(stripslashes($update_delivery_city)), 'delivery_state' => tep_db_prepare_input(stripslashes($update_delivery_state)), 'delivery_postcode' => tep_db_prepare_input($update_delivery_postcode), 'delivery_country' => tep_db_prepare_input(stripslashes($update_delivery_country)), 'delivery_telephone' => tep_db_prepare_input($update_delivery_telephone), 'delivery_self_address' => tep_db_prepare_input($self_delivery_addresses_array[$update_delivery_self_address_id]), 'delivery_self_address_id' => (int) $update_delivery_self_address_id, 'payment_method' => tep_db_prepare_input($payment_method), 'payment_method_class' => tep_db_prepare_input($update_info_payment_method), 'cc_type' => tep_db_prepare_input($update_info_cc_type), 'cc_owner' => tep_db_prepare_input($update_info_cc_owner), 'cc_expires' => tep_db_prepare_input($update_info_cc_expires), 'orders_status' => tep_db_prepare_input($status), 'last_modified' => 'now()'); if (tep_db_field_exists(TABLE_ORDERS, 'customers_referer')) { $sql_data_array['customers_referer'] = tep_db_prepare_input($HTTP_POST_VARS['referer']); } if (tep_db_field_exists(TABLE_ORDERS, 'payer_requisites')) { $sql_data_array['payer_requisites'] = tep_db_prepare_input($HTTP_POST_VARS['payer_requisites']); } if (tep_db_field_exists(TABLE_ORDERS, 'delivery_date')) { $sql_data_array['delivery_date'] = tep_db_prepare_input($delivery_date); } if (tep_db_field_exists(TABLE_ORDERS, 'delivery_time')) { $sql_data_array['delivery_time'] = tep_db_prepare_input($delivery_time); } if (tep_db_field_exists(TABLE_ORDERS, 'comments')) { $sql_data_array['comments'] = tep_db_prepare_input($comments); } // Update Order Info if (substr($update_info_cc_number, 0, 8) != '(Last 4)') { $sql_data_array['cc_number'] = tep_db_prepare_input($update_info_cc_number); } tep_db_perform(TABLE_ORDERS, $sql_data_array, 'update', "orders_id = '" . (int) $oID . "'"); $order_updated = true; $customer_notified = '0'; // Update Status History & Email Customer if Necessary if ($check_status['orders_status'] != $status || tep_not_null($comments)) { // Notify Customer if (isset($HTTP_POST_VARS['notify']) && $HTTP_POST_VARS['notify'] == 'on') { $notify_comments = ''; if (isset($HTTP_POST_VARS['notify_comments']) && $HTTP_POST_VARS['notify_comments'] == 'on' && tep_not_null($comments)) {
if (tep_not_null($prev_file['image']) && $prev_file['image'] != $upload->filename) { @unlink(DIR_FS_CATALOG_IMAGES . $prev_file['image']); } tep_db_query("update " . TABLE_LANGUAGES . " set image = '" . tep_db_input($upload->filename) . "' where languages_id = '" . (int) $lID . "'"); } } tep_redirect(tep_href_link(FILENAME_LANGUAGES, 'page=' . $HTTP_GET_VARS['page'] . '&lID=' . $HTTP_GET_VARS['lID'])); break; case 'deleteconfirm': $lID = tep_db_prepare_input($HTTP_GET_VARS['lID']); $result = tep_db_list_tables(DB_DATABASE); for ($i = 0; $i < tep_db_num_rows($result); $i++) { $tablename = tep_db_tablename($result, $i); if (tep_db_field_exists($tablename, 'language_id')) { tep_db_query("delete from " . tep_db_input($tablename) . " where language_id = '" . (int) $lID . "'"); } elseif (tep_db_field_exists($tablename, 'languages_id')) { tep_db_query("delete from " . tep_db_input($tablename) . " where languages_id = '" . (int) $lID . "'"); } } tep_redirect(tep_href_link(FILENAME_LANGUAGES, 'page=' . $HTTP_GET_VARS['page'])); break; case 'delete': $lID = tep_db_prepare_input($HTTP_GET_VARS['lID']); $lng_query = tep_db_query("select code, default_status from " . TABLE_LANGUAGES . " where languages_id = '" . (int) $lID . "'"); $lng = tep_db_fetch_array($lng_query); $remove_language = true; if ($lng['default_status'] == '1') { $remove_language = false; $messageStack->add(ERROR_REMOVE_DEFAULT_LANGUAGE, 'error'); } break;
<?php require 'includes/application_top.php'; $action = isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : ''; $type = isset($HTTP_GET_VARS['type']) ? $HTTP_GET_VARS['type'] : 'static'; $tPath = isset($HTTP_GET_VARS['tPath']) ? (int) $HTTP_GET_VARS['tPath'] : 0; if (!tep_db_field_exists(TABLE_BLOCKS, 'blocks_status')) { tep_db_query("alter table " . TABLE_BLOCKS . " add blocks_status smallint not null default '1'"); } if (!tep_db_field_exists(TABLE_BLOCKS_TYPES, 'blocks_types_multiple')) { tep_db_query("alter table " . TABLE_BLOCKS_TYPES . " add blocks_types_multiple smallint not null default '1'"); } if (!in_array($type, array('dynamic', 'static'))) { $type = 'static'; } if (DEBUG_MODE != 'on') { $type = 'static'; $allow_edit = true; $dissallowed_actions_1 = array('new_type', 'insert_type', 'edit_type', 'update_type', 'delete_type', 'delete_type_confirm'); $dissallowed_actions_2 = array('new_block', 'insert_block', 'delete_block', 'delete_block_confirm'); $dissallowed_actions_3 = array('edit_block', 'update_block'); if (in_array($action, $dissallowed_actions_1)) { $allow_edit = false; } elseif ($tPath == 0 && in_array($action, $dissallowed_actions_2)) { $allow_edit = false; } elseif ($tPath == 0 && in_array($action, $dissallowed_actions_3)) { if (isset($HTTP_GET_VARS['bID'])) { $block_info_query = tep_db_query("select blocks_filename from " . TABLE_BLOCKS . " where blocks_id = '" . (int) $HTTP_GET_VARS['bID'] . "'"); $block_info = tep_db_fetch_array($block_info_query); if (tep_not_null($block_info['blocks_filename'])) { $allow_edit = false;
if (tep_not_null($cInfo->categories_image) && file_exists(DIR_FS_CATALOG_IMAGES . $cInfo->categories_image)) { $contents[] = array('text' => '<br>' . tep_image(DIR_WS_CATALOG_IMAGES . $cInfo->categories_image, $cInfo->categories_name) . '<br>' . $cInfo->categories_image); } } elseif (isset($pInfo) && is_object($pInfo)) { // product info box contents $heading[] = array('text' => '<strong>' . tep_get_products_name($pInfo->products_id, $languages_id) . '</strong>'); $contents[] = array('align' => 'center', 'text' => '<a href="' . tep_href_link(FILENAME_CATEGORIES, tep_get_all_get_params(array('pID', 'action')) . 'pID=' . $pInfo->products_id . '&action=edit_product') . '">' . tep_image_button('button_edit.gif', IMAGE_EDIT) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, tep_get_all_get_params(array('pID', 'action')) . 'pID=' . $pInfo->products_id . '&action=delete_product') . '">' . tep_image_button('button_delete.gif', IMAGE_DELETE) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, tep_get_all_get_params(array('pID', 'action')) . 'pID=' . $pInfo->products_id . '&action=move_product') . '">' . tep_image_button('button_move.gif', IMAGE_MOVE) . '</a> <a href="' . tep_href_link(FILENAME_CATEGORIES, tep_get_all_get_params(array('pID', 'action')) . 'pID=' . $pInfo->products_id . '&action=copy_to') . '">' . tep_image_button('button_copy_to.gif', IMAGE_COPY_TO) . '</a>'); $contents[] = array('text' => '<br>' . TEXT_DATE_ADDED . ' ' . tep_date_short($pInfo->products_date_added)); if (tep_not_null($pInfo->products_last_modified)) { $contents[] = array('text' => TEXT_LAST_MODIFIED . ' ' . tep_date_short($pInfo->products_last_modified)); } if (date('Y-m-d') < $pInfo->products_date_available) { $contents[] = array('text' => TEXT_DATE_AVAILABLE . ' ' . tep_date_short($pInfo->products_date_available)); } $contents[] = array('text' => '<br>' . tep_info_image('thumbs/' . $pInfo->products_image, $pInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '<br>' . $pInfo->products_image); $contents[] = array('text' => '<br>' . TEXT_PRODUCTS_PRICE_INFO . ' ' . $currencies->format($pInfo->products_price) . '<br>' . TEXT_PRODUCTS_QUANTITY_INFO . ' ' . $pInfo->products_quantity . (tep_db_field_exists(TABLE_PRODUCTS, 'products_stock') ? '<br>' . TEXT_PRODUCTS_STOCK_INFO . ' ' . $pInfo->products_stock : '')); $contents[] = array('text' => '<br>' . TEXT_PRODUCTS_AVERAGE_RATING . ' ' . number_format($pInfo->average_rating, 2) . '%'); } } else { // create category/product info $heading[] = array('text' => '<strong>' . EMPTY_CATEGORY . '</strong>'); $contents[] = array('text' => TEXT_NO_CHILD_CATEGORIES_OR_PRODUCTS); } break; } if (tep_not_null($heading) && tep_not_null($contents)) { echo ' <td width="25%" valign="top">' . "\n"; $box = new box(); echo $box->infoBox($heading, $contents); echo ' </td>' . "\n"; }
<td class="main" width="200"><?php echo ENTRY_DISCOUNT; ?> </td> <td class="main"><?php if ($error == true) { echo $customers_discount . '%' . tep_draw_hidden_field('customers_discount'); } else { echo tep_draw_input_field('customers_discount', (string) (double) $cInfo->customers_discount, 'size="3" maxlength="4"') . '%'; } ?> </td> </tr> <?php } if (tep_db_field_exists(TABLE_CUSTOMERS, 'customers_discount_type')) { ?> <tr> <td class="main" width="200"><?php echo ENTRY_DISCOUNT_TYPE; ?> </td> <td class="main"><?php if ($error == true) { echo ($customers_discount_type == 'purchase' ? ENTRY_DISCOUNT_TYPE_PURCHASE : ENTRY_DISCOUNT_TYPE_DISCOUNT) . tep_draw_hidden_field('customers_discount_type'); } else { echo tep_draw_radio_field('customers_discount_type', 'discount', $cInfo->customers_discount_type == 'discount') . ' ' . ENTRY_DISCOUNT_TYPE_DISCOUNT . '<br>' . "\n" . tep_draw_radio_field('customers_discount_type', 'purchase', $cInfo->customers_discount_type == 'purchase') . ' ' . ENTRY_DISCOUNT_TYPE_PURCHASE; } ?> </td> </tr>
function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Персональная скидка', 'MODULE_ORDER_TOTAL_DISCOUNT_STATUS', 'false', 'Показывать персональную скидку клиента?', '6', '10','tep_cfg_select_option(array(\\'true\\', \\'false\\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Статус выполненных заказов', 'MODULE_ORDER_TOTAL_DISCOUNT_ORDER_STATUS_ID', '0', 'Укажите статус, при котором заказ считается выполненным (для расчета накопительной скидки', '6', '20', 'tep_cfg_pull_down_order_statuses(', 'tep_get_order_status_name', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Таблица скидок 1 - накопительная скидка', 'MODULE_ORDER_TOTAL_DISCOUNT_TABLE_1', '1000:3,10000:6,40000:9,100000:12', 'Задайте (в валюте магазина) размер скидки в зависимости от суммы выполненных заказов. Например: 1000:3,10000:6,40000:9,100000:12, и т.д. (т.е. при сумме свыше 1000 клиент получит скидку 3%, от 1000 до 40000 - скидку 6%, от 40000 до 100000 - скидку в 9% и т.д.)', '6', '30', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Обнуление накопительной скидки', 'MODULE_ORDER_TOTAL_DISCOUNT_MONTHES', '0', 'Укажите время (в месяцах), в течение которого при отсутствии заказов накопительная скидка клиента будет обнулена (0 - без ограничений)', '6', '40', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Таблица скидок 2 - оптовая скидка', 'MODULE_ORDER_TOTAL_DISCOUNT_TABLE_2', '1000:3,10000:6,40000:9,100000:12', 'Задайте размер скидки в зависимости от суммы заказанных товаров.)', '6', '50', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Таблица скидок 3 - оптовая скидка', 'MODULE_ORDER_TOTAL_DISCOUNT_TABLE_3', '15:10,50:12,100:15', 'Задайте размер скидки в зависимости от количества заказанных позиций одного наименования. Например: 15:10,50:12,100:15, и т.д. (т.е. при заказе одного наименования от 15шт. до 50шт. клиент получит скидку 10%, от 50шт. до 100шт. - скидку 12%, от 100шт. и выше - скидку в 15%)', '6', '60', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Оптовая скидка - минимальная цена товара', 'MODULE_ORDER_TOTAL_DISCOUNT_MIN_PRODUCT_PRICE', '15', 'Задайте (в валюте магазина) минимальную цену товара, на который распространяется 3-й вид скидки', '6', '70', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Не давать скидку', 'MODULE_ORDER_TOTAL_DISCOUNT_RESTRICTED_EMAILS', '', 'Перечислите (по одному в строке) email-адреса, обладатели которых не должны получать скидку (символ "*" заменяет любую последовательность символов.', '6', '80', 'tep_cfg_textarea(', 'nl2br', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Порядок вывода', 'MODULE_ORDER_TOTAL_DISCOUNT_SORT_ORDER', '1', 'Порядок вывода на сайте.', '6', '90', now())"); if (!tep_db_field_exists(TABLE_CUSTOMERS, 'customers_discount')) { tep_db_query("alter table " . TABLE_CUSTOMERS . " add customers_discount decimal(5,2) default '0'"); } }