本文整理汇总了PHP中MG::numberDeFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP MG::numberDeFormat方法的具体用法?PHP MG::numberDeFormat怎么用?PHP MG::numberDeFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MG
的用法示例。
在下文中一共展示了MG::numberDeFormat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveOrder
/**
* Сохраняет и обновляет параметры заказа.
* @return type
*/
public function saveOrder()
{
$this->messageSucces = $this->lang['ACT_SAVE_ORD'];
$this->messageError = $this->lang['ACT_SAVE_ORDER'];
if (count($_POST['order_content']) != $_POST['orderPositionCount']) {
$this->messageError = 'Невозможно передать столь большой заказ на ваш сервер. Необходимо изменить настройки web-сервера!';
return false;
}
unset($_POST['orderPositionCount']);
// Cобираем воедино все параметры от юр. лица если они были переданы, для записи в информацию о заказе.
$_POST['yur_info'] = '';
$informUser = $_POST['inform_user'];
unset($_POST['inform_user']);
if (!empty($_POST['inn'])) {
$_POST['yur_info'] = array('email' => htmlspecialchars($_POST['orderEmail']), 'name' => htmlspecialchars($_POST['orderBuyer']), 'address' => htmlspecialchars($_POST['orderAddress']), 'phone' => htmlspecialchars($_POST['orderPhone']), 'inn' => htmlspecialchars($_POST['inn']), 'kpp' => htmlspecialchars($_POST['kpp']), 'nameyur' => htmlspecialchars($_POST['nameyur']), 'adress' => htmlspecialchars($_POST['adress']), 'bank' => htmlspecialchars($_POST['bank']), 'bik' => htmlspecialchars($_POST['bik']), 'ks' => htmlspecialchars($_POST['ks']), 'rs' => htmlspecialchars($_POST['rs']));
}
$model = new Models_Order();
// Обновление.
if (!empty($_POST['id'])) {
unset($_POST['inn']);
unset($_POST['kpp']);
unset($_POST['nameyur']);
unset($_POST['adress']);
unset($_POST['bank']);
unset($_POST['bik']);
unset($_POST['ks']);
unset($_POST['rs']);
unset($_POST['ogrn']);
if (!empty($_POST['yur_info'])) {
$_POST['yur_info'] = addslashes(serialize($_POST['yur_info']));
}
foreach ($_POST['order_content'] as &$item) {
foreach ($item as &$v) {
$v = rawurldecode($v);
}
}
$_POST['delivery_cost'] = MG::numberDeFormat($_POST['delivery_cost']);
$_POST['order_content'] = addslashes(serialize($_POST['order_content']));
$model->refreshCountAfterEdit($_POST['id'], $_POST['order_content']);
$model->updateOrder($_POST, $informUser);
} else {
$newUserData = array('email' => htmlspecialchars($_POST['user_email']), 'role' => 2, 'name' => htmlspecialchars($_POST['name_buyer']), 'pass' => crypt(time()), 'address' => htmlspecialchars($_POST['address']), 'phone' => htmlspecialchars($_POST['phone']), 'inn' => htmlspecialchars($_POST['inn']), 'kpp' => htmlspecialchars($_POST['kpp']), 'nameyur' => htmlspecialchars($_POST['nameyur']), 'adress' => htmlspecialchars($_POST['adress']), 'bank' => htmlspecialchars($_POST['bank']), 'bik' => htmlspecialchars($_POST['bik']), 'ks' => htmlspecialchars($_POST['ks']), 'rs' => htmlspecialchars($_POST['rs']));
if ($_POST['user_email'] != '') {
USER::add($newUserData);
}
$orderArray = $model->addOrder($_POST);
$id = $orderArray['id'];
$orderNumber = $orderArray['orderNumber'];
$this->messageSucces = $this->lang['ACT_SAVE_ORD'] . ' № ' . $orderNumber;
$_POST['id'] = $id;
$_POST['newId'] = $id;
$_POST['number'] = $orderNumber;
$_POST['date'] = MG::dateConvert(date('d.m.Y H:i'));
}
$_POST['count'] = $model->getNewOrdersCount();
$_POST['date'] = MG::dateConvert(date('d.m.Y H:i'));
$this->data = $_POST;
return true;
}
示例2: formateMogutaCMSUpdate
/**
* выгрузка для обновления цен имеющихся товаров по их артикулам
*/
public function formateMogutaCMSUpdate($data)
{
$itemsIn = array('price' => trim(MG::numberDeFormat($data[1])), 'old_price' => trim(MG::numberDeFormat($data[2])), 'count' => trim($data[3]), 'activity' => trim($data[4]));
if (count($data) < count($itemsIn) + 1 && count($data) > 1) {
$this->validError = 'Нарушена целостность строки!';
return false;
}
DB::query('
UPDATE `' . PREFIX . 'product`
SET ' . DB::buildPartQuery($itemsIn) . '
WHERE code = ' . DB::quote($data[0]));
DB::query('
UPDATE `' . PREFIX . 'product_variant`
SET ' . DB::buildPartQuery($itemsIn) . '
WHERE code = ' . DB::quote($data[0]));
$model = new Models_Product();
$currencyShopIso = MG::getSetting('currencyShopIso');
$res = DB::query('
SELECT id
FROM `' . PREFIX . 'product`
WHERE code = ' . DB::quote($data[0]));
if ($row = DB::fetchAssoc($res)) {
$model->updatePriceCourse($currencyShopIso, array($row['id']));
}
return true;
}
示例3: addToCsvLine
/**
* Добавляет продукт в CSV выгрузку.
* @param type $row - продукт.
* @param type $variant - есть ли варианты этого продукта.
* @return string
*/
public function addToCsvLine($row, $variant = false)
{
$row['category_url'] = '"' . str_replace("\"", "\"\"", htmlspecialchars_decode($row['category_url'])) . '"';
$row['category_full_url'] = '"' . str_replace("\"", "\"\"", $row['category_full_url']) . '"';
$row['title'] = '"' . str_replace("\"", "\"\"", htmlspecialchars_decode($row['title'])) . '"';
$row['description'] = '"' . str_replace("\"", "\"\"", $row['description']) . '"';
$row['price'] = '"' . str_replace("\"", "\"\"", MG::numberDeFormat($row['real_price'])) . '"';
$row['price'] = str_replace(".", ",", $row['price']);
$row['url'] = '"' . str_replace("\"", "\"\"", $row['url']) . '"';
$row['image_url'] = '';
if (!empty($row['images_product'])) {
$row['image_url'] = implode('|', $row['images_product']);
}
$row['code'] = '"' . str_replace("\"", "\"\"", $row['code']) . '"';
$row['count'] = '"' . str_replace("\"", "\"\"", $row['count']) . '"';
$row['activity'] = '"' . str_replace("\"", "\"\"", $row['activity']) . '"';
$row['meta_title'] = '"' . str_replace("\"", "\"\"", htmlspecialchars_decode($row['meta_title'])) . '"';
$row['meta_keywords'] = '"' . str_replace("\"", "\"\"", htmlspecialchars_decode($row['meta_keywords'])) . '"';
$row['meta_desc'] = '"' . str_replace("\"", "\"\"", htmlspecialchars_decode($row['meta_desc'])) . '"';
$row['old_price'] = '"' . str_replace("\"", "\"\"", MG::numberDeFormat($row['real_old_price'])) . '"';
$row['old_price'] = $row['real_old_price'] != '"0"' ? str_replace(".", ",", $row['real_old_price']) : '';
$row['recommend'] = '"' . str_replace("\"", "\"\"", $row['recommend']) . '"';
$row['new'] = '"' . str_replace("\"", "\"\"", $row['new']) . '"';
$row['sort'] = '"' . str_replace("\"", "\"\"", $row['sort']) . '"';
$row['description'] = str_replace("\r", "", $row['description']);
$row['description'] = str_replace("\n", "", $row['description']);
$row['meta_desc'] = str_replace("\r", "", $row['meta_desc']);
$row['meta_desc'] = str_replace("\n", "", $row['meta_desc']);
$row['related'] = '"' . str_replace("\"", "\"\"", $row['related']) . '"';
$row['weight'] = str_replace(".", ",", $row['weight']);
//получаем строку со связанными продуктами
// формируем строку с характеристиками
$property = '';
if (!empty($row['thisUserFields'])) {
foreach ($row['thisUserFields'] as $item) {
if ($item['type'] == 'string') {
$item['name'] = str_replace("&", "&", htmlspecialchars_decode($item['name']));
$item['value'] = str_replace("&", "&", htmlspecialchars_decode($item['value']));
$property .= '&' . $item['name'] . '=' . $item['value'];
}
}
}
$property = substr($property, 1);
$row['property'] = $property;
$row['property'] = str_replace("\r", "", $row['property']);
$row['property'] = str_replace("\n", "", $row['property']);
$row['property'] = '"' . str_replace("\"", "\"\"", $row['property']) . '";';
$csvText = $row['category_url'] . ";" . $row['category_full_url'] . ";" . $row['title'] . ";";
if ($variant) {
$csvText .= '"' . str_replace("\"", "\"\"", htmlspecialchars_decode($row['title_variant'])) . '";';
} else {
$csvText .= ";";
}
$csvText .= $row['description'] . ";" . $row['price'] . ";" . $row['url'] . ";" . $row['image_url'] . ";" . $row['code'] . ";" . $row['count'] . ";" . $row['activity'] . ";" . $row['meta_title'] . ";" . $row['meta_keywords'] . ";" . $row['meta_desc'] . ";" . $row['old_price'] . ";" . $row['recommend'] . ";" . $row['new'] . ";" . $row['sort'] . ";" . $row['weight'] . ";" . $row['related'] . ";" . $row['inside_cat'] . ";" . $row['link_electro'] . ";" . $row['currency_iso'] . ";" . $row['property'] . "\n";
return $csvText;
}