本文整理汇总了PHP中vmRequest::getFloat方法的典型用法代码示例。如果您正苦于以下问题:PHP vmRequest::getFloat方法的具体用法?PHP vmRequest::getFloat怎么用?PHP vmRequest::getFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vmRequest
的用法示例。
在下文中一共展示了vmRequest::getFloat方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Function to update product $d['product_id'] in the product table
*
* @param array $d The input vars
* @return boolean True, when the product was updated, false when not
*/
function update(&$d)
{
global $vmLogger, $perm, $VM_LANG;
require_once CLASSPATH . 'ps_product_attribute.php';
if (!$this->validate($d)) {
return false;
}
if (!vmImageTools::process_images($d)) {
return false;
}
$timestamp = time();
$db = new ps_DB();
$ps_vendor_id = $_SESSION["ps_vendor_id"];
if ($perm->check('admin')) {
$vendor_id = $d['vendor_id'];
} else {
$vendor_id = $ps_vendor_id;
}
$old_vendor_id = $this->get_field($d['product_id'], 'vendor_id');
// Insert into DB
$fields = array('vendor_id' => $vendor_id, 'product_sku' => vmGet($d, 'product_sku'), 'product_name' => vmGet($d, 'product_name'), 'product_desc' => vmRequest::getVar('product_desc', '', 'default', '', VMREQUEST_ALLOWHTML), 'product_s_desc' => vmRequest::getVar('product_s_desc', '', 'default', '', VMREQUEST_ALLOWHTML), 'product_thumb_image' => vmGet($d, 'product_thumb_image'), 'product_full_image' => vmGet($d, 'product_full_image'), 'product_publish' => $d['product_publish'], 'product_weight' => vmRequest::getFloat('product_weight'), 'product_weight_uom' => vmGet($d, 'product_weight_uom'), 'product_length' => vmRequest::getFloat('product_length'), 'product_width' => vmRequest::getFloat('product_width'), 'product_height' => vmRequest::getFloat('product_height'), 'product_lwh_uom' => vmGet($d, 'product_lwh_uom'), 'product_unit' => vmGet($d, 'product_unit'), 'product_packaging' => $d["product_box"] << 16 | $d["product_packaging"] & 0xffff, 'product_url' => vmGet($d, 'product_url'), 'product_in_stock' => vmRequest::getInt('product_in_stock'), 'attribute' => ps_product_attribute::formatAttributeX(), 'custom_attribute' => vmGet($d, 'product_custom_attribute'), 'product_available_date' => $d['product_available_date_timestamp'], 'product_availability' => vmGet($d, 'product_availability'), 'product_special' => $d['product_special'], 'child_options' => $d['child_options'], 'quantity_options' => $d['quantity_options'], 'product_discount_id' => vmRequest::getInt('product_discount_id'), 'mdate' => $timestamp, 'product_tax_id' => vmRequest::getInt('product_tax_id'), 'child_option_ids' => vmGet($d, 'included_product_id'), 'product_order_levels' => $d['order_levels']);
$db->buildQuery('UPDATE', '#__{vm}_product', $fields, 'WHERE product_id=' . (int) $d["product_id"] . ' AND vendor_id=' . (int) $old_vendor_id);
$db->query();
/* notify the shoppers that the product is here */
/* see zw_waiting_list */
if ($d["product_in_stock"] > "0" && @$d['notify_users'] == '1' && $d['product_in_stock_old'] == '0') {
require_once CLASSPATH . 'zw_waiting_list.php';
$zw_waiting_list = new zw_waiting_list();
$zw_waiting_list->notify_list($d["product_id"]);
}
// Check if the Manufacturer XRef is missing
if ($this->get_manufacturer_id($d['product_id'])) {
$q = "UPDATE #__{vm}_product_mf_xref SET ";
$q .= 'manufacturer_id=' . vmRequest::getInt('manufacturer_id') . ' ';
$q .= 'WHERE product_id = ' . $d['product_id'];
} else {
$q = "INSERT INTO #__{vm}_product_mf_xref (product_id,manufacturer_id) VALUES ('" . $d['product_id'] . "','" . vmRequest::getInt('manufacturer_id') . "')";
}
$db->query($q);
/* If is Item, update attributes */
if (!empty($d["product_parent_id"])) {
$q = "SELECT attribute_name FROM #__{vm}_product_attribute_sku ";
$q .= 'WHERE product_id=' . (int) $d["product_parent_id"] . ' ';
$q .= "ORDER BY attribute_list,attribute_name";
$db->query($q);
$db2 = new ps_DB();
$i = 0;
while ($db->next_record()) {
$i++;
$q2 = "UPDATE #__{vm}_product_attribute SET ";
$q2 .= "attribute_value='" . vmGet($d, 'attribute_' . $i) . "' ";
$q2 .= "WHERE product_id = '" . $d["product_id"] . "' ";
$q2 .= "AND attribute_name = '" . $db->f("attribute_name", false) . "' ";
$db2->setQuery($q2);
$db2->query();
}
/* If it is a Product, update Category */
} else {
// Handle category selection: product_category_xref
$q = "SELECT `category_id` FROM `#__{vm}_product_category_xref` ";
$q .= "WHERE `product_id` = '" . $d["product_id"] . "' ";
$db->setQuery($q);
$db->query();
$old_categories = array();
while ($db->next_record()) {
$old_categories[$db->f('category_id')] = $db->f('category_id');
}
// NOW Insert new categories
$new_categories = array();
if (empty($d['product_categories']) || !is_array(@$d['product_categories'])) {
$d['product_categories'] = explode('|', $d['category_ids']);
}
foreach ($d["product_categories"] as $category_id) {
if (!in_array($category_id, $old_categories)) {
$db->query('SELECT MAX(`product_list`) as list_order FROM `#__{vm}_product_category_xref` WHERE `category_id`=' . (int) $category_id);
$db->next_record();
$q = "INSERT INTO #__{vm}_product_category_xref ";
$q .= "(category_id,product_id,product_list) ";
$q .= "VALUES ('" . (int) $category_id . "','" . $d["product_id"] . "', " . intval($db->f('max') + 1) . ")";
$db->setQuery($q);
$db->query();
$new_categories[$category_id] = $category_id;
} else {
unset($old_categories[$category_id]);
}
}
// The rest of the old categories can be deleted
foreach ($old_categories as $category_id) {
$q = "DELETE FROM `#__{vm}_product_category_xref` ";
$q .= "WHERE `product_id` = '" . $d["product_id"] . "' ";
$q .= "AND `category_id` = '" . $category_id . "' ";
$db->query($q);
}
}
//.........这里部分代码省略.........
示例2: vm_ps_order_change
}
}
if (vmGet($_REQUEST, 'page') == 'order.order_print' && !empty($order_id)) {
$ps_order_change = new vm_ps_order_change($order_id);
if (vmGet($_REQUEST, 'change_bill_to') != '') {
$ps_order_change->change_bill_to();
} elseif (vmGet($_REQUEST, 'change_ship_to') != '') {
$ps_order_change->change_ship_to();
} elseif (vmGet($_REQUEST, 'change_customer_note') != '') {
$ps_order_change->change_customer_note();
} elseif (vmGet($_REQUEST, 'change_standard_shipping') != '') {
$ps_order_change->change_standard_shipping();
} elseif (vmGet($_REQUEST, 'change_shipping') != '') {
$ps_order_change->change_shipping($order_id, vmRequest::getFloat('order_shipping'));
} elseif (vmGet($_REQUEST, 'change_shipping_tax') != '') {
$ps_order_change->change_shipping_tax($order_id, vmRequest::getFloat('order_shipping_tax'));
} elseif (vmGet($_REQUEST, 'change_discount') != '') {
if ($ps_order_change->change_discount($order_id, trim(vmGet($_REQUEST, 'order_discount')))) {
$vmLogger->err("Invalid Order Item ID or Discount is not a number!");
} else {
$vmLogger->info($VM_LANG->_('PHPSHOP_COUPON_DISCOUNT') . $VM_LANG->_('PHPSHOP_ORDER_EDIT_SOMETHING_HAS_CHANGED'));
}
} elseif (vmGet($_REQUEST, 'change_coupon_discount') != '') {
if ($ps_order_change->change_coupon_discount($order_id, trim(vmGet($_REQUEST, 'coupon_discount')))) {
$vmLogger->err("Discount is not a number!");
} else {
$vmLogger->info($VM_LANG->_('PHPSHOP_COUPON_DISCOUNT') . $VM_LANG->_('PHPSHOP_ORDER_EDIT_SOMETHING_HAS_CHANGED'));
}
} elseif (vmGet($_REQUEST, 'change_delete_item') != '') {
if ($ps_order_change->change_delete_item($order_id, vmGet($_REQUEST, 'order_item_id'))) {
$vmLogger->err("Discount is not a number!");
示例3: 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;
}
示例4: update
/**
* Updates a product price
*
* @param array $d
* @return boolean
*/
function update(&$d)
{
global $vmLogger, $VM_LANG;
if (!$this->validate($d)) {
return false;
}
if ($d["product_price"] === '') {
return $this->delete($d);
}
$timestamp = time();
$db = new ps_DB();
if (empty($d["product_price_vdate"])) {
$d["product_price_vdate"] = '';
}
if (empty($d["product_price_edate"])) {
$d["product_price_edate"] = '';
}
$fields = array('shopper_group_id' => vmRequest::getInt('shopper_group_id'), 'product_price' => vmRequest::getFloat('product_price'), 'product_currency' => vmGet($d, 'product_currency'), 'product_price_vdate' => vmGet($d, 'product_price_vdate'), 'product_price_edate' => vmGet($d, 'product_price_edate'), 'mdate' => $timestamp, 'price_quantity_start' => vmRequest::getInt('price_quantity_start'), 'price_quantity_end' => vmRequest::getInt('price_quantity_end'));
$db = new ps_DB();
$db->buildQuery('UPDATE', '#__{vm}_product_price', $fields, 'WHERE product_price_id=' . (int) $d["product_price_id"]);
if ($db->query() !== false) {
$vmLogger->info($VM_LANG->_('VM_PRODUCT_PRICE_UPDATED', false));
return true;
}
$vmLogger->err($VM_LANG->_('VM_PRODUCT_PRICE_UPDATING_FAILED', false));
return false;
}