$products[$i]['product_details'] = $product_details; $products[$i]['product_rating'] = $product_rating; $products[$i]['product_price'] = $product_price; $products[$i]['product_price_raw'] = $product_price_raw; $products[$i]['product_sku'] = $db_browse->f("product_sku"); $products[$i]['product_weight'] = $db_browse->f("product_weight"); $products[$i]['product_weight_uom'] = $db_browse->f("product_weight_uom"); $products[$i]['product_length'] = $db_browse->f("product_length"); $products[$i]['product_width'] = $db_browse->f("product_width"); $products[$i]['product_height'] = $db_browse->f("product_height"); $products[$i]['product_lwh_uom'] = $db_browse->f("product_lwh_uom"); $products[$i]['product_in_stock'] = $db_browse->f("product_in_stock"); $products[$i]['product_available_date'] = $VM_LANG->convert(vmFormatDate($db_browse->f("product_available_date"), $VM_LANG->_('DATE_FORMAT_LC'))); $products[$i]['product_availability'] = $db_browse->f("product_availability"); $products[$i]['cdate'] = $VM_LANG->convert(vmFormatDate($db_browse->f("cdate"), $VM_LANG->_('DATE_FORMAT_LC'))); $products[$i]['mdate'] = $VM_LANG->convert(vmFormatDate($db_browse->f("mdate"), $VM_LANG->_('DATE_FORMAT_LC'))); $products[$i]['product_url'] = $db_browse->f("product_url"); } // END OF while loop // Need to re-order here, because the browse query doesn't fetch discounts if ($orderby == 'product_price') { if ($DescOrderBy == "DESC") { // using krsort when the Array must be sorted reverse (Descending Order) krsort($products, SORT_NUMERIC); } else { // using ksort when the Array must be sorted in ascending order ksort($products, SORT_NUMERIC); } } $tpl->set('products', $products); $tpl->set('search_string', $search_string);
/** * Create a receipt for the current order and email it to * the customer and the vendor. * @author gday * @author soeren * @param int $order_id * @return boolean True on success, false on failure */ function email_receipt($order_id) { global $sess, $ps_product, $VM_LANG, $CURRENCY_DISPLAY, $vmLogger, $mosConfig_fromname, $mosConfig_lang, $database; $ps_vendor_id = vmGet($_SESSION, 'ps_vendor_id', 1); $auth = $_SESSION["auth"]; require_once CLASSPATH . 'ps_order_status.php'; require_once CLASSPATH . 'ps_userfield.php'; require_once CLASSPATH . 'ps_product.php'; $ps_product = new ps_product(); // Connect to database and gather appropriate order information $db = new ps_DB(); $q = "SELECT * FROM #__{vm}_orders WHERE order_id='{$order_id}'"; $db->query($q); $db->next_record(); $user_id = $db->f("user_id"); $customer_note = $db->f("customer_note"); $order_status = ps_order_status::getOrderStatusName($db->f("order_status")); $dbbt = new ps_DB(); $dbst = new ps_DB(); $qt = "SELECT * FROM #__{vm}_user_info WHERE user_id='" . $user_id . "' AND address_type='BT'"; $dbbt->query($qt); $dbbt->next_record(); $qt = "SELECT * FROM #__{vm}_user_info WHERE user_info_id='" . $db->f("user_info_id") . "'"; $dbst->query($qt); $dbst->next_record(); $dbv = new ps_DB(); $qt = "SELECT * from #__{vm}_vendor "; /* Need to decide on vendor_id <=> order relationship */ $qt .= "WHERE vendor_id = '" . $ps_vendor_id . "'"; $dbv->query($qt); $dbv->next_record(); $dboi = new ps_DB(); $q_oi = "SELECT * FROM #__{vm}_product, #__{vm}_order_item, #__{vm}_orders "; $q_oi .= "WHERE #__{vm}_product.product_id=#__{vm}_order_item.product_id "; $q_oi .= "AND #__{vm}_order_item.order_id='{$order_id}' "; $q_oi .= "AND #__{vm}_orders.order_id=#__{vm}_order_item.order_id"; $dboi->query($q_oi); $db_payment = new ps_DB(); $q = "SELECT op.payment_method_id, pm.payment_method_name FROM #__{vm}_order_payment as op, #__{vm}_payment_method as pm\n WHERE order_id='{$order_id}' AND op.payment_method_id=pm.payment_method_id"; $db_payment->query($q); $db_payment->next_record(); if ($auth["show_price_including_tax"] == 1) { $order_shipping = $db->f("order_shipping"); $order_shipping += $db->f("order_shipping_tax"); $order_shipping_tax = 0; $order_tax = $db->f("order_tax") + $db->f("order_shipping_tax"); } else { $order_shipping = $db->f("order_shipping"); $order_shipping_tax = $db->f("order_shipping_tax"); $order_tax = $db->f("order_tax"); } $order_total = $db->f("order_total"); $order_discount = $db->f("order_discount"); $coupon_discount = $db->f("coupon_discount"); // Email Addresses for shopper and vendor // ************************************** $shopper_email = $dbbt->f("user_email"); $shopper_name = $dbbt->f("first_name") . " " . $dbbt->f("last_name"); $from_email = $dbv->f("contact_email"); $shopper_subject = $dbv->f("vendor_name") . " " . $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_LBL', false) . " - " . $db->f("order_id"); $vendor_subject = $dbv->f("vendor_name") . " " . $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_LBL', false) . " - " . $db->f("order_id"); $shopper_order_link = $sess->url(SECUREURL . "index.php?page=account.order_details&order_id={$order_id}", true, false); $vendor_order_link = $sess->url(SECUREURL . "index2.php?page=order.order_print&order_id={$order_id}&pshop_mode=admin", true, false); /** * Prepare the payment information, including Credit Card information when not empty */ $payment_info_details = $db_payment->f("payment_method_name"); if (!empty($_SESSION['ccdata']['order_payment_name']) && !empty($_SESSION['ccdata']['order_payment_number'])) { $payment_info_details .= '<br />' . $VM_LANG->_('PHPSHOP_CHECKOUT_CONF_PAYINFO_NAMECARD', false) . ': ' . $_SESSION['ccdata']['order_payment_name'] . '<br />'; $payment_info_details .= $VM_LANG->_('PHPSHOP_CHECKOUT_CONF_PAYINFO_CCNUM', false) . ': ' . $this->asterisk_pad($_SESSION['ccdata']['order_payment_number'], 4) . '<br />'; $payment_info_details .= $VM_LANG->_('PHPSHOP_CHECKOUT_CONF_PAYINFO_EXDATE', false) . ': ' . $_SESSION['ccdata']['order_payment_expire_month'] . ' / ' . $_SESSION['ccdata']['order_payment_expire_year'] . '<br />'; if (!empty($_SESSION['ccdata']['credit_card_code'])) { $payment_info_details .= 'CVV code: ' . $_SESSION['ccdata']['credit_card_code'] . '<br />'; } } // Convert HTML into Text $payment_info_details_text = str_replace('<br />', "\n", $payment_info_details); // Get the Shipping Details $shipping_arr = explode("|", urldecode(vmGet($_REQUEST, "shipping_rate_id"))); // Headers and Footers // ****************************** // Shopper Header $shopper_header = $VM_LANG->_('PHPSHOP_CHECKOUT_EMAIL_SHOPPER_HEADER1', false) . "\n"; $legal_info_title = ''; $legal_info_html = ''; // Get the legal information about the returns/order cancellation policy if (@VM_ONCHECKOUT_SHOW_LEGALINFO == '1') { $article = intval(@VM_ONCHECKOUT_LEGALINFO_LINK); if ($article > 0) { $db_legal = new ps_DB(); // Get the content article, which contains the Legal Info $db_legal->query('SELECT id, title, introtext FROM #__content WHERE id=' . $article); $db_legal->next_record(); if ($db_legal->f('introtext')) { $legal_info_title = $db_legal->f('title'); $legal_info_text = strip_tags(str_replace('<br />', "\n", $db_legal->f('introtext'))); $legal_info_html = $db_legal->f('introtext'); } } } //Shopper Footer $shopper_footer = "\n\n" . $VM_LANG->_('PHPSHOP_CHECKOUT_EMAIL_SHOPPER_HEADER2', false) . "\n"; if (VM_REGISTRATION_TYPE != 'NO_REGISTRATION') { $shopper_footer .= "\n\n" . $VM_LANG->_('PHPSHOP_CHECKOUT_EMAIL_SHOPPER_HEADER5', false) . "\n"; $shopper_footer .= $shopper_order_link; } $shopper_footer .= "\n\n" . $VM_LANG->_('PHPSHOP_CHECKOUT_EMAIL_SHOPPER_HEADER3', false) . "\n"; $shopper_footer .= "Email: " . $from_email; // New in version 1.0.5 if (@VM_ONCHECKOUT_SHOW_LEGALINFO == '1' && !empty($legal_info_title)) { $shopper_footer .= "\n\n____________________________________________\n"; $shopper_footer .= $legal_info_title . "\n"; $shopper_footer .= $legal_info_text . "\n"; } // Vendor Header $vendor_header = $VM_LANG->_('PHPSHOP_CHECKOUT_EMAIL_SHOPPER_HEADER4', false) . "\n"; // Vendor Footer $vendor_footer = "\n\n" . $VM_LANG->_('PHPSHOP_CHECKOUT_EMAIL_SHOPPER_HEADER5', false) . "\n"; $vendor_footer .= $vendor_order_link; $vendor_email = $from_email; ///////////////////////////////////// // set up text mail // // Main Email Message Purchase Order // ********************************* $shopper_message = "\n" . $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_LBL', false) . "\n"; $shopper_message .= "------------------------------------------------------------------------\n"; $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_NUMBER', false) . ": " . $db->f("order_id") . "\n"; $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_DATE', false) . ": "; $shopper_message .= strftime($VM_LANG->_('DATE_FORMAT_LC'), $db->f("cdate")) . "\n"; $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_STATUS', false) . ": "; $shopper_message .= $order_status . "\n\n"; // BillTo Fields $registrationfields = ps_userfield::getUserFields('registration', false, '', false, true); foreach ($registrationfields as $field) { if ($field->name == 'email') { $field->name = 'user_email'; } if ($field->name == 'delimiter_sendregistration' || $field->type == 'captcha') { continue; } if ($field->type == 'delimiter') { $shopper_message .= ($VM_LANG->_($field->title) != '' ? $VM_LANG->_($field->title) : $field->title) . "\n"; $shopper_message .= "--------------------\n\n"; } else { $shopper_message .= ($VM_LANG->_($field->title) != '' ? $VM_LANG->_($field->title) : $field->title) . ': '; $shopper_message .= $dbbt->f($field->name) . "\n"; } } // Shipping Fields $shopper_message .= "\n\n"; $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_SHIP_TO_LBL') . "\n"; $shopper_message .= "-------\n\n"; $shippingfields = ps_userfield::getUserFields('shipping', false, '', false, true); foreach ($shippingfields as $field) { if ($field->type == 'delimiter') { $shopper_message .= ($VM_LANG->_($field->title) != '' ? $VM_LANG->_($field->title) : $field->title) . "\n"; $shopper_message .= "--------------------\n\n"; } else { $shopper_message .= ($VM_LANG->_($field->title) != '' ? $VM_LANG->_($field->title) : $field->title) . ': '; $shopper_message .= $dbst->f($field->name) . "\n"; } } $shopper_message .= "\n\n"; $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_ITEMS_LBL', false) . "\n"; $shopper_message .= "-----------"; $sub_total = 0.0; while ($dboi->next_record()) { $shopper_message .= "\n\n"; $shopper_message .= $VM_LANG->_('PHPSHOP_PRODUCT', false) . " = "; if ($dboi->f("product_parent_id")) { $shopper_message .= $dboi->f("order_item_name") . "\n"; $shopper_message .= "SERVICE = "; } $shopper_message .= $dboi->f("product_name") . "; " . $dboi->f("product_attribute") . "\n"; $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_QUANTITY', false) . " = "; $shopper_message .= $dboi->f("product_quantity") . "\n"; $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_SKU', false) . " = "; $shopper_message .= $dboi->f("order_item_sku") . "\n"; $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_PRICE', false) . " = "; if ($auth["show_price_including_tax"] == 1) { $sub_total += $dboi->f("product_quantity") * $dboi->f("product_final_price"); $shopper_message .= $CURRENCY_DISPLAY->getFullValue($dboi->f("product_final_price"), '', $db->f('order_currency')); } else { $sub_total += $dboi->f("product_quantity") * $dboi->f("product_final_price"); $shopper_message .= $CURRENCY_DISPLAY->getFullValue($dboi->f("product_item_price"), '', $db->f('order_currency')); } } $shopper_message .= "\n\n"; $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_SUBTOTAL', false) . " = "; $shopper_message .= $CURRENCY_DISPLAY->getFullValue($sub_total, '', $db->f('order_currency')) . "\n"; if (PAYMENT_DISCOUNT_BEFORE == '1') { if (!empty($order_discount)) { if ($order_discount > 0) { $shopper_message .= $VM_LANG->_('PHPSHOP_PAYMENT_METHOD_LIST_DISCOUNT', false) . " = "; $shopper_message .= "- " . $CURRENCY_DISPLAY->getFullValue(abs($order_discount), '', $db->f('order_currency')) . "\n"; } else { $shopper_message .= $VM_LANG->_('PHPSHOP_FEE', false) . " = "; $shopper_message .= "+ " . $CURRENCY_DISPLAY->getFullValue(abs($order_discount), '', $db->f('order_currency')) . "\n"; } } if (!empty($coupon_discount)) { /* following 2 lines added by Erich for coupon hack */ $shopper_message .= $VM_LANG->_('PHPSHOP_COUPON_DISCOUNT', false) . ": "; $shopper_message .= $CURRENCY_DISPLAY->getFullValue($coupon_discount, '', $db->f('order_currency')) . "\n"; } } if ($auth["show_price_including_tax"] != 1) { $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_TOTAL_TAX', false) . " = "; $shopper_message .= $CURRENCY_DISPLAY->getFullValue($order_tax, '', $db->f('order_currency')) . "\n"; } $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_SHIPPING', false) . " = "; $shopper_message .= $CURRENCY_DISPLAY->getFullValue($order_shipping, '', $db->f('order_currency')) . "\n"; if (!empty($order_shipping_tax)) { $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_SHIPPING_TAX', false) . " = "; $shopper_message .= $CURRENCY_DISPLAY->getFullValue($order_shipping_tax, '', $db->f('order_currency')); } $shopper_message .= "\n\n"; if (PAYMENT_DISCOUNT_BEFORE != '1') { if (!empty($order_discount)) { if ($order_discount > 0) { $shopper_message .= $VM_LANG->_('PHPSHOP_PAYMENT_METHOD_LIST_DISCOUNT', false) . " = "; $shopper_message .= "- " . $CURRENCY_DISPLAY->getFullValue(abs($order_discount), '', $db->f('order_currency')) . "\n"; } else { $shopper_message .= $VM_LANG->_('PHPSHOP_FEE', false) . " = "; $shopper_message .= "+ " . $CURRENCY_DISPLAY->getFullValue(abs($order_discount), '', $db->f('order_currency')) . "\n"; } } if (!empty($coupon_discount)) { /* following 2 lines added by Erich for coupon hack */ $shopper_message .= $VM_LANG->_('PHPSHOP_COUPON_DISCOUNT', false) . ": "; $shopper_message .= $CURRENCY_DISPLAY->getFullValue($coupon_discount, '', $db->f('order_currency')) . "\n"; } } $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_TOTAL', false) . " = "; $shopper_message .= $CURRENCY_DISPLAY->getFullValue($order_total, '', $db->f('order_currency')); if ($auth["show_price_including_tax"] == 1) { $shopper_message .= "\n---------------"; $shopper_message .= "\n"; $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_TOTAL_TAX', false) . " = "; $shopper_message .= $CURRENCY_DISPLAY->getFullValue($order_tax, '', $db->f('order_currency')) . "\n"; } if ($db->f('order_tax_details')) { $shopper_message .= str_replace('<br />', "\n", ps_checkout::show_tax_details($db->f('order_tax_details'), $db->f('order_currency'))); } // Payment Details $shopper_message .= "\n\n------------------------------------------------------------------------\n"; $shopper_message .= $payment_info_details_text; // Shipping Details if (is_object($this->_SHIPPING)) { $shopper_message .= "\n\n------------------------------------------------------------------------\n"; $shopper_message .= $VM_LANG->_('PHPSHOP_ORDER_PRINT_SHIPPING_LBL', false) . ":\n"; $shopper_message .= $shipping_arr[1] . " (" . $shipping_arr[2] . ")"; } // Customer Note $shopper_message .= "\n\n------------------------------------------------------------------------\n"; $shopper_message .= "\n" . $VM_LANG->_('PHPSHOP_ORDER_PRINT_CUSTOMER_NOTE', false) . "\n"; $shopper_message .= "---------------"; $shopper_message .= "\n"; if (!empty($customer_note)) { $shopper_message .= $customer_note . "\n"; } else { $shopper_message .= " ./. \n"; } $shopper_message .= "------------------------------------------------------------------------\n"; // Decode things like € => € $shopper_message = vmHtmlEntityDecode($shopper_message); // End of Purchase Order // ********************* // //END: set up text mail ///////////////////////////////////// // Send text email // if (ORDER_MAIL_HTML == '0') { $msg = $shopper_header . $shopper_message . $shopper_footer; // Mail receipt to the shopper vmMail($from_email, $mosConfig_fromname, $shopper_email, $shopper_subject, $msg, ""); $msg = $vendor_header . $shopper_message . $vendor_footer; // Mail receipt to the vendor vmMail($from_email, $mosConfig_fromname, $vendor_email, $vendor_subject, $msg, ""); } elseif (ORDER_MAIL_HTML == '1') { $dboi->query($q_oi); // Create Template Object $template = vmTemplate::getInstance(); if ($order_discount > 0) { $order_discount_lbl = $VM_LANG->_('PHPSHOP_PAYMENT_METHOD_LIST_DISCOUNT'); $order_discount_plusminus = '-'; } else { $order_discount_lbl = $VM_LANG->_('PHPSHOP_FEE'); $order_discount_plusminus = '+'; } if ($coupon_discount > 0) { $coupon_discount_lbl = $VM_LANG->_('PHPSHOP_PAYMENT_METHOD_LIST_DISCOUNT'); $coupon_discount_plusminus = '-'; } else { $coupon_discount_lbl = $VM_LANG->_('PHPSHOP_FEE'); $coupon_discount_plusminus = '+'; } if (is_object($this->_SHIPPING)) { $shipping_info_details = stripslashes($shipping_arr[1]) . " (" . stripslashes($shipping_arr[2]) . ")"; } else { $shipping_info_details = ' ./. '; } // These are a lot of vars to import for the email confirmation $template->set_vars(array('is_email_to_shopper' => true, 'db' => $db, 'dboi' => $dboi, 'dbbt' => $dbbt, 'dbst' => $dbst, 'ps_product' => $ps_product, 'shippingfields' => $shippingfields, 'registrationfields' => $registrationfields, 'order_id' => $order_id, 'order_discount' => $order_discount, 'order_discount_lbl' => $order_discount_lbl, 'order_discount_plusminus' => $order_discount_plusminus, 'coupon_discount' => $coupon_discount, 'coupon_discount_lbl' => $coupon_discount_lbl, 'coupon_discount_plusminus' => $coupon_discount_plusminus, 'order_date' => $VM_LANG->convert(vmFormatDate($db->f("cdate"), $VM_LANG->_('DATE_FORMAT_LC'))), 'order_status' => $order_status, 'legal_info_title' => $legal_info_title, 'legal_info_html' => $legal_info_html, 'order_link' => $shopper_order_link, 'payment_info_lbl' => $VM_LANG->_('PHPSHOP_ORDER_PRINT_PAYINFO_LBL'), 'payment_info_details' => $payment_info_details, 'shipping_info_lbl' => $VM_LANG->_('PHPSHOP_ORDER_PRINT_SHIPPING_LBL'), 'shipping_info_details' => $shipping_info_details, 'from_email' => $from_email, 'customer_note' => nl2br($customer_note), 'order_header_msg' => $shopper_header, 'order_subtotal' => $CURRENCY_DISPLAY->getFullValue($sub_total, '', $db->f('order_currency')), 'order_shipping' => $CURRENCY_DISPLAY->getFullValue($order_shipping, '', $db->f('order_currency')), 'order_tax' => $CURRENCY_DISPLAY->getFullValue($order_tax, '', $db->f('order_currency')) . ps_checkout::show_tax_details($db->f('order_tax_details'), $db->f('order_currency')), 'order_total' => $CURRENCY_DISPLAY->getFullValue($order_total, '', $db->f('order_currency')))); $shopper_html = $template->fetch('order_emails/confirmation_email.tpl.php'); // Reset the list of order items for use in the vendor email $dboi->reset(); // Override some vars for the vendor email, so we can use the same template $template->set_vars(array('order_header_msg' => $vendor_header, 'order_link' => $vendor_order_link, 'is_email_to_shopper' => false)); $vendor_html = $template->fetch('order_emails/confirmation_email.tpl.php'); /* * Add the text, html and embedded images. * The name of the image should match exactly * (case-sensitive) to the name in the html. */ $shopper_mail_Body = $shopper_html; $shopper_mail_AltBody = $shopper_header . $shopper_message . $shopper_footer; $vendor_mail_Body = $vendor_html; $vendor_mail_AltBody = $vendor_header . $shopper_message . $vendor_footer; $imagefile = pathinfo($dbv->f("vendor_full_image")); $extension = $imagefile['extension'] == "jpg" ? "jpeg" : "jpeg"; $EmbeddedImages[] = array('path' => IMAGEPATH . "vendor/" . $dbv->f("vendor_full_image"), 'name' => "vendor_image", 'filename' => $dbv->f("vendor_full_image"), 'encoding' => "base64", 'mimetype' => "image/" . $extension); $shopper_mail = vmMail($from_email, $mosConfig_fromname, $shopper_email, $shopper_subject, $shopper_mail_Body, $shopper_mail_AltBody, true, null, null, $EmbeddedImages); $vendor_mail = vmMail($from_email, $mosConfig_fromname, $vendor_email, $vendor_subject, $vendor_mail_Body, $vendor_mail_AltBody, true, null, null, $EmbeddedImages, null, $shopper_email); if (!$shopper_mail || !$vendor_mail) { $vmLogger->debug('Something went wrong while sending the order confirmation email to ' . $from_email . ' and ' . $shopper_email); return false; } // // END: set up and send the HTML email //////////////////////////////////////// } return true; }
} // Print view URL $details_url = $_SERVER['PHP_SELF'] . "?page=order.order_printdetails&order_id=" . $db->f("order_id") . "&no_menu=1&pop=1"; if (vmIsJoomla('1.5', '>=')) { $details_url .= "&tmpl=component"; } $details_url = $sess->url($details_url); $details_url = defined('_VM_IS_BACKEND') ? str_replace("index2.php", "index3.php", $details_url) : str_replace("index.php", "index2.php", $details_url); // Print View Icon $details_link = " <a href=\"javascript:void window.open('{$details_url}', 'win2', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no');\">"; $details_link .= "<img src=\"{$mosConfig_live_site}/images/M_images/printButton.png\" align=\"center\" height=\"16\" width=\"16\" border=\"0\" /></a>"; $listObj->addCell($details_link); // Creation Date $listObj->addCell(vmFormatDate($db->f("cdate"), "%d-%b-%y %H:%M")); // Last Modified Date $listObj->addCell(vmFormatDate($db->f("mdate"), "%d-%b-%y %H:%M")); // Order Status Drop Down List $listObj->addCell($ps_order_status->getOrderStatusList($db->f("order_status"), "onchange=\"document.adminForm{$i}.order_status.selectedIndex = this.selectedIndex;document.adminForm{$i}.changed.value='1'\"")); // Notify Customer checkbox $listObj->addCell('<input type="checkbox" class="inputbox" onclick="if(this.checked==true) {document.adminForm' . $i . '.notify_customer.value = \'Y\';} else {document.adminForm' . $i . '.notify_customer.value = \'N\';}" value="Y" />' . $VM_LANG->_('PHPSHOP_ORDER_LIST_NOTIFY') . '<br /> <input type="button" class="button" onclick="if(document.adminForm' . $i . '.changed.value!=\'1\') { alert(\'' . addslashes($VM_LANG->_('PHPSHOP_ORDER_LIST_NOTIFY_ERR')) . '\'); return false;} else adminForm' . $i . '.submit();" name="Submit" value="' . $VM_LANG->_('VM_UPDATE_STATUS') . '" />'); $listObj->addCell($GLOBALS['CURRENCY_DISPLAY']->getFullValue($db->f("order_total"), '', $db->f('order_currency'))); // Change Order Status form $form_code .= '<form style="float:left;" method="post" action="' . $_SERVER['PHP_SELF'] . '" name="adminForm' . $i . '">'; $form_code .= $ps_order_status->getOrderStatusList($db->f("order_status"), "style=\"visibility:hidden;\" onchange=\"document.adminForm{$i}.changed.value='1'\""); $form_code .= '<input type="hidden" class="inputbox" name="notify_customer" value="N" /> <input type="hidden" name="page" value="order.order_list" /> <input type="hidden" name="func" value="orderStatusSet" /> <input type="hidden" name="vmtoken" value="' . vmSpoofValue($sess->getSessionId()) . '" /> <input type="hidden" name="changed" value="0" /> <input type="hidden" name="option" value="com_virtuemart" />
$ps_order_change_html->html_change_payment($dbpm->f("payment_method_id")); ?> </td> <td width="40%"><?php $dbpm->p("order_payment_name"); ?> </td> <td width="30%"><?php echo ps_checkout::asterisk_pad($dbaccount->f("account_number"), 4, true); if ($dbaccount->f('order_payment_code')) { echo '<br/>(' . $VM_LANG->_('VM_ORDER_PAYMENT_CCV_CODE') . ': ' . $dbaccount->f('order_payment_code') . ') '; } ?> </td> <td width="17%"><?php echo $dbpm->f("order_payment_expire") ? vmFormatDate($dbpm->f("order_payment_expire"), '%b-%Y') : ''; ?> </td> </tr> <tr class="sectiontableheader"> <th colspan="4"><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_PAYMENT_LOG_LBL'); ?> </th> </tr> <tr> <td colspan="4"><?php if ($dbpm->f("order_payment_log")) { echo $dbpm->f("order_payment_log"); } else { echo "./.";
echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_NUMBER'); ?> :</td> <td><?php printf("%08d", $db->f("order_id")); ?> </td> </tr> <tr> <td><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_DATE'); ?> :</td> <td><?php echo vmFormatDate($db->f("cdate") + $time_offset); ?> </td> </tr> <tr> <td><?php echo $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_STATUS'); ?> :</td> <td><?php echo ps_order_status::getOrderStatusName($db->f("order_status")); ?> </td> </tr> <!-- End Customer Information --> <!-- Begin 2 column bill-ship to -->
/** * Shows the list of the orders of a user in the account mainenance section * * @param string $order_status Filter by order status (A=all, C=confirmed, P=pending,...) * @param int $secure Restrict the order list to a specific user id (=1) or not (=0)? */ function list_order($order_status = 'A', $secure = 0) { global $VM_LANG, $CURRENCY_DISPLAY, $sess, $limit, $limitstart, $keyword, $mm_action_url; $ps_vendor_id = $_SESSION["ps_vendor_id"]; $auth = $_SESSION['auth']; require_once CLASSPATH . 'ps_order_status.php'; require_once CLASSPATH . 'htmlTools.class.php'; require_once CLASSPATH . 'pageNavigation.class.php'; $db = new ps_DB(); $dbs = new ps_DB(); $listfields = 'o.order_id,o.cdate,order_total,o.order_status,order_currency'; $countfields = 'count(*) as num_rows'; $count = "SELECT {$countfields} FROM #__{vm}_orders o "; $list = "SELECT DISTINCT {$listfields} FROM #__{vm}_orders o "; $q = "WHERE o.vendor_id='{$ps_vendor_id}' "; if ($order_status != "A") { $q .= "AND order_status='{$order_status}' "; } if ($secure) { $q .= "AND user_id='" . $auth["user_id"] . "' "; } if (!empty($keyword)) { $count .= ', #__{vm}_order_item oi '; $list .= ', #__{vm}_order_item oi '; $q .= "AND (order_item_sku LIKE '%" . $keyword . "%' "; $q .= "OR order_number LIKE '%" . $keyword . "%' "; $q .= "OR o.order_id=" . (int) $keyword . ' '; $q .= "OR order_item_name LIKE '%" . $keyword . "%') "; $q .= "AND oi.order_id=o.order_id "; } $q .= "ORDER BY o.cdate DESC"; $count .= $q; $db->query($count); $db->next_record(); $num_rows = $db->f('num_rows'); if ($num_rows == 0) { echo "<span style=\"font-style:italic;\">" . $VM_LANG->_('PHPSHOP_ACC_NO_ORDERS') . "</span>\n"; return; } $pageNav = new vmPageNav($num_rows, $limitstart, $limit); $list .= $q .= " LIMIT " . $pageNav->limitstart . ", {$limit} "; $db->query($list); $listObj = new listFactory($pageNav); if ($num_rows > 0) { // print out the search field and a list heading $listObj->writeSearchHeader('', '', 'account', 'index'); } // start the list table $listObj->startTable(); $listObj->writeTableHeader(3); while ($db->next_record()) { $order_status = ps_order_status::getOrderStatusName($db->f("order_status")); $listObj->newRow(); $tmp_cell = "<a href=\"" . $sess->url($mm_action_url . "index.php?page=account.order_details&order_id=" . $db->f("order_id")) . "\">\n"; $tmp_cell .= "<img src=\"" . IMAGEURL . "ps_image/goto.png\" height=\"32\" width=\"32\" align=\"middle\" border=\"0\" alt=\"" . $VM_LANG->_('PHPSHOP_ORDER_LINK') . "\" /> " . $VM_LANG->_('PHPSHOP_VIEW') . "</a><br />"; $listObj->addCell($tmp_cell); $tmp_cell = "<strong>" . $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_DATE') . ":</strong> " . vmFormatDate($db->f("cdate"), "%d. %B %Y"); $tmp_cell .= "<br /><strong>" . $VM_LANG->_('PHPSHOP_ORDER_PRINT_TOTAL') . ":</strong> " . $CURRENCY_DISPLAY->getFullValue($db->f("order_total"), '', $db->f('order_currency')); $listObj->addCell($tmp_cell); $tmp_cell = "<strong>" . $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_STATUS') . ":</strong> " . $order_status; $tmp_cell .= "<br /><strong>" . $VM_LANG->_('PHPSHOP_ORDER_PRINT_PO_NUMBER') . ":</strong> " . sprintf("%08d", $db->f("order_id")); $listObj->addCell($tmp_cell); } $listObj->writeTable(); $listObj->endTable(); if ($num_rows > 0) { $listObj->writeFooter($keyword, '&Itemid=' . $sess->getShopItemid()); } }
<?php foreach ($reviews as $review) { // Loop through all reviews /** * Available indexes: * * $review['userid'] => The user ID of the comment author * $review['username'] => The username of the comment author * $review['name'] => The name of the comment author * $review['time'] => The UNIX timestamp of the comment ("when" it was posted) * $review['user_rating'] => The rating; an integer from 1 - 5 * $review['comment'] => The comment text * */ $date = vmFormatDate($review["time"], $VM_LANG->_('DATE_FORMAT_LC')); ?> <strong><?php echo $review["username"] . " ({$date})"; ?> </strong> <br /> <?php echo $VM_LANG->_('PHPSHOP_RATE_NOM'); ?> : <img src="<?php echo VM_THEMEURL; ?> images/stars/<?php echo $review["user_rating"];