Пример #1
0
function updateBill($login, $password, $txn, $status)
{
    //обработка возможных ошибок авторизации
    if ($login != MODULE_PAYMENT_QIWI_ID) {
        return 150;
    }
    if (!empty($password) && $password != strtoupper(md5($txn . strtoupper(md5(MODULE_PAYMENT_QIWI_SECRET_KEY))))) {
        return 150;
    }
    // получаем номер заказа
    $transaction = intval($txn);
    // проверяем, есть ли такой заказ в базе
    $order_query = vam_db_query("select count(*) as total from " . TABLE_ORDERS . " where orders_id = '" . (int) $transaction . "'");
    $order_exists = vam_db_fetch_array($order_query);
    if ($order_exists['total'] <= 0) {
        return 210;
    }
    // меняем статус заказа при условии оплаты счёта
    if ($status == 60) {
        $sql_data_array = array('orders_status' => MODULE_PAYMENT_QIWI_ORDER_STATUS_ID);
        vam_db_perform('orders', $sql_data_array, 'update', "orders_id='" . $transaction . "'");
        $sql_data_arrax = array('orders_id' => $transaction, 'orders_status_id' => MODULE_PAYMENT_QIWI_ORDER_STATUS_ID, 'date_added' => 'now()', 'customer_notified' => '0', 'comments' => 'QIWI accepted this order payment');
        vam_db_perform('orders_status_history', $sql_data_arrax);
        // Отправляем письмо клиенту и админу о смене статуса заказа
        require_once DIR_WS_CLASSES . 'order.php';
        $order = new order($transaction);
        $vamTemplate = new vamTemplate();
        // assign language to template for caching
        $vamTemplate->assign('language', $_SESSION['language']);
        $vamTemplate->caching = false;
        $vamTemplate->assign('tpl_path', 'templates/' . CURRENT_TEMPLATE . '/');
        $vamTemplate->assign('logo_path', HTTP_SERVER . DIR_WS_CATALOG . 'templates/' . CURRENT_TEMPLATE . '/img/');
        $vamTemplate->assign('NAME', $order->customer['firstname'] . ' ' . $order->customer['lastname']);
        $vamTemplate->assign('ORDER_NR', $transaction);
        $vamTemplate->assign('ORDER_LINK', vam_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $transaction, 'SSL'));
        $vamTemplate->assign('ORDER_DATE', vam_date_long($order->info['date_purchased']));
        $lang_query = vam_db_query("select languages_id from " . TABLE_LANGUAGES . " where directory = '" . $_SESSION['language'] . "'");
        $lang = vam_db_fetch_array($lang_query);
        $lang = $lang['languages_id'];
        if (!isset($lang)) {
            $lang = $_SESSION['languages_id'];
        }
        $orders_status_array = array();
        $orders_status_query = vam_db_query("select orders_status_id, orders_status_name from " . TABLE_ORDERS_STATUS . " where language_id = '" . $lang . "'");
        while ($orders_status = vam_db_fetch_array($orders_status_query)) {
            $orders_statuses[] = array('id' => $orders_status['orders_status_id'], 'text' => $orders_status['orders_status_name']);
            $orders_status_array[$orders_status['orders_status_id']] = $orders_status['orders_status_name'];
        }
        $vamTemplate->assign('ORDER_STATUS', $orders_status_array[MODULE_PAYMENT_QIWI_ORDER_STATUS_ID]);
        $html_mail = $vamTemplate->fetch(CURRENT_TEMPLATE . '/admin/mail/' . $_SESSION['language'] . '/change_order_mail.html');
        $txt_mail = $vamTemplate->fetch(CURRENT_TEMPLATE . '/admin/mail/' . $_SESSION['language'] . '/change_order_mail.txt');
        include_once DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/payment/qiwi.php';
        // create subject
        $order_subject = str_replace('{$nr}', $transaction, MODULE_PAYMENT_QIWI_EMAIL_SUBJECT);
        // send mail to admin
        vam_php_mail(EMAIL_BILLING_ADDRESS, EMAIL_BILLING_NAME, EMAIL_BILLING_ADDRESS, STORE_NAME, EMAIL_BILLING_FORWARDING_STRING, $order->customer['email_address'], $order->customer['firstname'], '', '', $order_subject, $html_mail, $txt_mail);
        // send mail to customer
        vam_php_mail(EMAIL_BILLING_ADDRESS, EMAIL_BILLING_NAME, $order->customer['email_address'], $order->customer['firstname'] . ' ' . $order->customer['lastname'], '', EMAIL_BILLING_REPLY_ADDRESS, EMAIL_BILLING_REPLY_ADDRESS_NAME, '', '', $order_subject, $html_mail, $txt_mail);
    }
}
     }
     $messageStack->add_session(SUCCESS_BILLING, 'success');
     vam_redirect(vam_href_link(FILENAME_AFFILIATE_PAYMENT, vam_get_all_get_params(array('action')) . 'action=edit'));
     break;
 case 'update_payment':
     $pID = vam_db_prepare_input($_GET['pID']);
     $status = vam_db_prepare_input($_POST['status']);
     $payment_updated = false;
     $check_status_query = vam_db_query("select af.affiliate_email_address, ap.affiliate_lastname, ap.affiliate_firstname, ap.affiliate_payment_status, ap.affiliate_payment_date, ap.affiliate_payment_date from " . TABLE_AFFILIATE_PAYMENT . " ap, " . TABLE_AFFILIATE . " af where affiliate_payment_id = '" . vam_db_input($pID) . "' and af.affiliate_id = ap.affiliate_id ");
     $check_status = vam_db_fetch_array($check_status_query);
     if ($check_status['affiliate_payment_status'] != $status) {
         vam_db_query("update " . TABLE_AFFILIATE_PAYMENT . " set affiliate_payment_status = '" . vam_db_input($status) . "', affiliate_last_modified = now() where affiliate_payment_id = '" . vam_db_input($pID) . "'");
         $affiliate_notified = '0';
         // Notify Affiliate
         if ($_POST['notify'] == 'on') {
             $email = STORE_NAME . "\n" . EMAIL_SEPARATOR . "\n" . EMAIL_TEXT_AFFILIATE_PAYMENT_NUMBER . ' ' . $pID . "\n" . EMAIL_TEXT_INVOICE_URL . ' ' . vam_catalog_href_link(FILENAME_CATALOG_AFFILIATE_PAYMENT_INFO, 'payment_id=' . $pID, 'SSL') . "\n" . EMAIL_TEXT_PAYMENT_BILLED . ' ' . vam_date_long($check_status['affiliate_payment_date']) . "\n\n" . sprintf(EMAIL_TEXT_STATUS_UPDATE, $payments_status_array[$status]);
             vam_php_mail(AFFILIATE_EMAIL_ADDRESS, EMAIL_SUPPORT_NAME, $check_status['affiliate_email_address'], $check_status['affiliate_firstname'] . ' ' . $check_status['affiliate_lastname'], '', EMAIL_SUPPORT_REPLY_ADDRESS, EMAIL_SUPPORT_REPLY_ADDRESS_NAME, '', '', EMAIL_TEXT_SUBJECT, nl2br($email), $email);
             $affiliate_notified = '1';
         }
         vam_db_query("insert into " . TABLE_AFFILIATE_PAYMENT_STATUS_HISTORY . " (affiliate_payment_id, affiliate_new_value, affiliate_old_value, affiliate_date_added, affiliate_notified) values ('" . vam_db_input($pID) . "', '" . vam_db_input($status) . "', '" . $check_status['affiliate_payment_status'] . "', now(), '" . $affiliate_notified . "')");
         $order_updated = true;
     }
     if ($order_updated) {
         $messageStack->add_session(SUCCESS_PAYMENT_UPDATED, 'success');
     }
     vam_redirect(vam_href_link(FILENAME_AFFILIATE_PAYMENT, vam_get_all_get_params(array('action')) . 'action=edit'));
     break;
 case 'deleteconfirm':
     $pID = vam_db_prepare_input($_GET['pID']);
     vam_db_query("delete from " . TABLE_AFFILIATE_PAYMENT . " where affiliate_payment_id = '" . vam_db_input($pID) . "'");
     vam_db_query("delete from " . TABLE_AFFILIATE_PAYMENT_STATUS_HISTORY . " where affiliate_payment_id = '" . vam_db_input($pID) . "'");
$get_params = vam_get_all_get_params(array('reviews_id'));
$get_params = substr($get_params, 0, -1);
//remove trailing &
$reviews_query = "select rd.reviews_text, r.reviews_rating, r.reviews_id, r.products_id, r.customers_name, r.date_added, r.last_modified, r.reviews_read, p.products_id, pd.products_name, p.products_image from " . TABLE_REVIEWS . " r left join " . TABLE_PRODUCTS . " p on (r.products_id = p.products_id) left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on (p.products_id = pd.products_id and pd.language_id = '" . (int) $_SESSION['languages_id'] . "'), " . TABLE_REVIEWS_DESCRIPTION . " rd where r.reviews_id = '" . (int) $_GET['reviews_id'] . "' and r.reviews_id = rd.reviews_id and p.products_status = '1'";
$reviews_query = vam_db_query($reviews_query);
if (!vam_db_num_rows($reviews_query)) {
    vam_redirect(vam_href_link(FILENAME_REVIEWS));
}
$reviews = vam_db_fetch_array($reviews_query);
$breadcrumb->add(NAVBAR_TITLE_PRODUCT_REVIEWS, vam_href_link(FILENAME_PRODUCT_REVIEWS, $get_params));
vam_db_query("update " . TABLE_REVIEWS . " set reviews_read = reviews_read+1 where reviews_id = '" . $reviews['reviews_id'] . "'");
$reviews_text = vam_break_string(htmlspecialchars($reviews['reviews_text']), 60, '-<br />');
require DIR_WS_INCLUDES . 'header.php';
$vamTemplate->assign('PRODUCTS_NAME', $reviews['products_name']);
$vamTemplate->assign('AUTHOR', $reviews['customers_name']);
$vamTemplate->assign('DATE', vam_date_long($reviews['date_added']));
$vamTemplate->assign('REVIEWS_TEXT', nl2br($reviews_text));
$vamTemplate->assign('RATING', vam_image('templates/' . CURRENT_TEMPLATE . '/img/stars_' . $reviews['reviews_rating'] . '.gif', sprintf(TEXT_OF_5_STARS, $reviews['reviews_rating'])));
$vamTemplate->assign('PRODUCTS_LINK', vam_href_link(FILENAME_PRODUCT_INFO, vam_product_link($reviews['products_id'], $reviews['products_name'])));
$vamTemplate->assign('BUTTON_BACK', '<a class="button" href="' . vam_href_link(FILENAME_PRODUCT_REVIEWS, $get_params) . '">' . vam_image_button('back.png', IMAGE_BUTTON_BACK) . '</a>');
$vamTemplate->assign('BUTTON_BUY_NOW', '<a class="button" href="' . vam_href_link(FILENAME_DEFAULT, 'action=buy_now&BUYproducts_id=' . $reviews['products_id']) . '">' . vam_image_button('buy.png', IMAGE_BUTTON_IN_CART) . '</a>');
$products_image = DIR_WS_THUMBNAIL_IMAGES . $reviews['products_image'];
if (!is_file($products_image)) {
    $products_image = DIR_WS_THUMBNAIL_IMAGES . '../noimage.gif';
}
$image = vam_image($products_image, $reviews['products_name'], '', '', 'hspace="5" vspace="5"');
$vamTemplate->assign('IMAGE', $image);
$vamTemplate->assign('language', $_SESSION['language']);
// set cache ID
if (!CacheCheck()) {
    $vamTemplate->caching = 0;
Пример #4
0
 function before_process()
 {
     global $customer_id, $order, $vamPrice, $order_totals, $sendto, $billto, $languages_id, $payment, $currencies, $cart;
     global ${$payment};
     $order_id = substr($_SESSION['cart_yandex_id'], strpos($_SESSION['cart_yandex_id'], '-') + 1);
     // initialized for the email confirmation
     $products_ordered = '';
     $subtotal = 0;
     $total_tax = 0;
     for ($i = 0, $n = sizeof($order->products); $i < $n; $i++) {
         // Stock Update - Joao Correia
         if (STOCK_LIMITED == 'true') {
             if (DOWNLOAD_ENABLED == 'true') {
                 $stock_query_raw = "SELECT products_quantity, pad.products_attributes_filename, pad.products_attributes_is_pin \n                                FROM " . TABLE_PRODUCTS . " p\n                                LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n                                ON p.products_id=pa.products_id\n                                LEFT JOIN " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n                                ON pa.products_attributes_id=pad.products_attributes_id\n                                WHERE p.products_id = '" . vam_get_prid($order->products[$i]['id']) . "'";
                 // Will work with only one option for downloadable products
                 // otherwise, we have to build the query dynamically with a loop
                 $products_attributes = $order->products[$i]['attributes'];
                 if (is_array($products_attributes)) {
                     $stock_query_raw .= " AND pa.options_id = '" . $products_attributes[0]['option_id'] . "' AND pa.options_values_id = '" . $products_attributes[0]['value_id'] . "'";
                 }
                 $stock_query = vam_db_query($stock_query_raw);
             } else {
                 $stock_query = vam_db_query("select products_quantity from " . TABLE_PRODUCTS . " where products_id = '" . vam_get_prid($order->products[$i]['id']) . "'");
             }
             if (vam_db_num_rows($stock_query) > 0) {
                 $stock_values = vam_db_fetch_array($stock_query);
                 // do not decrement quantities if products_attributes_filename exists
                 if (DOWNLOAD_ENABLED != 'true' || !$stock_values['products_attributes_filename'] || $stock_values['products_attributes_is_pin'] == 1) {
                     $stock_left = $stock_values['products_quantity'] - $order->products[$i]['qty'];
                 } else {
                     $stock_left = $stock_values['products_quantity'];
                 }
                 vam_db_query("update " . TABLE_PRODUCTS . " set products_quantity = '" . $stock_left . "' where products_id = '" . vam_get_prid($order->products[$i]['id']) . "'");
                 if ($stock_left < 1 && STOCK_ALLOW_CHECKOUT == 'false') {
                     vam_db_query("update " . TABLE_PRODUCTS . " set products_status = '0' where products_id = '" . vam_get_prid($order->products[$i]['id']) . "'");
                 }
             }
         }
         // Update products_ordered (for bestsellers list)
         vam_db_query("update " . TABLE_PRODUCTS . " set products_ordered = products_ordered + " . sprintf('%d', $order->products[$i]['qty']) . " where products_id = '" . vam_get_prid($order->products[$i]['id']) . "'");
         //------insert customer choosen option to order--------
         $attributes_exist = '0';
         $products_ordered_attributes = '';
         if (isset($order->products[$i]['attributes'])) {
             $attributes_exist = '1';
             for ($j = 0, $n2 = sizeof($order->products[$i]['attributes']); $j < $n2; $j++) {
                 if (DOWNLOAD_ENABLED == 'true') {
                     $attributes_query = "select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix, pad.products_attributes_maxdays, pad.products_attributes_maxcount , pad.products_attributes_filename, pad.products_attributes_is_pin\n                                   from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n                                   left join " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad\n                                   on pa.products_attributes_id=pad.products_attributes_id\n                                   where pa.products_id = '" . $order->products[$i]['id'] . "'\n                                   and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "'\n                                   and pa.options_id = popt.products_options_id\n                                   and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "'\n                                   and pa.options_values_id = poval.products_options_values_id\n                                   and popt.language_id = '" . $_SESSION['languages_id'] . "'\n                                   and poval.language_id = '" . $_SESSION['languages_id'] . "'";
                     $attributes = vam_db_query($attributes_query);
                 } else {
                     $attributes = vam_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa where pa.products_id = '" . $order->products[$i]['id'] . "' and pa.options_id = '" . $order->products[$i]['attributes'][$j]['option_id'] . "' and pa.options_id = popt.products_options_id and pa.options_values_id = '" . $order->products[$i]['attributes'][$j]['value_id'] . "' and pa.options_values_id = poval.products_options_values_id and popt.language_id = '" . $_SESSION['languages_id'] . "' and poval.language_id = '" . $_SESSION['languages_id'] . "'");
                 }
                 $attributes_values = vam_db_fetch_array($attributes);
                 $products_ordered_attributes .= "\n\t" . $attributes_values['products_options_name'] . ' ' . $attributes_values['products_options_values_name'];
             }
         }
         //------insert customer choosen option eof ----
         $total_weight += $order->products[$i]['qty'] * $order->products[$i]['weight'];
         $total_tax += vam_calculate_tax($total_products_price, $products_tax) * $order->products[$i]['qty'];
         $total_cost += $total_products_price;
         $products_ordered .= $order->products[$i]['qty'] . ' x ' . $order->products[$i]['name'] . ' (' . $order->products[$i]['model'] . ') = ' . $vamPrice->Format($order->products[$i]['final_price'], true) . $products_ordered_attributes . "\n";
     }
     // initialize templates
     $vamTemplate = new vamTemplate();
     $vamTemplate->assign('address_label_customer', vam_address_format($order->customer['format_id'], $order->customer, 1, '', '<br />'));
     $vamTemplate->assign('address_label_shipping', vam_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br />'));
     if ($_SESSION['credit_covers'] != '1') {
         $vamTemplate->assign('address_label_payment', vam_address_format($order->billing['format_id'], $order->billing, 1, '', '<br />'));
     }
     $vamTemplate->assign('csID', $order->customer['csID']);
     $it = 0;
     $semextrfields = vamDBquery("select * from " . TABLE_EXTRA_FIELDS . " where fields_required_email = '1'");
     while ($dataexfes = vam_db_fetch_array($semextrfields, true)) {
         $cusextrfields = vamDBquery("select * from " . TABLE_CUSTOMERS_TO_EXTRA_FIELDS . " where customers_id = '" . (int) $_SESSION['customer_id'] . "' and fields_id = '" . $dataexfes['fields_id'] . "'");
         $rescusextrfields = vam_db_fetch_array($cusextrfields, true);
         $extrfieldsinf = vamDBquery("select fields_name from " . TABLE_EXTRA_FIELDS_INFO . " where fields_id = '" . $dataexfes['fields_id'] . "' and languages_id = '" . $_SESSION['languages_id'] . "'");
         $extrfieldsres = vam_db_fetch_array($extrfieldsinf, true);
         $extra_fields .= $extrfieldsres['fields_name'] . ' : ' . $rescusextrfields['value'] . "\n";
         $vamTemplate->assign('customer_extra_fields', $extra_fields);
     }
     $order_total = $order->getTotalData($order_id);
     $vamTemplate->assign('order_data', $order->getOrderData($order_id));
     $vamTemplate->assign('order_total', $order_total['data']);
     // assign language to template for caching
     $vamTemplate->assign('language', $_SESSION['language']);
     $vamTemplate->assign('tpl_path', 'templates/' . CURRENT_TEMPLATE . '/');
     $vamTemplate->assign('logo_path', HTTP_SERVER . DIR_WS_CATALOG . 'templates/' . CURRENT_TEMPLATE . '/img/');
     $vamTemplate->assign('oID', $order_id);
     if ($order->info['payment_method'] != '' && $order->info['payment_method'] != 'no_payment') {
         include DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_method'] . '.php';
         $payment_method = constant(strtoupper('MODULE_PAYMENT_' . $order->info['payment_method'] . '_TEXT_TITLE'));
     }
     $vamTemplate->assign('PAYMENT_METHOD', $payment_method);
     if ($order->info['shipping_method'] != '') {
         $shipping_method = $order->info['shipping_method'];
     }
     $vamTemplate->assign('SHIPPING_METHOD', $shipping_method);
     $vamTemplate->assign('DATE', vam_date_long($order->info['date_purchased']));
     $vamTemplate->assign('NAME', $order->customer['firstname'] . ' ' . $order->customer['lastname']);
     $vamTemplate->assign('COMMENTS', $order->info['comments']);
     $vamTemplate->assign('EMAIL', $order->customer['email_address']);
     $vamTemplate->assign('PHONE', $order->customer['telephone']);
     // dont allow cache
     $vamTemplate->caching = false;
     $html_mail = $vamTemplate->fetch(CURRENT_TEMPLATE . '/mail/' . $_SESSION['language'] . '/order_mail.html');
     $txt_mail = $vamTemplate->fetch(CURRENT_TEMPLATE . '/mail/' . $_SESSION['language'] . '/order_mail.txt');
     // create subject
     $order_subject = str_replace('{$nr}', $order_id, EMAIL_BILLING_SUBJECT_ORDER);
     $order_subject = str_replace('{$date}', strftime(DATE_FORMAT_LONG), $order_subject);
     $order_subject = str_replace('{$lastname}', $order->customer['lastname'], $order_subject);
     $order_subject = str_replace('{$firstname}', $order->customer['firstname'], $order_subject);
     // send mail to admin
     vam_php_mail(EMAIL_BILLING_ADDRESS, EMAIL_BILLING_NAME, EMAIL_BILLING_ADDRESS, STORE_NAME, EMAIL_BILLING_FORWARDING_STRING, $order->customer['email_address'], $order->customer['firstname'], '', '', $order_subject, $html_mail, $txt_mail);
     // send mail to customer
     vam_php_mail(EMAIL_BILLING_ADDRESS, EMAIL_BILLING_NAME, $order->customer['email_address'], $order->customer['firstname'] . ' ' . $order->customer['lastname'], '', EMAIL_BILLING_REPLY_ADDRESS, EMAIL_BILLING_REPLY_ADDRESS_NAME, '', '', $order_subject, $html_mail, $txt_mail);
     // load the after_process function from the payment modules
     $this->after_process();
     require_once DIR_WS_INCLUDES . 'affiliate_checkout_process.php';
     $_SESSION['cart']->reset(true);
     // unregister session variables used during checkout
     unset($_SESSION['sendto']);
     unset($_SESSION['billto']);
     unset($_SESSION['shipping']);
     unset($_SESSION['payment']);
     unset($_SESSION['comments']);
     unset($_SESSION['cart_yandex_id']);
     vam_redirect(vam_href_link(FILENAME_CHECKOUT_SUCCESS, '', 'SSL'));
 }
         $myRes = vam_db_query("update " . TABLE_ORDERS . " set orders_status = '" . $result['status'] . "', last_modified = now() where orders_id = '" . (int) $orderId . "' and orders_status <> '" . $result['status'] . "'");
         if (mysql_affected_rows() > 0) {
             //confirmation stuff
             $orders_statuses = array();
             $orders_status_array = array();
             $orders_status_query = vam_db_query("select orders_status_id, orders_status_name from " . TABLE_ORDERS_STATUS . " where language_id = '" . (int) $languages_id . "'");
             while ($orders_status = vam_db_fetch_array($orders_status_query)) {
                 $orders_statuses[] = array('id' => $orders_status['orders_status_id'], 'text' => $orders_status['orders_status_name']);
                 $orders_status_array[$orders_status['orders_status_id']] = $orders_status['orders_status_name'];
             }
             $check_status_query = vam_db_query("select customers_name, customers_email_address, orders_status, date_purchased from " . TABLE_ORDERS . " where orders_id = '" . (int) $orderId . "'");
             $check_status = vam_db_fetch_array($check_status_query);
             $customer_notified = '0';
             $notify_comments = '';
             $notify_comments = sprintf(SWED_EMAIL_TEXT_COMMENTS_UPDATE, SWED_EMAIL_TEXT_PAYMENT_SUCCESS) . "\n\n";
             $email = STORE_NAME . "\n" . SWED_EMAIL_SEPARATOR . "\n" . SWED_EMAIL_TEXT_ORDER_NUMBER . ' ' . $orderId . "\n" . SWED_EMAIL_TEXT_INVOICE_URL . ' ' . vam_href_link('account_history_info.php', 'order_id=' . $orderId, 'SSL') . "\n" . SWED_EMAIL_TEXT_DATE_ORDERED . ' ' . vam_date_long($check_status['date_purchased']) . "\n\n" . $notify_comments . sprintf(SWED_EMAIL_TEXT_STATUS_UPDATE, $orders_status_array[$result['status']]);
             vam_mail($check_status['customers_name'], $check_status['customers_email_address'], SWED_EMAIL_TEXT_SUBJECT, $email, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
             $customer_notified = '1';
             vam_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . (int) $orderId . "', '" . $result['status'] . "', now(), '" . 1 . "', '" . vam_db_input($notify_comments) . "')");
         }
     }
     //set the notification
 } else {
     //do nothing
     $cart->reset(true);
     // unregister session variables used during checkout
     vam_session_unregister('sendto');
     vam_session_unregister('billto');
     vam_session_unregister('shipping');
     vam_session_unregister('payment');
     vam_session_unregister('comments');
Пример #6
0
</td>
              </tr>
            </table></td>
          </tr>
          
          <tr>
          <td colspan="3">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">

              <tr>
                <td class="main"><b><?php 
    echo TABLE_HEADING_DATE_PURCHASED;
    ?>
:</b></td>
                <td class="main"><?php 
    echo vam_date_long($order->info['date_purchased']);
    ?>
</td>
              </tr>
	          <tr>
	            <td class="main"><b><?php 
    echo ENTRY_ORDER_NUMBER;
    ?>
</b></td>
	            <td class="main"><?php 
    echo $oID;
    ?>
</td>
	          </tr>
                    
          <tr>
Пример #7
0
        $qIcon='<img class="newsImage" src="'.substr ($qIcon, 0,$qI).'" alt="Image" />';
        }
        */
        $SEF_parameter = '';
        if (SEARCH_ENGINE_FRIENDLY_URLS == 'true') {
            $SEF_parameter = '&article=' . vam_cleanName($articles['articles_name']);
        }
        $SEF_parameter_author = '';
        if (SEARCH_ENGINE_FRIENDLY_URLS == 'true') {
            $SEF_parameter_author = '&author=' . vam_cleanName($articles['authors_name']);
        }
        $SEF_parameter_category = '';
        if (SEARCH_ENGINE_FRIENDLY_URLS == 'true') {
            $SEF_parameter_category = '&category=' . vam_cleanName($articles['topics_name']);
        }
        $module_content[] = array('ARTICLE_ID' => $articles['articles_id'], 'ARTICLE_NAME' => $articles['articles_name'], 'ARTICLE_IMAGE' => $articles['articles_image'], 'ARTICLE_SHORT_DESCRIPTION' => strip_tags($articles['articles_description']), 'ARTICLE_DATE' => vam_date_long($articles['articles_date_added']), 'ARTICLE_LINK' => vam_href_link(FILENAME_ARTICLE_INFO, 'articles_id=' . $articles['articles_id'] . $SEF_parameter), 'AUTHOR_NAME' => $articles['authors_name'], 'AUTHOR_LINK' => vam_href_link(FILENAME_ARTICLES, 'authors_id=' . $articles['authors_id'] . $SEF_parameter_author), 'ARTICLE_CATEGORY_NAME' => $articles['topics_name'], 'ARTICLE_CATEGORY_LINK' => vam_href_link(FILENAME_ARTICLES, 'tPath=' . $articles['topics_id'] . $SEF_parameter_category));
    }
} else {
    $vamTemplate->assign('no_articles', 'true');
}
$vamTemplate->assign('language', $_SESSION['language']);
$vamTemplate->caching = 0;
$vamTemplate->assign('module_content', $module_content);
$main_content = $vamTemplate->fetch(CURRENT_TEMPLATE . '/module/articles.html');
$vamTemplate->assign('main_content', $main_content);
$vamTemplate->assign('language', $_SESSION['language']);
$vamTemplate->caching = 0;
if (!defined(RM)) {
    $vamTemplate->load_filter('output', 'note');
}
$template = file_exists('templates/' . CURRENT_TEMPLATE . '/' . FILENAME_ARTICLES . '.html') ? CURRENT_TEMPLATE . '/' . FILENAME_ARTICLES . '.html' : CURRENT_TEMPLATE . '/index.html';
Пример #8
0
$module_content = array();
if (($orders_total = vam_count_customer_orders()) > 0) {
    $history_query_raw = "select o.orders_id, o.date_purchased, o.delivery_name, o.billing_name, ot.text as order_total, s.orders_status_name from " . TABLE_ORDERS . " o, " . TABLE_ORDERS_TOTAL . " ot, " . TABLE_ORDERS_STATUS . " s where o.customers_id = '" . (int) $_SESSION['customer_id'] . "' and o.orders_id = ot.orders_id and ot.class = 'ot_total' and o.orders_status = s.orders_status_id and s.language_id = '" . (int) $_SESSION['languages_id'] . "' order by orders_id DESC";
    $history_split = new splitPageResults($history_query_raw, $_GET['page'], MAX_DISPLAY_ORDER_HISTORY);
    $history_query = vam_db_query($history_split->sql_query);
    while ($history = vam_db_fetch_array($history_query)) {
        $products_query = vam_db_query("select count(*) as count from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . $history['orders_id'] . "'");
        $products = vam_db_fetch_array($products_query);
        if (vam_not_null($history['delivery_name'])) {
            $order_type = TEXT_ORDER_SHIPPED_TO;
            $order_name = $history['delivery_name'];
        } else {
            $order_type = TEXT_ORDER_BILLED_TO;
            $order_name = $history['billing_name'];
        }
        $module_content[] = array('ORDER_ID' => $history['orders_id'], 'ORDER_STATUS' => $history['orders_status_name'], 'ORDER_DATE' => vam_date_long($history['date_purchased']), 'ORDER_PRODUCTS' => $products['count'], 'ORDER_TOTAL' => strip_tags($history['order_total']), 'ORDER_BUTTON' => '<a class="button" href="' . vam_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'page=' . (empty($_GET['page']) ? "1" : (int) $_GET['page']) . '&order_id=' . $history['orders_id'], 'SSL') . '">' . vam_image_button('view.png', SMALL_IMAGE_BUTTON_VIEW) . '</a>');
    }
}
if ($orders_total > 0) {
    $vamTemplate->assign('SPLIT_BAR', TEXT_RESULT_PAGE . ' ' . $history_split->display_links(MAX_DISPLAY_PAGE_LINKS, vam_get_all_get_params(array('page', 'info', 'x', 'y'))));
    $vamTemplate->assign('SPLIT_BAR_PAGES', $history_split->display_count(TEXT_DISPLAY_NUMBER_OF_ORDERS));
}
$vamTemplate->assign('order_content', $module_content);
$vamTemplate->assign('language', $_SESSION['language']);
$vamTemplate->assign('BUTTON_BACK', '<a class="button" href="' . vam_href_link(FILENAME_ACCOUNT, '', 'SSL') . '">' . vam_image_button('back.png', IMAGE_BUTTON_BACK) . '</a>');
$vamTemplate->caching = 0;
$main_content = $vamTemplate->fetch(CURRENT_TEMPLATE . '/module/account_history.html');
$vamTemplate->assign('language', $_SESSION['language']);
$vamTemplate->assign('main_content', $main_content);
$vamTemplate->caching = 0;
if (!defined(RM)) {
Пример #9
0
 $vamTemplate->assign('order_total', $order_total['data']);
 // assign language to template for caching
 $vamTemplate->assign('language', $_SESSION['language']);
 $vamTemplate->assign('tpl_path', 'templates/' . CURRENT_TEMPLATE . '/');
 $vamTemplate->assign('logo_path', HTTP_SERVER . DIR_WS_CATALOG . 'templates/' . CURRENT_TEMPLATE . '/img/');
 $vamTemplate->assign('oID', $oID);
 if ($order->info['payment_method'] != '' && $order->info['payment_method'] != 'no_payment') {
     include DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_method'] . '.php';
     $payment_method = constant(strtoupper('MODULE_PAYMENT_' . $order->info['payment_method'] . '_TEXT_TITLE'));
 }
 $vamTemplate->assign('PAYMENT_METHOD', $payment_method);
 if ($order->info['shipping_method'] != '') {
     $shipping_method = $order->info['shipping_method'];
 }
 $vamTemplate->assign('SHIPPING_METHOD', $shipping_method);
 $vamTemplate->assign('DATE', vam_date_long($order->info['date_purchased']));
 $vamTemplate->assign('NAME', $order->customer['name']);
 $vamTemplate->assign('COMMENTS', $order->info['comments']);
 $vamTemplate->assign('EMAIL', $order->customer['email_address']);
 $vamTemplate->assign('PHONE', $order->customer['telephone']);
 $vamTemplate->assign('PAYMENT_INFO_HTML', constant(MODULE_PAYMENT_ . strtoupper($order->info['payment_method']) . _TEXT_DESCRIPTION));
 $vamTemplate->assign('PAYMENT_INFO_TXT', str_replace("<br />", "\n", constant(MODULE_PAYMENT_ . strtoupper($order->info['payment_method']) . _TEXT_DESCRIPTION)));
 // dont allow cache
 $vamTemplate->caching = false;
 $html_mail = $vamTemplate->fetch(CURRENT_TEMPLATE . '/mail/' . $_SESSION['language'] . '/order_mail.html');
 $txt_mail = $vamTemplate->fetch(CURRENT_TEMPLATE . '/mail/' . $_SESSION['language'] . '/order_mail.txt');
 // create subject
 $order_subject = str_replace('{$nr}', $oID, EMAIL_BILLING_SUBJECT_ORDER);
 $order_subject = str_replace('{$date}', strftime(DATE_FORMAT_LONG), $order_subject);
 $order_subject = str_replace('{$lastname}', $order->customer['lastname'], $order_subject);
 $order_subject = str_replace('{$firstname}', $order->customer['firstname'], $order_subject);
        ?>
                    <tr class="dataTableRow" onmouseover="this.className='dataTableRowOver';this.style.cursor='hand'" onmouseout="this.className='dataTableRow'">
<?php 
        switch ($srView) {
            case '3':
                ?>
                      <td class="dataTableContent" align="right"><?php 
                echo vam_date_long(date("Y-m-d\\ H:i:s", $sr->showDate)) . " - " . vam_date_short(date("Y-m-d\\ H:i:s", $sr->showDateEnd));
                ?>
</td>
<?php 
                break;
            case '4':
                ?>
                      <td class="dataTableContent" align="right"><?php 
                echo vam_date_long(date("Y-m-d\\ H:i:s", $sr->showDate));
                ?>
</td>
<?php 
                break;
            default:
                ?>
                      <td class="dataTableContent" align="right"><?php 
                echo vam_date_short(date("Y-m-d\\ H:i:s", $sr->showDate)) . " - " . vam_date_short(date("Y-m-d\\ H:i:s", $sr->showDateEnd));
                ?>
</td>
<?php 
        }
        ?>
                      <td class="dataTableContent" align="right"><?php 
        echo $info[0]['order'];
Пример #11
0
$article_check_query = vamDBquery($article_check_query);
$article_check = vam_db_fetch_array($article_check_query, true);
$article_info_query = "select a.articles_id, a.articles_date_added, a.articles_date_available, a.authors_id, ad.articles_name, ad.articles_description, ad.articles_url, ad.articles_viewed, au.authors_name from " . TABLE_ARTICLES . " a left join " . TABLE_AUTHORS . " au on a.authors_id = au.authors_id, " . TABLE_ARTICLES_DESCRIPTION . " ad where a.articles_status = '1' and a.articles_id = '" . (int) $_GET['articles_id'] . "' and ad.articles_id = a.articles_id and ad.language_id = '" . (int) $_SESSION['languages_id'] . "'";
$article_info_query = vamDBquery($article_info_query);
$article_info = vam_db_fetch_array($article_info_query, true);
vam_db_query("update " . TABLE_ARTICLES_DESCRIPTION . " set articles_viewed = articles_viewed+1 where articles_id = '" . (int) $_GET['articles_id'] . "' and language_id = '" . (int) $_SESSION['languages_id'] . "'");
if ($article_check['total'] > 0) {
    $vamTemplate->assign('no_article', 'false');
    $SEF_parameter_author = '';
    if (SEARCH_ENGINE_FRIENDLY_URLS == 'true') {
        $SEF_parameter_author = '&author=' . vam_cleanName($article_info['authors_name']);
    }
    $vamTemplate->assign('ARTICLE_NAME', $article_info['articles_name']);
    $vamTemplate->assign('ARTICLE_DESCRIPTION', $article_info['articles_description']);
    $vamTemplate->assign('ARTICLE_VIEWED', $article_info['articles_viewed']);
    $vamTemplate->assign('ARTICLE_DATE', vam_date_long($article_info['articles_date_added']));
    $vamTemplate->assign('ARTICLE_URL', $article_info['articles_url']);
    $vamTemplate->assign('AUTHOR_NAME', $article_info['authors_name']);
    $vamTemplate->assign('AUTHOR_LINK', vam_href_link(FILENAME_ARTICLES, 'authors_id=' . $article_info['authors_id'] . $SEF_parameter_author));
    include DIR_WS_MODULES . FILENAME_ARTICLES_XSELL;
} else {
    $vamTemplate->assign('no_article', 'true');
}
$vamTemplate->assign('language', $_SESSION['language']);
$vamTemplate->caching = 0;
$vamTemplate->assign('module_content', $module_content);
$main_content = $vamTemplate->fetch(CURRENT_TEMPLATE . '/module/article_info.html');
$vamTemplate->assign('main_content', $main_content);
$vamTemplate->assign('language', $_SESSION['language']);
$vamTemplate->caching = 0;
if (!defined(RM)) {
Пример #12
0
                $dl[$jj]['download_link'] = '';
            } else {
                $dl[$jj]['download_link'] = $downloads['products_name'] . ': ' . $pinstring;
            }
        } else {
            //usual stuff
            //<!-- left box -->
            // The link will appear only if:
            // - Download remaining count is > 0, AND
            // - The file is present in the DOWNLOAD directory, AND EITHER
            // - No expiry date is enforced (maxdays == 0), OR
            // - The expiry date is not reached
            if ($downloads['download_count'] > 0 && file_exists(DIR_FS_DOWNLOAD . $downloads['orders_products_filename']) && ($downloads['download_maxdays'] == 0 || $download_timestamp > time()) && $order_status >= DOWNLOAD_MIN_ORDERS_STATUS) {
                $dl[$jj]['download_link'] = '<a href="' . vam_href_link(FILENAME_DOWNLOAD, 'order=' . $last_order . '&id=' . $downloads['orders_products_download_id']) . '">' . $downloads['products_name'] . '</a>';
                $dl[$jj]['pic_link'] = vam_href_link(FILENAME_DOWNLOAD, 'order=' . $last_order . '&id=' . $downloads['orders_products_download_id']);
            } else {
                $dl[$jj]['download_link'] = $downloads['products_name'];
            }
            //<!-- right box -->
            $dl[$jj]['date'] = vam_date_long($download_expiry);
            $dl[$jj]['count'] = $downloads['download_count'];
            $jj++;
        }
    }
}
$module->assign('dl', $dl);
$module->assign('language', $_SESSION['language']);
$module->assign('tpl_path', 'templates/' . CURRENT_TEMPLATE . '/');
$module->caching = 0;
$module = $module->fetch(CURRENT_TEMPLATE . '/module/downloads.html');
$vamTemplate->assign('downloads_content', $module);
Пример #13
0
      </tr>
<?php 
        if ($aInfo->articles_date_available > date('Y-m-d')) {
            ?>
      <tr>
        <td align="center" class="smallText"><?php 
            echo sprintf(TEXT_ARTICLE_DATE_AVAILABLE, vam_date_long($aInfo->articles_date_available));
            ?>
		</td>
      </tr>
<?php 
        } else {
            ?>
      <tr>
        <td align="center" class="smallText"><?php 
            echo sprintf(TEXT_ARTICLE_DATE_ADDED, vam_date_long($aInfo->articles_date_added));
            ?>
</td>
      </tr>
<?php 
        }
        ?>
      <tr>
        <td><?php 
        echo vam_draw_separator('pixel_trans.gif', '1', '10');
        ?>
</td>
      </tr>
<?php 
    }
    if (isset($_GET['read']) && $_GET['read'] == 'only') {
Пример #14
0
     }
     if ($discount != '0.00') {
         $info->assign('PRODUCTS_DISCOUNT', $discount . '%');
     }
 }
 include DIR_WS_MODULES . 'product_attributes.php';
 include DIR_WS_MODULES . 'product_reviews.php';
 if (vam_not_null($product->data['products_url'])) {
     $info->assign('PRODUCTS_URL', sprintf(TEXT_MORE_INFORMATION, vam_href_link(FILENAME_REDIRECT, 'action=product&id=' . $product->data['products_id'], 'NONSSL', true, false)));
 }
 $info->assign('PRODUCTS_URL1', $product->data['products_url']);
 if ($product->data['products_date_available'] > date('Y-m-d H:i:s')) {
     $info->assign('PRODUCTS_DATE_AVIABLE', sprintf(TEXT_DATE_AVAILABLE, vam_date_long($product->data['products_date_available'])));
 } else {
     if ($product->data['products_date_added'] != '0000-00-00 00:00:00') {
         $info->assign('PRODUCTS_ADDED', sprintf(TEXT_DATE_ADDED, vam_date_long($product->data['products_date_added'])));
     }
 }
 if ($_SESSION['customers_status']['customers_status_graduated_prices'] == 1) {
     include DIR_WS_MODULES . FILENAME_GRADUATED_PRICE;
 }
 $extra_fields_query = vamDBquery("\n                      SELECT pef.products_extra_fields_id as id, pef.products_extra_fields_status as status, pef.products_extra_fields_name as name, ptf.products_extra_fields_value as value\n                      FROM " . TABLE_PRODUCTS_EXTRA_FIELDS . " pef\n             LEFT JOIN  " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . " ptf\n            ON ptf.products_extra_fields_id=pef.products_extra_fields_id\n            WHERE ptf.products_id=" . $product->data['products_id'] . " and ptf.products_extra_fields_value<>'' and (pef.languages_id='0' or pef.languages_id='" . $_SESSION['languages_id'] . "')\n            ORDER BY products_extra_fields_order");
 while ($extra_fields = vam_db_fetch_array($extra_fields_query, true)) {
     if (!$extra_fields['status']) {
         // show only enabled extra field
         continue;
     }
     $extra_fields_data[] = array('NAME' => $extra_fields['name'], 'VALUE' => $extra_fields['value'], 'ID' => $extra_fields['id']);
 }
 $info->assign('extra_fields_data', $extra_fields_data);
 $info->assign('info_message', $_SESSION['error_cart_msg']);