本文整理汇总了PHP中order::get方法的典型用法代码示例。如果您正苦于以下问题:PHP order::get方法的具体用法?PHP order::get怎么用?PHP order::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类order
的用法示例。
在下文中一共展示了order::get方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: order_edit
public function order_edit()
{
$object = $this->expectObject("param0", true);
$mode = (string) getRequest('param1');
$objectId = $object->getId();
$this->setHeaderLabel("header-users-edit-" . $this->getObjectTypeMethod($object));
$this->checkSv($objectId);
$inputData = array("object" => $object, "allowed-element-types" => array('emarket', 'order'));
if ($mode == "do") {
$oldDeliveryPrice = $object->getValue('delivery_price');
$object = $this->saveEditedObjectData($inputData);
$newDeliveryPrice = $object->getValue('delivery_price');
$order = order::get($object->id);
$amounts = getRequest('order-amount-item');
$dels = getRequest('order-del-item');
$isChanged = false;
if (is_array($amounts)) {
foreach ($amounts as $itemId => $amount) {
$item = $order->getItem($itemId);
if ($item instanceof orderItem) {
if ($item->getAmount() != $amount) {
$item->setAmount($amount);
$item->commit();
$isChanged = true;
}
}
}
}
if (is_array($dels)) {
foreach ($dels as $itemId) {
$item = orderItem::get($itemId);
if ($item instanceof orderItem) {
$order->removeItem($item);
$isChanged = true;
}
}
}
if ($isChanged) {
$order->refresh();
$order->commit();
}
if ($oldDeliveryPrice != $newDeliveryPrice && !$isChanged) {
$originalPrice = $object->getValue('total_original_price');
$totalPrice = $originalPrice;
$discount = $order->getDiscount();
if ($discount instanceof discount) {
$totalPrice = $discount->recalcPrice($originalPrice);
}
$totalPrice += $newDeliveryPrice;
$object->setValue('total_price', $totalPrice);
$object->commit();
}
$this->chooseRedirect();
}
$this->setDataType("form");
$this->setActionType("modify");
$data = $this->prepareData($inputData, "object");
$this->setData($data);
return $this->doData();
}
示例2: getPricesSum
protected function getPricesSum()
{
$orders = $this->getCustomerOrders();
$price = 0;
foreach ($orders as $orderObject) {
$order = order::get($orderObject->id);
$price += $order->getActualPrice();
}
return $price;
}
示例3: show_user_orders
/**
* Функция рисует список заказов пользователя
* @param string $template Название шаблона
* @return mixed Список заказов пользователя
*/
public function show_user_orders($template = 'default')
{
list($tpl_block, $tpl_block_empty, $tpl_item, $tpl_order_item) = def_module::loadTemplates("emarket/" . $template, 'orders_block', 'orders_block_empty', 'orders_item', 'orders_order_item');
$cmsController = cmsController::getInstance();
$domain = $cmsController->getCurrentDomain();
$domainId = $domain->getId();
$sel = new selector('objects');
$sel->types('object-type')->name('emarket', 'order');
$sel->where('customer_id')->equals(customer::get()->id);
$sel->where('name')->isNull(false);
$sel->where('domain_id')->equals($domainId);
if ($sel->length == 0) {
$tpl_block = $tpl_block_empty;
}
$items_arr = array();
foreach ($sel->result as $selOrder) {
$order = order::get($selOrder->id);
$item_arr['attribute:id'] = $order->id;
$item_arr['attribute:name'] = $order->name;
$item_arr['attribute:type-id'] = $order->typeId;
$item_arr['attribute:guid'] = $order->GUID;
$item_arr['attribute:type-guid'] = $order->typeGUID;
$item_arr['attribute:ownerId'] = $order->ownerId;
$item_arr['xlink:href'] = $order->xlink;
$item_arr['attribute:delivery_allow_date'] = date('d.m.Y', $order->getValue('delivery_allow_date')->timestamp);
//print_r($order->getValue('order_items'));
//Получаем список товаров заказа
$items = array();
foreach ($order->getItems() as $orderItem) {
// print_r($order_item); die;
$item_line = array();
// print_r(umiHierarchy::getInstance()->getObjectInstances($orderItem->id));
$item_line['attribute:element_id'] = $orderItem->id;
$item_line['attribute:name'] = $orderItem->name;
$item_line['attribute:item_amount'] = $orderItem->getAmount();
// $item_line['attribute:options'] = $orderItem->getOptions();
// print_r($order_item->options);
$items[] = def_module::parseTemplate($tpl_order_item, $item_line, false, $iOrderItemId);
umiObjectsCollection::getInstance()->unloadObject($iOrderItemId);
}
$item_arr['subnodes:order_items'] = $items;
$items_arr[] = def_module::parseTemplate($tpl_item, $item_arr, false, $order->id);
}
return def_module::parseTemplate($tpl_block, array('subnodes:items' => $items_arr));
}
示例4: returnBonus
protected function returnBonus($orderId) {
$order = order::get($orderId);
$customerId = $order->getCustomerId();
$customer = umiObjectsCollection::getInstance()->getObject($customerId);
$order->setBonusDiscount(0);
$order->refresh();
}
示例5: getLastOrder
/**
* Получить id последнего заказа пользователя
*
* @param int $domainId id домена заказа
* @return int $orderId | false
*/
public function getLastOrder($domainId) {
if ($orderId = getSession('admin-editing-order')) return $orderId;
if ($lastOrders = $this->last_order) {
foreach($lastOrders as $lastOrder) {
if (isset($lastOrder['float']) && $lastOrder['float'] == $domainId) {
$orderId = $lastOrder['rel'];
$order = order::get($orderId);
if (!$order) return false;
$status = order::getCodeByStatus($order->status_id);
if (!$status || $status == 'executing' || ($status == 'payment' && order::getCodeByStatus($order->payment_status_id) == 'initialized') ) return $orderId;
}
}
}
return false;
}
示例6: getBasketOrder
/**
* Получить заказ, который представляет текущую корзину товаров. Если такого заказа нет, то он будет создан
* @return order заказ, который представляет корзину товаров
*/
public function getBasketOrder($useDummyOrder = true)
{
static $cache;
if ($cache instanceof order) {
//If order has order-status, that means it is not a basket any more, so we have to reset $cache
if ($cache->getOrderStatus() && $cache->getOrderStatus() != order::getStatusByCode('editing') || $useDummyOrder == false) {
$cache = null;
} else {
return $cache;
}
}
$customer = customer::get();
$cmsController = cmsController::getInstance();
$domain = $cmsController->getCurrentDomain();
$domainId = $domain->getId();
$orderId = $customer->getLastOrder($domainId);
if ($orderId) {
return $cache = order::get($orderId);
}
return $cache = order::create($useDummyOrder);
}
示例7: onOrderDelete
public function onOrderDelete(iUmiEventPoint $e)
{
if ($e->getMode() != 'before') {
return;
}
$object = $e->getRef('object');
if ($object instanceof iUmiObject) {
$type = selector::get('object-type')->id($object->getTypeId());
if ($type && $type->getMethod() == 'order') {
$order = order::get($object->id);
$order->unreserve();
$order->commit();
}
}
}
示例8: json_decode
<?php
include 'standalone.php';
if (isset($_POST['signature']) && isset($_POST['data'])) {
// Указать сюда id способа оплаты модуля ИМ,
// чтобы вытянуть $public_key и $private_key
$pay = umiObjectsCollection::getInstance()->getObject(1272);
$public_key = $pay->getValue('public_key');
$private_key = $pay->getValue('private_key');
$liq_pay_data = json_decode(base64_decode($_POST['data']), TRUE);
$sign = base64_encode(sha1($private_key . $_POST['data'] . $private_key, 1));
if ($liq_pay_data['status'] == 'sandbox' or $liq_pay_data['status'] == 'success') {
// Обязательно, иначе класс order не подключится!!!
cmsController::getInstance()->getModule("emarket");
$order = order::get($liq_pay_data['order_id']);
$order->setOrderStatus('ready');
$order->setPaymentStatus('accepted');
}
}
示例9: receipt
public function receipt() {
$orderId = (int) getRequest('param0');
if(!$orderId) $orderId = (int) getRequest('order-id');
$sign = (string) getRequest('param1');
if(!$sign) $sign = (string) getRequest('signature');
$order = order::get($orderId);
if($order instanceof order) {
$customer = customer::get($order->getCustomerId());
if($customer->isUser()) {
$users = cmsController::getInstance()->getModule('users');
$userId = $users->user_id;
if($userId != $customer->id) {
throw new publicException("Access denied");
}
$permissions = permissionsCollection::getInstance();
$object = umiObjectsCollection::getInstance()->getObject($orderId);
if ($object->getOwnerId() != $userId && !$permissions->isSv($userId)) {
throw new publicException("Access denied");
}
} else {
if (strcasecmp($sign, sha1("{$customer->id}:{$customer->email}:{$order->order_date}")) !== 0) {
throw new publicException("Access denied");
}
}
$uri = "uobject://{$orderId}/?transform=sys-tpls/emarket-receipt.xsl";
$result = file_get_contents($uri);
$buffer = outputBuffer::current();
$buffer->charset('utf-8');
$buffer->contentType('text/html');
$buffer->clear();
$buffer->push($result);
$buffer->end();
} else {
throw new publicException("Order #{$orderId} doesn't exists");
}
}
示例10: importPropValue
protected function importPropValue(umiEntinty $vf5e638cc78dd325906c1298a0c21fb6b, DOMElement $vcaf9b6b99962bf5c2264824231d7a40c, $vd08e820fd4eb48eede47aa5985d10cc8 = false)
{
$v3a229433643cf8ea25f2a9b198ea70d8 = $vcaf9b6b99962bf5c2264824231d7a40c->getAttribute('name');
$vb068931cc450442b63f5b3d276ea4297 = self::translateName($v3a229433643cf8ea25f2a9b198ea70d8);
$v1a13105b7e4eb5fb2e7c9515ac06aa48 = $this->parser->evaluate("value", $vcaf9b6b99962bf5c2264824231d7a40c);
if (!$v1a13105b7e4eb5fb2e7c9515ac06aa48->length && $vd08e820fd4eb48eede47aa5985d10cc8) {
$v1a13105b7e4eb5fb2e7c9515ac06aa48 = $this->parser->evaluate("default-value", $vcaf9b6b99962bf5c2264824231d7a40c);
}
if (!$v1a13105b7e4eb5fb2e7c9515ac06aa48->length) {
if ($vd08e820fd4eb48eede47aa5985d10cc8) {
$this->reportError($this->getLabel('label-property') . " \"{$vb068931cc450442b63f5b3d276ea4297}\" " . $this->getLabel('label-has-no-values'));
}
return false;
}
$v67236e502346412a98a0bb965b7a59e6 = $v1a13105b7e4eb5fb2e7c9515ac06aa48->item(0);
$v94757cae63fd3e398c0811a976dd6bbe = $vf5e638cc78dd325906c1298a0c21fb6b instanceof umiHierarchyElement ? $vf5e638cc78dd325906c1298a0c21fb6b->getObjectTypeId() : $vf5e638cc78dd325906c1298a0c21fb6b->getTypeId();
$v599dcce2998a6b40b1e38e8c6006cb0a = umiObjectTypesCollection::getInstance()->getType($v94757cae63fd3e398c0811a976dd6bbe);
$v3aabf39f2d943fa886d86dcbbee4d910 = $v599dcce2998a6b40b1e38e8c6006cb0a->getFieldId($vb068931cc450442b63f5b3d276ea4297, false);
$v06e3d36fa30cea095545139854ad1fb9 = umiFieldsCollection::getInstance()->getField($v3aabf39f2d943fa886d86dcbbee4d910);
if (!$v06e3d36fa30cea095545139854ad1fb9 instanceof umiField && $vcaf9b6b99962bf5c2264824231d7a40c->getAttribute('allow-runtime-add') == '1') {
$v562feb4548b66febf02774b4f339552e = $vcaf9b6b99962bf5c2264824231d7a40c->parentNode;
$vdb0f6f37ebeb6ea09489124345af2a45 = $this->importTypeGroup($v599dcce2998a6b40b1e38e8c6006cb0a, $v562feb4548b66febf02774b4f339552e, false);
if (!$vdb0f6f37ebeb6ea09489124345af2a45 instanceof umiFieldsGroup) {
return false;
}
$v06e3d36fa30cea095545139854ad1fb9 = $this->importField($vdb0f6f37ebeb6ea09489124345af2a45, $vcaf9b6b99962bf5c2264824231d7a40c);
$vf5e638cc78dd325906c1298a0c21fb6b instanceof umiHierarchyElement ? $vf5e638cc78dd325906c1298a0c21fb6b->getObject()->update() : $vf5e638cc78dd325906c1298a0c21fb6b->update();
}
if (!$v06e3d36fa30cea095545139854ad1fb9 instanceof umiField) {
return false;
}
switch ($v06e3d36fa30cea095545139854ad1fb9->getDataType()) {
case "optioned":
case "symlink":
return false;
case "date":
$vd7e6d55ba379a13d08c25d15faf2a23b = intval($v67236e502346412a98a0bb965b7a59e6->getAttribute('unix-timestamp'));
$v8059f160e1aa1f9d3921049ce93b00e1 = new umiDate();
if ($vd7e6d55ba379a13d08c25d15faf2a23b) {
$v8059f160e1aa1f9d3921049ce93b00e1->setDateByTimeStamp($vd7e6d55ba379a13d08c25d15faf2a23b);
} else {
$v8059f160e1aa1f9d3921049ce93b00e1->setDateByString($v67236e502346412a98a0bb965b7a59e6->nodeValue);
}
$vf5e638cc78dd325906c1298a0c21fb6b->setValue($vb068931cc450442b63f5b3d276ea4297, $v8059f160e1aa1f9d3921049ce93b00e1);
break;
case "price":
$vfcaea7edd270964cc145ea48e4367d43 = cmsController::getInstance()->getModule('emarket');
$v78a5eb43deef9a7b5b9ce157b9d52ac4 = $v67236e502346412a98a0bb965b7a59e6->nodeValue;
$v78a5eb43deef9a7b5b9ce157b9d52ac4 = str_replace(',', '.', $v78a5eb43deef9a7b5b9ce157b9d52ac4);
$v78a5eb43deef9a7b5b9ce157b9d52ac4 = floatval(preg_replace("/[^0-9.,]/", "", $v78a5eb43deef9a7b5b9ce157b9d52ac4));
$v52e3817fff5250b5391ef85b1ce23bdb = $v67236e502346412a98a0bb965b7a59e6->hasAttribute('currency-code') ? $v67236e502346412a98a0bb965b7a59e6->getAttribute('currency-code') : $v67236e502346412a98a0bb965b7a59e6->getAttribute('currency_code');
if (strlen($v52e3817fff5250b5391ef85b1ce23bdb) && $vfcaea7edd270964cc145ea48e4367d43) {
$v1af0389838508d7016a9841eb6273962 = $vfcaea7edd270964cc145ea48e4367d43->getCurrency($v52e3817fff5250b5391ef85b1ce23bdb);
if ($v1af0389838508d7016a9841eb6273962) {
$result = $vfcaea7edd270964cc145ea48e4367d43->formatCurrencyPrice(array($v78a5eb43deef9a7b5b9ce157b9d52ac4), $vfcaea7edd270964cc145ea48e4367d43->getDefaultCurrency(), $v1af0389838508d7016a9841eb6273962);
$v78a5eb43deef9a7b5b9ce157b9d52ac4 = $result[0];
}
}
$vf5e638cc78dd325906c1298a0c21fb6b->setValue($vb068931cc450442b63f5b3d276ea4297, $v78a5eb43deef9a7b5b9ce157b9d52ac4);
break;
case "file":
case "img_file":
case "video_file":
case "swf_file":
if ($this->renameFiles) {
$v9d22547e12eafcfadf56ff88b9d67f4d = false;
$vf83cd85f6404a7018af0fcf071f35751 = $vf5e638cc78dd325906c1298a0c21fb6b->getValue($vb068931cc450442b63f5b3d276ea4297);
if ($vf83cd85f6404a7018af0fcf071f35751 instanceof umiFile) {
$v9d22547e12eafcfadf56ff88b9d67f4d = $vf83cd85f6404a7018af0fcf071f35751->getFilePath();
}
$vbf0e61d0f411b035bf846149824fe352 = ltrim(trim($v67236e502346412a98a0bb965b7a59e6->nodeValue, "\r\n"), ".");
$v435ed7e9f07f740abf511a62c00eef6e = basename($vbf0e61d0f411b035bf846149824fe352);
$v736007832d2167baaae763fd3a3f3cf1 = dirname($vbf0e61d0f411b035bf846149824fe352);
$vabf77184f55403d75b9d51d79162a7ca = explode(".", $v435ed7e9f07f740abf511a62c00eef6e);
$vabf77184f55403d75b9d51d79162a7ca = end($vabf77184f55403d75b9d51d79162a7ca);
$vd70819bac4952f91adc9954c5b055aca = translit::convert(trim($vf5e638cc78dd325906c1298a0c21fb6b->getName(), "\r\n"));
$v435ed7e9f07f740abf511a62c00eef6e = $vd70819bac4952f91adc9954c5b055aca;
$ve2942a04780e223b215eb8b663cf5353 = 0;
$v149603e6c03516362a8da23f624db945 = error_reporting(0);
while (true) {
if (!file_exists(CURRENT_WORKING_DIR . '/' . $vbf0e61d0f411b035bf846149824fe352)) {
break 2;
} else {
if ($v9d22547e12eafcfadf56ff88b9d67f4d) {
$v46cd4eff50a3aca89f0fbc7ea6a79453 = CURRENT_WORKING_DIR . ltrim($v9d22547e12eafcfadf56ff88b9d67f4d, ".");
if (file_exists($v46cd4eff50a3aca89f0fbc7ea6a79453)) {
unlink($v46cd4eff50a3aca89f0fbc7ea6a79453);
}
}
}
if (!file_exists(CURRENT_WORKING_DIR . '/' . $v736007832d2167baaae763fd3a3f3cf1 . '/' . $v435ed7e9f07f740abf511a62c00eef6e . '.' . $vabf77184f55403d75b9d51d79162a7ca)) {
break;
}
$ve2942a04780e223b215eb8b663cf5353++;
$v435ed7e9f07f740abf511a62c00eef6e = $vd70819bac4952f91adc9954c5b055aca . '_' . $ve2942a04780e223b215eb8b663cf5353;
}
$v435ed7e9f07f740abf511a62c00eef6e .= '.' . $vabf77184f55403d75b9d51d79162a7ca;
rename(CURRENT_WORKING_DIR . '/' . $vbf0e61d0f411b035bf846149824fe352, CURRENT_WORKING_DIR . '/' . $v736007832d2167baaae763fd3a3f3cf1 . '/' . $v435ed7e9f07f740abf511a62c00eef6e);
error_reporting($v149603e6c03516362a8da23f624db945);
$vbf0e61d0f411b035bf846149824fe352 = '.' . $v736007832d2167baaae763fd3a3f3cf1 . '/' . $v435ed7e9f07f740abf511a62c00eef6e;
//.........这里部分代码省略.........