本文整理汇总了PHP中ps_DB::f方法的典型用法代码示例。如果您正苦于以下问题:PHP ps_DB::f方法的具体用法?PHP ps_DB::f怎么用?PHP ps_DB::f使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ps_DB
的用法示例。
在下文中一共展示了ps_DB::f方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: count
/**
* Validates the input parameters onCountryAdd
*
* @param array $d
* @return boolean
*/
function validate_add($d)
{
global $vmLogger;
$db = new ps_DB();
if (!$d["country_name"]) {
$vmLogger->err("You must enter a name for the country.");
return False;
}
if (!$d["country_2_code"]) {
$vmLogger->err("You must enter a 2 symbol code for the country.");
return False;
}
if (!$d["country_3_code"]) {
$vmLogger->err('You must enter a 3 symbol code for the country.');
return False;
}
if ($d["country_name"]) {
$q = "SELECT count(*) as rowcnt from #__{vm}_country where";
$q .= " country_name='" . $db->getEscaped($d["country_name"]) . "'";
$db->query($q);
$db->next_record();
if ($db->f("rowcnt") > 0) {
$vmLogger->err("The given country name already exists.");
return False;
}
}
return True;
}
示例2: count
function validate_add($d)
{
global $VM_LANG;
$db = new ps_DB();
if (!$d["currency_name"]) {
$GLOBALS['vmLogger']->err($VM_LANG->_('VM_CURRENCY_ERR_NAME'));
return False;
}
if (!$d["currency_code"]) {
$GLOBALS['vmLogger']->err($VM_LANG->_('VM_CURRENCY_ERR_CODE'));
return False;
}
if ($d["currency_name"]) {
$q = "SELECT count(*) as rowcnt from #__{vm}_currency where";
$q .= " currency_name='" . $d["currency_name"] . "'";
$db->setQuery($q);
$db->query();
$db->next_record();
if ($db->f("rowcnt") > 0) {
$GLOBALS['vmLogger']->err($VM_LANG->_('VM_CURRENCY_ERR_EXISTS'));
return False;
}
}
return True;
}
示例3: implode
/**
* Validates the Input Parameters onBeforeProductTypeAdd
* @author Zdenek Dvorak
* @param array $d
* @return boolean
*/
function validate_add(&$d)
{
global $VM_LANG;
if (empty($d["product_type_id"])) {
$GLOBALS['vmLogger']->err($VM_LANG->_('VM_PRODUCT_TYPE_ERR_SELECT'));
return False;
}
if (empty($d["product_id"])) {
$GLOBALS['vmLogger']->err($VM_LANG->_('VM_PRODUCT_TYPE_ERR_SELECT_PRODUCT'));
return false;
}
$db = new ps_DB();
$q = "SELECT product_id,COUNT(*) AS count FROM #__{vm}_product_product_type_xref ";
if (is_array($d["product_id"])) {
$product_ids = implode(",", $d["product_id"]);
$q .= "WHERE product_id IN (" . $product_ids . ") AND product_type_id='" . $d["product_type_id"] . "' GROUP BY product_id";
} else {
$q .= "WHERE product_id='" . $d["product_id"] . "' AND product_type_id='" . $d["product_type_id"] . "'";
}
$db->query($q);
if ($db->f("count") != 0 && sizeof($d["product_id"]) == 1) {
$GLOBALS['vmLogger']->err($VM_LANG->_('VM_PRODUCT_TYPE_ERR_ALREADY'));
return false;
} else {
$container = $d["product_id"];
while ($db->next_record()) {
foreach ($d["product_id"] as $prod_id) {
if ($prod_id != $db->f("product_id")) {
$temp[] = $prod_id;
}
}
$d["product_id"] = $temp;
unset($temp);
}
if (empty($d["product_id"])) {
$GLOBALS['vmLogger']->err($VM_LANG->_('VM_PRODUCT_TYPE_ERR_ALREADY'));
$d["product_id"] = $container;
return false;
}
return True;
}
}
示例4: while
function traverse_tree_down(&$mymenu_content, $category_id = '0', $level = '0')
{
static $ibg = 0;
global $mosConfig_live_site, $sess;
$level++;
$query = "SELECT category_name, category_id, category_child_id " . "FROM #__{vm}_category as a, #__{vm}_category_xref as b " . "WHERE a.category_publish='Y' AND " . " b.category_parent_id='{$category_id}' AND a.category_id=b.category_child_id " . "ORDER BY category_parent_id, list_order, category_name ASC";
$db = new ps_DB();
$db->query($query);
while ($db->next_record()) {
$itemid = '&Itemid=' . $sess->getShopItemid();
if ($ibg != 0) {
$mymenu_content .= ",";
}
$mymenu_content .= "\n[ '<img src=\"' + ctThemeXPBase + 'darrow.png\" alt=\"arr\" />','" . $db->f("category_name", false) . "','" . sefRelToAbs('index.php?option=com_virtuemart&page=shop.browse&category_id=' . $db->f("category_id") . $itemid) . "',null,'" . $db->f("category_name", false) . "'\n ";
$ibg++;
/* recurse through the subcategories */
$this->traverse_tree_down($mymenu_content, $db->f("category_child_id"), $level);
/* let's see if the loop has reached its end */
$mymenu_content .= "]";
}
}
示例5: authUser
function authUser($acc, $pwd)
{
if ($acc && $pwd) {
$db = new ps_DB();
$pwd = md5($pwd);
$sql = "select ID, name, authority from account where username='{$acc}' and password='{$pwd}' ";
$db->query($sql);
if ($db->next_record()) {
return $db->f('ID');
} else {
return 0;
}
} else {
return 0;
}
}
示例6: validate
/**
* Validates the Input Parameters on price add/update
*
* @param array $d
* @return boolean
*/
function validate(&$d)
{
global $vmLogger, $VM_LANG;
$valid = true;
if (!isset($d["product_price"]) || $d["product_price"] === '') {
$vmLogger->err($VM_LANG->_('VM_PRODUCT_PRICE_MISSING', false));
$valid = false;
}
if (empty($d["product_id"])) {
$vmLogger->err($VM_LANG->_('VM_PRODUCT_ID_MISSING', false));
$valid = false;
}
// convert all "," in prices to decimal points.
if (stristr($d["product_price"], ",")) {
$d['product_price'] = floatval(str_replace(',', '.', $d["product_price"]));
}
if (!$d["product_currency"]) {
$vmLogger->err($VM_LANG->_('VM_PRODUCT_PRICE_CURRENCY_MISSING', false));
$valid = false;
}
$d["price_quantity_start"] = intval(@$d["price_quantity_start"]);
$d["price_quantity_end"] = intval(@$d["price_quantity_end"]);
if ($d["price_quantity_end"] < $d["price_quantity_start"]) {
$vmLogger->err($VM_LANG->_('VM_PRODUCT_PRICE_QEND_LESS', false));
$valid = false;
}
$db = new ps_DB();
$q = "SELECT count(*) AS num_rows FROM #__{vm}_product_price WHERE";
if (!empty($d["product_price_id"])) {
$q .= " product_price_id != '" . $d['product_price_id'] . "' AND";
}
$q .= " shopper_group_id = '" . $d["shopper_group_id"] . "'";
$q .= " AND product_id = '" . $d['product_id'] . "'";
$q .= " AND product_currency = '" . $d['product_currency'] . "'";
$q .= " AND (('" . $d['price_quantity_start'] . "' >= price_quantity_start AND '" . $d['price_quantity_start'] . "' <= price_quantity_end)";
$q .= " OR ('" . $d['price_quantity_end'] . "' >= price_quantity_start AND '" . $d['price_quantity_end'] . "' <= price_quantity_end))";
$db->query($q);
$db->next_record();
if ($db->f("num_rows") > 0) {
$vmLogger->err($VM_LANG->_('VM_PRODUCT_PRICE_ALREADY', false));
$valid = false;
}
return $valid;
}
示例7: COUNT
/**
* Validates the Input Parameters onBeforeProductTypeAdd
* @author Zdenek Dvorak
* @param array $d
* @return boolean
*/
function validate_add(&$d)
{
global $VM_LANG;
if (empty($d["product_type_id"])) {
$GLOBALS['vmLogger']->err($VM_LANG->_('VM_PRODUCT_TYPE_ERR_SELECT'));
return False;
}
if (empty($d["product_id"])) {
$GLOBALS['vmLogger']->err($VM_LANG->_('VM_PRODUCT_TYPE_ERR_SELECT_PRODUCT'));
return false;
}
$db = new ps_DB();
$q = "SELECT COUNT(*) AS count FROM #__{vm}_product_product_type_xref ";
$q .= "WHERE product_id='" . $d["product_id"] . "' AND product_type_id='" . $d["product_type_id"] . "'";
$db->query($q);
if ($db->f("count") != 0) {
$GLOBALS['vmLogger']->err($VM_LANG->_('VM_PRODUCT_TYPE_ERR_ALREADY'));
return false;
} else {
return True;
}
}
示例8:
" href="<?php
$sess->purl(SECUREURL . "index.php?page=shop.downloads");
?>
">
<?php
echo $VM_LANG->_('PHPSHOP_DOWNLOADS_TITLE');
?>
</a>
</td>
</tr><?php
}
// Show a link to the cart and show the mini cart
// Check to see if minicart module is published, if it is prevent the minicart displaying in the VM module
$q = "SELECT published FROM #__modules WHERE module='mod_virtuemart_cart'";
$db->query($q);
if (USE_AS_CATALOGUE != '1' && $show_minicart == 'yes' && !$db->f("published")) {
$_SESSION['vmMiniCart'] = true;
?>
<tr>
<td colspan="2">
<?php
$class_att = 'class="' . $class_mainlevel . '"';
$href = $sess->url($mm_action_url . "index.php?page=shop.cart");
$href2 = $sess->url($mm_action_url . "index2.php?page=shop.cart", true);
$text = $VM_LANG->_('PHPSHOP_CART_SHOW');
if ($useGreyBox_cartlink) {
echo vmCommonHTML::getGreyboxPopUpLink($href2, $text, '', $text, $class_att, 500, 600, $href);
} else {
echo vmCommonHTML::hyperlink($href, $text, '', $text, $class_att);
}
?>
示例9: updateRecords
/**
* This is the main function which stores the order information in the database
*
* @author Ashish Solanki!
* @return boolean
*/
function updateRecords($order_number, $order_total, &$d)
{
require_once CLASSPATH . 'ps_checkout.php';
$ps_chkout = new ps_checkout();
global $order_tax_details, $afid, $VM_LANG, $auth, $my, $mosConfig_offset, $vmLogger, $vmInputFilter, $discount_factor;
$ps_vendor_id = $_SESSION["ps_vendor_id"];
$cart = $_SESSION['cart'];
require_once CLASSPATH . 'ps_payment_method.php';
$ps_payment_method = new ps_payment_method();
require_once CLASSPATH . 'ps_product.php';
$ps_product = new ps_product();
require_once CLASSPATH . 'ps_cart.php';
$ps_cart = new ps_cart();
$db = new ps_DB();
$totals = $ps_chkout->calc_order_totals($d);
extract($totals);
$timestamp = time();
//Custom
$vmLogger->debug('-- Checkout Debug--
Subtotal: ' . $order_subtotal . '
Taxable: ' . $order_taxable . '
Payment Discount: ' . $payment_discount . '
Coupon Discount: ' . $coupon_discount . '
Shipping: ' . $order_shipping . '
Shipping Tax : ' . $order_shipping_tax . '
Tax : ' . $order_tax . '
------------------------
Order Total: ' . $order_total . '
----------------------------');
// Check to see if Payment Class File exists
$payment_class = $ps_payment_method->get_field($d["payment_method_id"], "payment_class");
$d['new_order_status'] = 'P';
// This is meant to be updated by a payment modules' process_payment method
if (!class_exists($payment_class)) {
include CLASSPATH . "payment/{$payment_class}.php";
}
$_PAYMENT = new $payment_class();
// Remove the Coupon, because it is a Gift Coupon and now is used!!
if (@$_SESSION['coupon_type'] == "gift") {
$d['coupon_id'] = $_SESSION['coupon_id'];
include_once CLASSPATH . 'ps_coupon.php';
ps_coupon::remove_coupon_code($d);
}
// Get the IP Address
if (!empty($_SERVER['REMOTE_ADDR'])) {
$ip = $_SERVER['REMOTE_ADDR'];
} else {
$ip = 'unknown';
}
// Collect all fields and values to store them!
$fields = array('user_id' => $auth["user_id"], 'vendor_id' => $ps_vendor_id, 'order_number' => $order_number, 'user_info_id' => $d["ship_to_info_id"], 'ship_method_id' => @urldecode($d["shipping_rate_id"]), 'order_total' => $order_total, 'order_subtotal' => $order_subtotal, 'order_tax' => $order_tax, 'order_tax_details' => serialize($order_tax_details), 'order_shipping' => $order_shipping, 'order_shipping_tax' => $order_shipping_tax, 'order_discount' => $payment_discount, 'coupon_discount' => $coupon_discount, 'coupon_code' => @$_SESSION['coupon_code'], 'order_currency' => $GLOBALS['product_currency'], 'order_status' => 'P', 'cdate' => $timestamp, 'mdate' => $timestamp, 'customer_note' => htmlspecialchars(vmRequest::getString('customer_note', '', 'POST', 'none'), ENT_QUOTES), 'ip_address' => $ip);
// Insert the main order information
$db->buildQuery('INSERT', '#__{vm}_orders', $fields);
$result = $db->query();
$d["order_id"] = $order_id = $db->last_insert_id();
if ($result === false || empty($order_id)) {
$vmLogger->crit('Adding the Order into the Database failed! User ID: ' . $auth["user_id"]);
return false;
}
// Insert the initial Order History.
$mysqlDatetime = date("Y-m-d G:i:s", $timestamp);
$fields = array('order_id' => $order_id, 'order_status_code' => 'P', 'date_added' => $mysqlDatetime, 'customer_notified' => 1, 'comments' => '');
$db->buildQuery('INSERT', '#__{vm}_order_history', $fields);
$db->query();
/**
* Insert the Order payment info
*/
$payment_number = str_replace(array(' ', '|', '-'), '', @$_SESSION['ccdata']['order_payment_number']);
$d["order_payment_code"] = @$_SESSION['ccdata']['credit_card_code'];
// Payment number is encrypted using mySQL encryption functions.
$fields = array('order_id' => $order_id, 'payment_method_id' => $d["payment_method_id"], 'order_payment_log' => @$d["order_payment_log"], 'order_payment_trans_id' => $vmInputFilter->safeSQL(@$d["order_payment_trans_id"]));
if (!empty($payment_number) && VM_STORE_CREDITCARD_DATA == '1') {
// Store Credit Card Information only if the Store Owner has decided to do so
$fields['order_payment_code'] = $d["order_payment_code"];
$fields['order_payment_expire'] = @$_SESSION["ccdata"]["order_payment_expire"];
$fields['order_payment_name'] = @$_SESSION["ccdata"]["order_payment_name"];
$fields['order_payment_number'] = VM_ENCRYPT_FUNCTION . "( '{$payment_number}','" . ENCODE_KEY . "')";
$specialfield = array('order_payment_number');
} else {
$specialfield = array();
}
$db->buildQuery('INSERT', '#__{vm}_order_payment', $fields, '', $specialfield);
$db->query();
/**
* Insert the User Billto & Shipto Info
*/
// First: get all the fields from the user field list to copy them from user_info into the order_user_info
$fields = array();
require_once CLASSPATH . 'ps_userfield.php';
$userfields = ps_userfield::getUserFields('', false, '', true, true);
foreach ($userfields as $field) {
if ($field->name == 'email') {
$fields[] = 'user_email';
} else {
//.........这里部分代码省略.........
示例10: unset
$action = $_GET['action'];
if ($action == 'logout') {
unset($_SESSION['name']);
unset($_SESSION['username']);
unset($_SESSION['authority']);
unset($_SESSION['userID']);
} else {
$username = $_POST['username'];
$password = md5($_POST['password']);
if (!$errormsg) {
$errormsg = "";
}
if ($username) {
$sql = "select ID, name, authority from account where username='{$username}' and password='{$password}' ";
$db->query($sql);
if ($db->next_record() && $db->f('authority') == 'ADMIN') {
$_SESSION['username'] = $username;
$_SESSION['name'] = $db->f('name');
$_SESSION['authority'] = $db->f('authority');
$_SESSION['userID'] = $db->f('ID');
?>
<script language="javascript">
document.location="index.php";
</script>
<?php
} else {
unset($_SESSION['name']);
unset($_SESSION['username']);
unset($_SESSION['authority']);
unset($_SESSION['userID']);
$errormsg = $_LOGIN_ERRORMSG;
示例11: switch
function _tax_based_on_vendor_address($ship_to_info_id = '')
{
global $auth;
global $vmLogger;
switch (TAX_MODE) {
case '0':
return false;
case '1':
return true;
case '17749':
$ship_to_info_id = !empty($ship_to_info_id) ? $ship_to_info_id : vmGet($_REQUEST, 'ship_to_info_id');
$db = new ps_DB();
$q = "SELECT country FROM #__{vm}_user_info WHERE user_info_id='" . $ship_to_info_id . "'";
$db->query($q);
$db->next_record();
$ship_country = $db->f("country");
if (!array_key_exists('country', $auth) || empty($ship_country)) {
$vmLogger->debug('shopper\'s country is not known; defaulting to vendor-based tax');
return true;
}
if ($ship_to_info_id) {
$vmLogger->debug('shopper shipping in ' . $ship_country);
$auth_country = $ship_country;
} else {
$vmLogger->debug('shopper is in ' . $auth['country']);
$auth_country = $auth['country'];
}
return ps_checkout::country_in_eu_common_vat_zone($auth_country);
default:
$vmLogger->warning('unknown TAX_MODE "' . TAX_MODE . '"');
return true;
}
}
示例12: urlencode
// Price: xx.xx EUR
if (_SHOW_PRICES == '1' && $auth['show_prices']) {
$product_price = $ps_product->show_price($db_browse->f("product_id"));
} else {
$product_price = "";
}
// @var array $product_price_raw The raw unformatted Product Price in Float Format
$product_price_raw = $ps_product->get_adjusted_attribute_price($db_browse->f('product_id'));
// i is the index for the array holding all products, we need to show. to allow sorting by discounted price,
// we need to use the price as first part of the index name!
$i = $product_price_raw['product_price'] . '_' . ++$counter;
if ($db_browse->f("product_thumb_image")) {
$product_thumb_image = $db_browse->f("product_thumb_image");
} else {
if ($product_parent_id != 0) {
$product_thumb_image = $dbp->f("product_thumb_image");
// Use product_thumb_image from Parent Product
} else {
$product_thumb_image = 0;
}
}
if ($product_thumb_image) {
if (substr($product_thumb_image, 0, 4) != "http") {
if (PSHOP_IMG_RESIZE_ENABLE == '1') {
$product_thumb_image = $mosConfig_live_site . "/components/com_virtuemart/show_image_in_imgtag.php?filename=" . urlencode($product_thumb_image) . "&newxsize=" . PSHOP_IMG_WIDTH . "&newysize=" . PSHOP_IMG_HEIGHT . "&fileout=";
} elseif (!file_exists(IMAGEPATH . "product/" . $product_thumb_image)) {
$product_thumb_image = VM_THEMEURL . 'images/' . NO_IMAGE;
}
}
} else {
$product_thumb_image = VM_THEMEURL . 'images/' . NO_IMAGE;
示例13:
<td><?php
echo ps_shopper_group::list_shopper_groups("shopper_group_id", $db->sf("shopper_group_id"));
?>
</td>
</tr>
<tr>
<td colspan="2" height="2"> </td>
</tr>
<tr>
<td class="labelcell"><?php
echo $VM_LANG->_('PHPSHOP_PRODUCT_LIST_QUANTITY_START');
?>
:</td>
<td><input type="text"
value="<?php
echo $db->f("price_quantity_start");
?>
" size="11"
name="price_quantity_start" /></td>
</tr>
<tr>
<td class="labelcell"><?php
echo $VM_LANG->_('PHPSHOP_PRODUCT_LIST_QUANTITY_END');
?>
:</td>
<td><input type="text"
value="<?php
echo $db->f("price_quantity_end");
?>
" size="11"
name="price_quantity_end" /></td>
示例14: dTree
$menu_htmlcode .= "<link rel=\"stylesheet\" href=\"{$js_src}/dtree/dtree.css\" type=\"text/css\" />\n";
$menu_htmlcode .= "<script type=\"text/javascript\" src=\"{$js_src}/dtree/dtree.js\"></script>\n";
$menu_htmlcode .= "<script type=\"text/javascript\">\n";
// create the tree, using the unique name
// pass the live_site parameter on so dTree can find the icons
$menu_htmlcode .= "{$tree} = new dTree('{$tree}',\"{$js_src}\");\n";
// pass on the dTree API parameters
$menu_htmlcode .= "{$tree}.config.useSelection=" . $useSelection . ";\n";
$menu_htmlcode .= "{$tree}.config.useLines=" . $useLines . ";\n";
$menu_htmlcode .= "{$tree}.config.useIcons=" . $useIcons . ";\n";
$menu_htmlcode .= "{$tree}.config.useCookies=" . $useCookies . ";\n";
$menu_htmlcode .= "{$tree}.config.useStatusText=" . $useStatusText . ";\n";
$menu_htmlcode .= "{$tree}.config.closeSameLevel=" . $closeSameLevel . ";\n";
$basename = $_REQUEST['root_label'];
// what is the ID of this node?
$baseid = $db->f("category_parent_id");
// create the link (if not a menu item, no link [could be: to entry page of site])
$baselink = $base == "first" ? $sess->url($mm_action_url . 'index.php?page=' . HOMEPAGE) : "";
// remember which item is open, normally $Itemid
// except when we want the first item (e.g. Home) to be the base;
// in that case we have to pretend all remaining items belong to "Home"
$openid = $category_id;
// it could be that we are displaying e.g. mainmenu in this dtree,
// but item in usermenu is selected,
// so: for the rest of this module track if this menu contains the selected item
// Default value: first node (=baseid), but not selected
$opento = $baseid;
$opento_selected = "false";
// what do you know... the first node was selected
if ($baseid == $openid) {
$opento_selected = "true";
示例15: vmGet
/**
*/
function mail_question(&$d)
{
global $vmLogger, $Itemid, $_SESSION, $VM_LANG, $mosConfig_live_site, $mosConfig_lang, $sess;
$db = new ps_DB();
$product_id = (int) $d["product_id"];
$q = 'SELECT * FROM #__{vm}_product WHERE product_id=' . $product_id . ' AND product_publish=\'Y\'';
$db->query($q);
if (!$db->next_record()) {
$vmLogger->err($VM_LANG->_('NOT_AUTH', false));
return false;
}
if ($db->f("product_sku") != @$d["product_sku"]) {
$vmLogger->err($VM_LANG->_('NOT_AUTH', false));
return false;
}
$Itemid = $sess->getShopItemid();
$flypage = vmGet($_REQUEST, "flypage", null);
// product url
$product_url = $mosConfig_live_site . "/index.php?option=com_virtuemart&page=shop.product_details&flypage=" . urlencode($flypage) . "&product_id={$product_id}&Itemid={$Itemid}";
$dbv = new ps_DB();
$qt = "SELECT * from #__{vm}_vendor ";
$qt .= "WHERE vendor_id = '" . $_SESSION['ps_vendor_id'] . "'";
$dbv->query($qt);
$dbv->next_record();
$vendor_email = $dbv->f("contact_email");
$shopper_email = $d["email"];
$shopper_name = $d["name"];
$subject_msg = vmRequest::getVar('text', '', 'post');
$shopper_subject = sprintf($VM_LANG->_('VM_ENQUIRY_SHOPPER_EMAIL_SUBJECT'), $dbv->f("vendor_name"));
$shopper_msg = str_replace('{vendor_name}', $dbv->f("vendor_name"), $VM_LANG->_('VM_ENQUIRY_SHOPPER_EMAIL_MESSAGE'));
$shopper_msg = str_replace('{product_name}', $db->f("product_name"), $shopper_msg);
$shopper_msg = str_replace('{product_sku}', $db->f("product_sku"), $shopper_msg);
$shopper_msg = str_replace('{product_url}', $product_url, $shopper_msg);
$shopper_msg = vmHtmlEntityDecode($shopper_msg);
//
$vendor_subject = sprintf($VM_LANG->_('VM_ENQUIRY_VENDOR_EMAIL_SUBJECT'), $dbv->f("vendor_name"), $db->f("product_name"));
$vendor_msg = str_replace('{shopper_name}', $shopper_name, $VM_LANG->_('VM_ENQUIRY_VENDOR_EMAIL_MESSAGE'));
$vendor_msg = str_replace('{shopper_message}', $subject_msg, $vendor_msg);
$vendor_msg = str_replace('{shopper_email}', $shopper_email, $vendor_msg);
$vendor_msg = str_replace('{product_name}', $db->f("product_name"), $vendor_msg);
$vendor_msg = str_replace('{product_sku}', $db->f("product_sku"), $vendor_msg);
$vendor_msg = str_replace('{product_url}', $product_url, $vendor_msg);
$vendor_msg = vmHtmlEntityDecode($vendor_msg);
//END: set up text mail
/////////////////////////////////////
// Send text email
//
if (ORDER_MAIL_HTML == '0') {
// Mail receipt to the shopper
vmMail($vendor_email, $dbv->f("vendor_name"), $shopper_email, $shopper_subject, $shopper_msg, "");
// Mail receipt to the vendor
vmMail($shopper_email, $shopper_name, $vendor_email, $vendor_subject, $vendor_msg, "");
} elseif (ORDER_MAIL_HTML == '1') {
// Mail receipt to the vendor
$template = vmTemplate::getInstance();
$template->set_vars(array('vendorname' => $dbv->f("vendor_name"), 'subject' => nl2br($subject_msg), 'contact_name' => $shopper_name, 'contact_email' => $shopper_email, 'product_name' => $db->f("product_name"), 'product_s_description' => $db->f("product_s_desc"), 'product_url' => $product_url, 'product_sku' => $db->f("product_sku")));
if ($db->f("product_thumb_image")) {
$imagefile = pathinfo($db->f("product_thumb_image"));
$extension = $imagefile['extension'] == "jpg" ? "jpeg" : "jpeg";
$EmbeddedImages[] = array('path' => IMAGEPATH . "product/" . $db->f("product_thumb_image"), 'name' => "product_image", 'filename' => $db->f("product_thumb_image"), 'encoding' => "base64", 'mimetype' => "image/" . $extension);
$template->set('product_thumb', '<img src="cid:product_image" alt="product_image" border="0" />');
$body = $template->fetch('order_emails/enquiry_email.tpl.php');
$vendor_mail = vmMail($shopper_email, $shopper_name, $vendor_email, $vendor_subject, $body, $vendor_msg, true, null, null, $EmbeddedImages);
} else {
$template->set('product_thumb', '');
$body = $template->fetch('order_emails/enquiry_email.tpl.php');
$vendor_mail = vmMail($shopper_email, $shopper_name, $vendor_email, $vendor_subject, $body, $vendor_msg, true, null, null, null);
}
//Send sender confirmation email
$sender_mail = vmMail($vendor_email, $dbv->f("vendor_name"), $shopper_email, $shopper_subject, $shopper_msg, "");
if (!$vendor_mail || !$sender_mail) {
$vmLogger->debug('Something went wrong while sending the enquiry email to ' . $vendor_email . ' and ' . $shopper_email);
return false;
}
}
return true;
}