本文整理汇总了PHP中vmRequest类的典型用法代码示例。如果您正苦于以下问题:PHP vmRequest类的具体用法?PHP vmRequest怎么用?PHP vmRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了vmRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plgVmAddToSearch
public function plgVmAddToSearch(&$where, &$PluginJoinTables, $custom_id)
{
if ($keyword = vmRequest::uword('custom_specification_name1', null, ' ')) {
$db = JFactory::getDBO();
if ($this->_name != $this->GetNameByCustomId($custom_id)) {
return;
}
$keyword = '"%' . $db->getEscaped($keyword, true) . '%"';
$where[] = $this->_name . '.`custom_specification_default1` LIKE ' . $keyword;
$PluginJoinTables[] = $this->_name;
}
return true;
}
示例2: validate_add
/**
* Validates the input parameters onBeforeUserAdd
*
* @param array $d
* @return boolean
*/
function validate_add(&$d)
{
global $my, $perm, $vmLogger, $VM_LANG;
$db = new ps_DB();
$valid = true;
$missing = "";
require_once CLASSPATH . 'ps_userfield.php';
$requiredFields = ps_userfield::getUserFields('registration', true);
$skipFields = array('username', 'password', 'password2', 'email', 'agreed');
foreach ($requiredFields as $field) {
if (in_array($field->name, $skipFields)) {
continue;
}
switch ($field->type) {
case 'age_verification':
// The Age Verification here is just a simple check if the selected date
// is a birthday older than the minimum age (default: 18)
$d[$field->name] = vmRequest::getInt('birthday_selector_year') . '-' . vmRequest::getInt('birthday_selector_month') . '-' . vmRequest::getInt('birthday_selector_day');
break;
default:
if (empty($d[$field->name]) && $field->sys == 1) {
$valid = false;
$fieldtitle = $field->title;
if ($VM_LANG->exists($fieldtitle)) {
$fieldtitle = $VM_LANG->_($fieldtitle);
}
$vmLogger->err(sprintf($VM_LANG->_('VM_USER_ERR_MISSINGVALUE'), $fieldtitle));
}
break;
}
}
$d['user_email'] = @$d['email'];
if (!$d['perms']) {
$vmLogger->warning($VM_LANG->_('VM_USER_ERR_GROUP'));
$valid = false;
} else {
if (!$perm->hasHigherPerms($d['perms'])) {
$vmLogger->err(sprintf($VM_LANG->_('VM_USER_ADD_ERR_NOPERMS'), $d['perms']));
$valid = false;
}
}
return $valid;
}
示例3: clean
/**
* Cleans the request from script injection.
*
* @static
* @return void
* @since 1.1
*/
function clean()
{
vmRequest::_cleanArray($_FILES);
vmRequest::_cleanArray($_ENV);
vmRequest::_cleanArray($_GET);
vmRequest::_cleanArray($_POST);
vmRequest::_cleanArray($_COOKIE);
vmRequest::_cleanArray($_SERVER);
if (isset($_SESSION)) {
vmRequest::_cleanArray($_SESSION);
}
$REQUEST = $_REQUEST;
$GET = $_GET;
$POST = $_POST;
$COOKIE = $_COOKIE;
$FILES = $_FILES;
$ENV = $_ENV;
$SERVER = $_SERVER;
if (isset($_SESSION)) {
$SESSION = $_SESSION;
}
foreach ($GLOBALS as $key => $value) {
if ($key != 'GLOBALS') {
unset($GLOBALS[$key]);
}
}
$_REQUEST = $REQUEST;
$_GET = $GET;
$_POST = $POST;
$_COOKIE = $COOKIE;
$_FILES = $FILES;
$_ENV = $ENV;
$_SERVER = $SERVER;
if (isset($SESSION)) {
$_SESSION = $SESSION;
}
// Make sure the request hash is clean on file inclusion
$GLOBALS['_VMREQUEST'] = array();
}
示例4: mm_showMyFileName
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/
mm_showMyFileName(__FILE__);
global $ps_shopper_group, $ps_product;
global $acl, $database;
include_class('shopper');
include_class('product');
if (!isset($ps_shopper_group)) {
$ps_shopper_group = new ps_shopper_group();
}
$user_id = intval(vmGet($_REQUEST, 'user_id'));
$cid = vmRequest::getVar('cid', array(0), '', 'array');
if (!empty($user_id)) {
$q = "SELECT * FROM #__users AS u LEFT JOIN #__{vm}_user_info AS ui ON id=user_id ";
$q .= "WHERE id={$user_id} ";
$q .= "AND (address_type='BT' OR address_type IS NULL ) ";
$q .= "AND gid <= " . $my->gid;
$db->query($q);
$db->next_record();
}
// Set up the CMS General User Information
$row = new mosUser($database);
$row->load((int) $user_id);
if ($user_id) {
$query = "SELECT *" . "\n FROM #__contact_details" . "\n WHERE user_id = " . (int) $row->id;
$database->setQuery($query);
$contact = $database->loadObjectList();
示例5: 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 {
//.........这里部分代码省略.........
示例6: update
/**
* Updates an Order Status
*
* @param array $d
* @return boolean
*/
function update(&$d)
{
global $VM_LANG;
$db = new ps_DB();
$ps_vendor_id = $_SESSION["ps_vendor_id"];
if (!$this->validate_update($d)) {
return False;
}
$fields = array('order_status_code' => vmGet($d, 'order_status_code'), 'order_status_name' => vmGet($d, 'order_status_name'), 'order_status_description' => vmGet($d, 'order_status_description'), 'list_order' => vmRequest::getInt('list_order'));
$db->buildQuery('UPDATE', $this->_table_name, $fields, "WHERE order_status_id=" . (int) $d["order_status_id"] . " AND vendor_id={$ps_vendor_id}");
if ($db->query() !== false) {
$GLOBALS['vmLogger']->info($VM_LANG->_('VM_ORDERSTATUS_UPDATED'));
return true;
}
return false;
}
示例7: add
/**
* Adds a new Shopper Group
*
* @param array $d
* @return boolean
*/
function add(&$d)
{
global $perm, $vmLogger, $VM_LANG;
$hash_secret = "virtuemart";
if ($perm->check("admin")) {
$vendor_id = $d["vendor_id"];
} else {
$vendor_id = $_SESSION["ps_vendor_id"];
}
$db = new ps_DB();
$timestamp = time();
$default = @$d["default"] == "1" ? "1" : "0";
if (!$this->validate_add($d)) {
return False;
}
$user_id = md5(uniqid($hash_secret));
$fields = array('vendor_id' => $vendor_id, 'shopper_group_name' => $d["shopper_group_name"], 'shopper_group_desc' => $d["shopper_group_desc"], 'shopper_group_discount' => $d["shopper_group_discount"], 'show_price_including_tax' => $d["show_price_including_tax"], 'default' => $default);
$db->buildQuery('INSERT', '#__{vm}_shopper_group', $fields);
if ($db->query() !== false) {
$shopper_group_id = $db->last_insert_id();
vmRequest::setVar('shopper_group_id', $shopper_group_id);
$vmLogger->info($VM_LANG->_('SHOPPER_GROUP_ADDED'));
// Set all other shopper groups to be non-default, if this new shopper group shall be "default"
if ($default == "1") {
$q = "UPDATE #__{vm}_shopper_group ";
$q .= "SET `default`=0 ";
$q .= "WHERE shopper_group_id !=" . $shopper_group_id;
$q .= " AND vendor_id ={$vendor_id}";
$db->query($q);
$db->next_record();
}
return $_REQUEST['shopper_group_id'];
}
$vmLogger->err($VM_LANG->_('SHOPPER_GROUP_ADD_FAILED'));
return false;
}
示例8: utime
$only_page = vmRequest::getInt('only_page', 0);
if (PSHOP_IS_OFFLINE == '1' && !$perm->hasHigherPerms('storeadmin')) {
echo PSHOP_OFFLINE_MESSAGE;
} else {
if (PSHOP_IS_OFFLINE == '1') {
echo '<h2>' . $VM_LANG->_('OFFLINE_MODE') . '</h2>';
}
if ($is_popup) {
echo "<style type='text/css' media='print'>.vmNoPrint { display: none }</style>";
echo vmCommonHTML::PrintIcon('', true, ' ' . $VM_LANG->_('CMN_PRINT'));
}
// The Vendor ID is important
$ps_vendor_id = $_SESSION['ps_vendor_id'];
// The authentication array
$auth = $_SESSION['auth'];
$no_menu = vmRequest::getInt('no_menu', 0);
// Timer Start
if (vmShouldDebug()) {
/*@MWM1: Log/Debug enhancements */
$start = utime();
$GLOBALS["mosConfig_debug"] = 1;
}
// update the cart because something could have
// changed while running a function
$cart = $_SESSION["cart"];
if ((!$pagePermissionsOK || !$funcParams) && $_REQUEST['page'] != 'checkout.index') {
if (!$pagePermissionsOK && defined('_VM_PAGE_NOT_AUTH')) {
$page = 'checkout.login_form';
echo '<br/><br/>' . $VM_LANG->_('DO_LOGIN') . '<br/><br/>';
} elseif (!$pagePermissionsOK && defined('_VM_PAGE_NOT_FOUND')) {
$page = HOMEPAGE;
示例9: mm_showMyFileName
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/
mm_showMyFileName(__FILE__);
if (!isset($_REQUEST["shopper_id"]) || empty($_REQUEST["shopper_id"])) {
echo $VM_LANG->_('VM_CHECKOUT_ORDERIDNOTSET');
} else {
include CLASSPATH . "payment/ps_ipayment.cfg.php";
$order_number = vmrequest::getVar('shopper_id');
$q = 'SELECT order_id,order_total,order_status,order_currency FROM #__{vm}_orders WHERE ';
$q .= '#__{vm}_orders.user_id= ' . $auth["user_id"] . "\n";
$q .= 'AND #__{vm}_orders.order_number=\'' . $db->getEscaped($order_number) . "'";
$db->query($q);
if ($db->next_record()) {
if (vmRequest::getVar('ret_status') == 'SUCCESS') {
?>
<img src="<?php
echo VM_THEMEURL;
?>
images/button_ok.png" align="middle" alt="<?php
echo $VM_LANG->_('VM_CHECKOUT_SUCCESS');
?>
" border="0" />
<h2><?php
echo $VM_LANG->_('PHPSHOP_PAYMENT_TRANSACTION_SUCCESS');
?>
</h2>
<?php
示例10: ps_product
require_once CLASSPATH . 'ps_product.php';
require_once CLASSPATH . 'ps_order_status.php';
require_once CLASSPATH . 'ps_checkout.php';
require_once CLASSPATH . 'ps_order_change.php';
require_once CLASSPATH . 'ps_order_change_html.php';
$ps_product = new ps_product();
$order_id = vmRequest::getInt('order_id');
$ps_order_change_html = new ps_order_change_html($order_id);
//Added Option to resend the Confirmation Mail
$resend_action = vmRequest::getVar('func');
if ($resend_action == 'resendconfirm' && $order_id) {
ps_checkout::email_receipt($order_id);
$redirurl = $_SERVER['PHP_SELF'];
foreach ($_POST as $key => $value) {
if ($value != 'resendconfirm') {
$redirurl .= !strpos($redirurl, '?') ? '?' : '&' . $key . '=' . vmRequest::getVar($key);
}
}
vmRedirect($redirurl, $VM_LANG->_('PHPSHOP_ORDER_RESEND_CONFIRMATION_MAIL_SUCCESS'));
}
if (!is_numeric($order_id)) {
echo "<h2>The Order ID {$order_id} is not valid.</h2>";
} else {
$dbc = new ps_DB();
$q = "SELECT * FROM #__{vm}_orders WHERE order_id='{$order_id}'";
$db->query($q);
if ($db->next_record()) {
// Print View Icon
$print_url = $_SERVER['PHP_SELF'] . "?page=order.order_printdetails&order_id={$order_id}&no_menu=1&pop=1";
if (vmIsJoomla('1.5', '>=')) {
$print_url .= "&tmpl=component";
示例11: linkTag
/**
* Returns a link tag
*
* @param string $href
* @param string $type
* @param string $rel
* @return string
*/
function linkTag($href, $type = 'text/css', $rel = 'stylesheet', $media = "screen, projection")
{
global $mosConfig_gzip, $mosConfig_live_site;
if (isset($_REQUEST['usefetchscript'])) {
$use_fetchscript = vmRequest::getBool('usefetchscript', 1);
vmRequest::setVar('usefetchscript', $use_fetchscript, 'session');
} else {
$use_fetchscript = vmRequest::getBool('usefetchscript', 1, 'session');
}
if (stristr($href, 'com_virtuemart') && $use_fetchscript) {
$base_href = str_replace(URL, '', $href);
$base_href = str_replace(SECUREURL, '', $base_href);
$base_href = str_replace('components/com_virtuemart/', '', $base_href);
$href = $mosConfig_live_site . '/components/com_virtuemart/fetchscript.php?gzip=' . $mosConfig_gzip . '&subdir[0]=' . dirname($base_href) . '&file[0]=' . basename($href);
}
return '<link type="' . $type . '" href="' . $href . '" rel="' . $rel . '"' . (empty($media) ? '' : ' media="' . $media . '"') . ' />' . "\n";
}
示例12: stripslashes
<input type="hidden" name="Itemid" value="' . $sess->getShopItemid() . '" />
<input type="hidden" name="description" value="' . stripslashes($cart[$i]["description"]) . '" />
<input type="image" name="update" title="' . $VM_LANG->_('PHPSHOP_CART_UPDATE') . '" src="' . VM_THEMEURL . 'images/update_quantity_cart.png" alt="' . $VM_LANG->_('PHPSHOP_UPDATE') . '" align="middle" />
</form>';
$product_rows[$i]['delete_form'] = '<form action="' . $action_url . '" method="post" name="delete" style="display: inline;">
<input type="hidden" name="option" value="com_virtuemart" />
<input type="hidden" name="page" value="' . $page . '" />
<input type="hidden" name="Itemid" value="' . $sess->getShopItemid() . '" />
<input type="hidden" name="func" value="cartDelete" />
<input type="hidden" name="product_id" value="' . $_SESSION['cart'][$i]["product_id"] . '" />
<input type="hidden" name="description" value="' . $cart[$i]["description"] . '" />
<input type="image" name="delete" title="' . $VM_LANG->_('PHPSHOP_CART_DELETE') . '" src="' . VM_THEMEURL . 'images/remove_from_cart.png" alt="' . $VM_LANG->_('PHPSHOP_CART_DELETE') . '" align="middle" />
</form>';
}
// End of for loop through the Cart
vmRequest::setVar('zone_qty', $vars['zone_qty']);
$total = $total_undiscounted = round($total, 5);
$vars["total"] = $total;
$subtotal_display = $GLOBALS['CURRENCY_DISPLAY']->getFullValue($grandSubtotal);
if (!empty($_POST["do_coupon"]) || in_array(strtolower($func), array('cartadd', 'cartupdate', 'cartdelete')) && !empty($_SESSION['coupon_redeemed'])) {
/* process the coupon */
require_once CLASSPATH . "ps_coupon.php";
$vars["total"] = $total;
ps_coupon::process_coupon_code($vars);
}
/* HANDLE SHIPPING COSTS */
if (!empty($shipping_rate_id) && !ps_checkout::noShippingMethodNecessary()) {
$shipping = true;
$vars["weight"] = $weight_total;
$shipping_total = round($ps_checkout->_SHIPPING->get_rate($vars), 5);
$shipping_taxrate = $ps_checkout->_SHIPPING->get_tax_rate();
示例13: update
/**
* Updates a Payment Entry
*
* @param array $d
* @return boolean
*/
function update(&$d)
{
global $VM_LANG;
global $vmLogger, $VM_LANG;
$ps_vendor_id = $_SESSION["ps_vendor_id"];
$db = new ps_DB();
if (!$this->validate_update($d)) {
return False;
}
if (!empty($d["payment_class"])) {
$payment_class = basename($d["payment_class"]);
@(include CLASSPATH . "payment/" . $payment_class . ".php");
if (class_exists($payment_class)) {
$_PAYMENT = new $payment_class();
} else {
$GLOBALS['vmLogger']->err($VM_LANG->_('VM_PAYMENTMETHOD_CLASS_NOT_EXIST'));
return false;
}
} else {
include CLASSPATH . "payment/ps_payment.php";
$_PAYMENT = new ps_payment();
}
if ($_PAYMENT->configfile_writeable() || $_PAYMENT->classname == 'ps_payment') {
$_PAYMENT->write_configuration($d);
$vmLogger->info($VM_LANG->_('VM_CONFIGURATION_CHANGE_SUCCESS', false));
} else {
$vmLogger->err(sprintf($VM_LANG->_('VM_CONFIGURATION_CHANGE_FAILURE', false), CLASSPATH . "payment/" . $_PAYMENT->classname . ".cfg.php"));
return false;
}
$fields = array('payment_method_name' => vmGet($d, 'payment_method_name'), 'payment_class' => vmGet($d, 'payment_class'), 'shopper_group_id' => vmRequest::getInt('shopper_group_id'), 'payment_method_discount' => vmRequest::getFloat('payment_method_discount'), 'payment_method_discount_is_percent' => vmGet($d, 'payment_method_discount_is_percent'), 'payment_method_discount_max_amount' => (double) str_replace(',', '.', $d["payment_method_discount_max_amount"]), 'payment_method_discount_min_amount' => (double) str_replace(',', '.', $d["payment_method_discount_min_amount"]), 'payment_method_code' => vmGet($d, 'payment_method_code'), 'enable_processor' => vmGet($d, 'enable_processor'), 'list_order' => vmRequest::getInt('list_order'), 'is_creditcard' => vmGet($d, 'is_creditcard'), 'payment_enabled' => vmGet($d, 'payment_enabled'), 'accepted_creditcards' => vmGet($d, 'accepted_creditcards'), 'payment_extrainfo' => vmGet($_POST, 'payment_extrainfo', null, VMREQUEST_ALLOWRAW));
$db->buildQuery('UPDATE', '#__{vm}_payment_method', $fields, 'WHERE payment_method_id=' . (int) $d["payment_method_id"] . ' AND vendor_id=' . $ps_vendor_id);
$db->query();
return True;
}
示例14: display
//.........这里部分代码省略.........
if (!empty($tpl)) {
$format = $tpl;
} else {
$format = JRequest::getWord('format', 'html');
}
if ($format == 'html') {
$document->addHeadLink(JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id=' . $categoryId), 'canonical', 'rel', '');
}
// Set the titles
if ($category->customtitle) {
$title = strip_tags($category->customtitle);
} elseif ($category->category_name) {
$title = strip_tags($category->category_name);
} else {
$menus = $app->getMenu();
$menu = $menus->getActive();
if ($menu) {
$title = $menu->title;
}
// $title = $this->params->get('page_title', '');
// Check for empty title and add site name if param is set
if (empty($title)) {
$title = $app->getCfg('sitename');
} elseif ($app->getCfg('sitename_pagetitles', 0) == 1) {
$title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
} elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
$title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
}
}
if (JRequest::getInt('error')) {
$title .= ' ' . JText::_('COM_VIRTUEMART_PRODUCT_NOT_FOUND');
}
// set search and keyword
if ($keyword = vmRequest::uword('keyword', '', ' ')) {
$pathway->addItem($keyword);
$title .= ' (' . $keyword . ')';
}
$search = JRequest::getvar('keyword', null);
if ($search !== null) {
$searchcustom = $this->getSearchCustom();
}
$this->assignRef('keyword', $keyword);
$this->assignRef('search', $search);
// Load the products in the given category
$products = $productModel->getProductsInCategory($categoryId);
$productModel->addImages($products, 1);
$this->assignRef('products', $products);
foreach ($products as $product) {
$product->stock = $productModel->getStockIndicator($product);
}
$ratingModel = VmModel::getModel('ratings');
$showRating = $ratingModel->showRating();
$this->assignRef('showRating', $showRating);
$virtuemart_manufacturer_id = JRequest::getInt('virtuemart_manufacturer_id', 0);
if ($virtuemart_manufacturer_id and !empty($products[0])) {
$title .= ' ' . $products[0]->mf_name;
}
$document->setTitle($title);
// Override Category name when viewing manufacturers products !IMPORTANT AFTER page title.
if (JRequest::getInt('virtuemart_manufacturer_id') and !empty($products[0])) {
$category->category_name = $products[0]->mf_name;
}
$pagination = $productModel->getPagination($perRow);
$this->assignRef('vmPagination', $pagination);
$orderByList = $productModel->getOrderByList($categoryId);
$this->assignRef('orderByList', $orderByList);
示例15: update
/**
* updates Product Type information
* @author Zdenek Dvorak
* @param array $d
* @return boolean
*/
function update(&$d)
{
$db = new ps_DB();
if ($this->validate_update($d)) {
if (empty($d["product_type_publish"])) {
$d["product_type_publish"] = "N";
}
$fields = array('product_type_name' => vmGet($d, 'product_type_name'), 'product_type_description' => vmGet($d, 'product_type_description'), 'product_type_publish' => vmGet($d, 'product_type_publish'), 'product_type_browsepage' => vmGet($d, 'product_type_browsepage'), 'product_type_flypage' => vmGet($d, 'product_type_flypage'), 'product_type_list_order' => vmRequest::getInt('list_order'));
$db->buildQuery('UPDATE', '#__{vm}_product_type', $fields, 'WHERE product_type_id=' . (int) $d["product_type_id"]);
$db->query();
// Re-Order the Product Type table IF the list_order has been changed
if (intval($d['list_order']) != intval($d['currentpos'])) {
$dbu = new ps_DB();
/* Moved UP in the list order */
if (intval($d['list_order']) < intval($d['currentpos'])) {
$q = "SELECT product_type_id FROM #__{vm}_product_type WHERE ";
$q .= "product_type_id <> '" . $d["product_type_id"] . "' ";
$q .= "AND product_type_list_order >= '" . intval($d["list_order"]) . "'";
$db->query($q);
while ($db->next_record()) {
$dbu->query("UPDATE #__{vm}_product_type SET product_type_list_order=product_type_list_order+1 WHERE product_type_id='" . $db->f("product_type_id") . "'");
}
} else {
$q = "SELECT product_type_id FROM #__{vm}_product_type WHERE ";
$q .= "product_type_id <> '" . $d["product_type_id"] . "' ";
$q .= "AND product_type_list_order > '" . intval($d["currentpos"]) . "'";
$q .= "AND product_type_list_order <= '" . intval($d["list_order"]) . "'";
$db->query($q);
while ($db->next_record()) {
$dbu->query("UPDATE #__{vm}_product_type SET product_type_list_order=product_type_list_order-1 WHERE product_type_id='" . $db->f("product_type_id") . "'");
}
}
}
// END Re-Ordering
return True;
} else {
return False;
}
}