本文整理汇总了PHP中eZOrder::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP eZOrder::fetch方法的具体用法?PHP eZOrder::fetch怎么用?PHP eZOrder::fetch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZOrder
的用法示例。
在下文中一共展示了eZOrder::fetch方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
function execute($process, $event)
{
$parameters = $process->attribute('parameter_list');
$http = eZHTTPTool::instance();
eZDebug::writeNotice($parameters, "parameters");
$orderID = $parameters['order_id'];
$order = eZOrder::fetch($orderID);
if (empty($orderID) || get_class($order) != 'ezorder') {
eZDebug::writeWarning("Can't proceed without a Order ID.", "SimpleStockCheck");
return eZWorkflowEventType::STATUS_FETCH_TEMPLATE_REPEAT;
}
// Decrement the quantitity field
$order = eZOrder::fetch($orderID);
$productCollection = $order->productCollection();
$ordereditems = $productCollection->itemList();
foreach ($ordereditems as $item) {
$contentObject = $item->contentObject();
$contentObjectVersion = $contentObject->version($contentObject->attribute('current_version'));
$contentObjectAttributes = $contentObjectVersion->contentObjectAttributes();
foreach (array_keys($contentObjectAttributes) as $key) {
$contentObjectAttribute = $contentObjectAttributes[$key];
$contentClassAttribute = $contentObjectAttribute->contentClassAttribute();
// Each attribute has an attribute identifier called 'quantity' that identifies it.
if ($contentClassAttribute->attribute("identifier") == "quantity") {
$contentObjectAttribute->setAttribute("data_int", $contentObjectAttribute->attribute("value") - $item->ItemCount);
$contentObjectAttribute->store();
}
}
}
return eZWorkflowEventType::STATUS_ACCEPTED;
}
示例2: execute
function execute($process, $event)
{
$ini = eZINI::instance('workflow.ini');
$cost = $ini->variable("SimpleShippingWorkflow", "ShippingCost");
$description = $ini->variable("SimpleShippingWorkflow", "ShippingDescription");
$parameters = $process->attribute('parameter_list');
if (isset($parameters['order_id'])) {
$orderID = $parameters['order_id'];
$order = eZOrder::fetch($orderID);
$orderItems = $order->attribute('order_items');
$addShipping = true;
foreach ($orderItems as $orderItem) {
if ($orderItem->attribute('type') == 'ezsimpleshipping') {
$addShipping = false;
break;
}
}
if ($addShipping) {
$productCollection = $order->attribute('productcollection');
$orderCurrency = $productCollection->attribute('currency_code');
$cost = eZShopFunctions::convertAdditionalPrice($orderCurrency, $cost);
$orderItem = new eZOrderItem(array('order_id' => $orderID, 'description' => $description, 'price' => $cost, 'type' => 'ezsimpleshipping'));
$orderItem->store();
}
}
return eZWorkflowType::STATUS_ACCEPTED;
}
示例3: custom_error_handling
public static function custom_error_handling()
{
$http = eZHTTPTool::instance();
$order_id = $http->postVariable('order_id');
$order = eZOrder::fetch($order_id);
$response = $http->postVariable('response');
//write error to log file
self::write_invalid_checkcreditcard_log($order_id, $response);
//generate the string and return it back to the template full translated
return xrowPayoneHelper::generateCustomErrorString($order, $response);
}
示例4: createRedirectionUrl
function createRedirectionUrl($process)
{
//__DEBUG__
$this->logger->writeTimedString("createRedirectionUrl");
//___end____
$paypalINI = eZINI::instance('paypal.ini');
$paypalServer = $paypalINI->variable('ServerSettings', 'ServerName');
$requestURI = $paypalINI->variable('ServerSettings', 'RequestURI');
$business = urlencode($paypalINI->variable('PaypalSettings', 'Business'));
$processParams = $process->attribute('parameter_list');
$orderID = $processParams['order_id'];
$indexDir = eZSys::indexDir();
$localHost = eZSys::serverURL();
$localURI = eZSys::serverVariable('REQUEST_URI');
$order = eZOrder::fetch($orderID);
$amount = urlencode($order->attribute('total_inc_vat'));
$currency = urlencode($order->currencyCode());
// include_once( 'lib/ezlocale/classes/ezlocale.php' );
$locale = eZLocale::instance();
$countryCode = urlencode($locale->countryCode());
$maxDescLen = $paypalINI->variable('PaypalSettings', 'MaxDescriptionLength');
$itemName = urlencode($this->createShortDescription($order, $maxDescLen));
$accountInfo = $order->attribute('account_information');
$first_name = urlencode($accountInfo['first_name']);
$last_name = urlencode($accountInfo['last_name']);
$street = urlencode($accountInfo['street2']);
$zip = urlencode($accountInfo['zip']);
$state = urlencode($accountInfo['state']);
$place = urlencode($accountInfo['place']);
$image_url = "{$localHost}" . urlencode($paypalINI->variable('PaypalSettings', 'LogoURI'));
$background = urlencode($paypalINI->variable('PaypalSettings', 'BackgroundColor'));
$pageStyle = urlencode($paypalINI->variable('PaypalSettings', 'PageStyle'));
$noNote = urlencode($paypalINI->variable('PaypalSettings', 'NoNote'));
$noteLabel = $noNote == 1 ? '' : urlencode($paypalINI->variable('PaypalSettings', 'NoteLabel'));
$noShipping = 1;
$url = $paypalServer . $requestURI . "?cmd=_ext-enter" . "&redirect_cmd=_xclick" . "&business={$business}" . "&item_name={$itemName}" . "&custom={$orderID}" . "&amount={$amount}" . "¤cy_code={$currency}" . "&first_name={$first_name}" . "&last_name={$last_name}" . "&address1={$street}" . "&zip={$zip}" . "&state={$state}" . "&city={$place}" . "&image_url={$image_url}" . "&cs={$background}" . "&page_style={$pageStyle}" . "&no_shipping={$noShipping}" . "&cn={$noteLabel}" . "&no_note={$noNote}" . "&lc={$countryCode}" . "¬ify_url={$localHost}" . $indexDir . "/paypal/notify_url/" . "&return={$localHost}" . $indexDir . "/shop/checkout/" . "&cancel_return={$localHost}" . $indexDir . "/shop/basket/";
//__DEBUG__
$this->logger->writeTimedString("business = {$business}");
$this->logger->writeTimedString("item_name = {$itemName}");
$this->logger->writeTimedString("custom = {$orderID}");
$this->logger->writeTimedString("no_shipping = {$noShipping}");
$this->logger->writeTimedString("localHost = {$localHost}");
$this->logger->writeTimedString("amount = {$amount}");
$this->logger->writeTimedString("currency_code = {$currency}");
$this->logger->writeTimedString("notify_url = {$localHost}" . $indexDir . "/paypal/notify_url/");
$this->logger->writeTimedString("return = {$localHost}" . $indexDir . "/shop/checkout/");
$this->logger->writeTimedString("cancel_return = {$localHost}" . $indexDir . "/shop/basket/");
//___end____
return $url;
}
示例5: setupOrderAndPaymentObject
function setupOrderAndPaymentObject($orderID)
{
if (isset($orderID) && $orderID > 0) {
$this->paymentObject = eZPaymentObject::fetchByOrderID($orderID);
if (isset($this->paymentObject)) {
$this->order = eZOrder::fetch($orderID);
if (isset($this->order)) {
return true;
}
$this->logger->writeTimedString("Unable to fetch order object with orderID={$orderID}", 'setupOrderAndPaymentObject failed');
return false;
}
$this->logger->writeTimedString("Unable to fetch payment object with orderID={$orderID}", 'setupOrderAndPaymentObject failed');
return false;
}
$this->logger->writeTimedString("Invalid orderID={$orderID}", 'setupOrderAndPaymentObject failed');
return false;
}
示例6: array
return;
}
if ($http->hasPostVariable("CancelButton")) {
$order->purge(false);
$module->redirectTo('/shop/basket/');
return;
}
$tpl->setVariable("order", $order);
}
$basket = eZBasket::currentBasket();
$basket->updatePrices();
$operationResult = eZOperationHandler::execute('shop', 'confirmorder', array('order_id' => $order->attribute('id')));
switch ($operationResult['status']) {
case eZModuleOperationInfo::STATUS_CONTINUE:
if ($operationResult != null && !isset($operationResult['result']) && (!isset($operationResult['redirect_url']) || $operationResult['redirect_url'] == null)) {
$order = eZOrder::fetch($order->attribute('id'));
$tpl->setVariable("order", $order);
$Result = array();
$Result['content'] = $tpl->fetch("design:shop/confirmorder.tpl");
$Result['path'] = array(array('url' => false, 'text' => ezpI18n::tr('kernel/shop', 'Confirm order')));
}
break;
case eZModuleOperationInfo::STATUS_HALTED:
case eZModuleOperationInfo::STATUS_REPEAT:
if (isset($operationResult['redirect_url'])) {
$module->redirectTo($operationResult['redirect_url']);
return;
} else {
if (isset($operationResult['result'])) {
$result = $operationResult['result'];
$resultContent = false;
示例7:
<?php
/**
* @copyright Copyright (C) 1999-2012 eZ Systems AS. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
* @version 2012.8
* @package kernel
*/
$module = $Params['Module'];
$http = eZHTTPTool::instance();
$user = eZUser::currentUser();
$order = eZOrder::fetch($OrderID);
if (!$order) {
return $module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
if ($http->hasPostVariable("OrderID") && $http->hasPostVariable("StatusID") && $http->hasPostVariable("SetOrderStatusButton")) {
$access = $order->canModifyStatus($StatusID);
if ($access) {
if ($order->attribute('status_id') != $StatusID) {
$order->modifyStatus($StatusID);
}
if ($http->hasPostVariable('RedirectURI')) {
$uri = $http->postVariable('RedirectURI');
$module->redirectTo($uri);
return;
} else {
$module->redirectTo('/shop/orderview/' . $orderID);
return;
}
} else {
return $module->handleError(eZError::KERNEL_ACCESS_DENIED, 'kernel');
示例8: fetchOrder
function fetchOrder( $orderID )
{
$order = eZOrder::fetch( $orderID );
return array( 'result' => $order );
}
示例9: updateStatus
function updateStatus()
{
//refetch the $this->order - it's an old object, just the order ID is good
//Changing the status with an old version for $this->order will write old
//values to the order
$this->logger->writeTimedString('ReFetch Order ID: ' . $this->order->ID);
$order = eZOrder::fetch($this->order->ID);
$this->order = $order;
$this->order->modifyStatus(1000);
}
示例10: customerList
static function customerList($offset, $limit)
{
$db = eZDB::instance();
$db_params = array();
$db_params["offset"] = (int) $offset;
$db_params["limit"] = (int) $limit;
$customEmailResult = $db->arrayQuery("SELECT DISTINCT email FROM ezorder WHERE is_temporary='0' ORDER BY email", $db_params);
$customEmailArray = array();
foreach ($customEmailResult as $customEmailRow) {
$customEmail = $customEmailRow['email'];
$customEmailArray[] = "'" . $customEmail . "'";
}
$emailString = implode(", ", $customEmailArray);
if (!strlen($emailString)) {
$emailString = "''";
}
$productItemArray = $db->arrayQuery("SELECT ezorder.id as order_id, user_id, email, ignore_vat, currency_code, ezproductcollection_item.*\n FROM ezorder, ezproductcollection_item, ezproductcollection\n WHERE ezproductcollection_item.productcollection_id=ezorder.productcollection_id\n AND is_temporary='0'\n AND ezproductcollection_item.productcollection_id=ezproductcollection.id\n AND email in ( {$emailString} )\n ORDER BY user_id, email, order_id");
$siteIni = eZINI::instance();
$anonymousUserID = $siteIni->variable('UserSettings', 'AnonymousUserID');
$currentUserID = 0;
$currentOrderID = 0;
$currentUserEmail = "";
$customArray = array();
$accountName = null;
$itemCount = 0;
$hash = 0;
$currencyCode = '';
$ordersInfo = array();
foreach ($productItemArray as $productItem) {
$itemCount++;
$currencyCode = $productItem['currency_code'];
if ($currencyCode == '') {
$currencyCode = eZOrder::fetchLocaleCurrencyCode();
}
$userID = $productItem['user_id'];
$orderID = $productItem['order_id'];
$order = eZOrder::fetch($orderID);
if ($currentUserID != $userID && $itemCount != 1) {
$customArray[] = array('account_name' => $accountName, 'orders_info' => $ordersInfo, 'user_id' => $currentUserID, 'email' => urlencode($currentUserEmail));
$ordersInfo = array();
$accountName = $order->attribute('account_name');
$accountEmail = $order->attribute('account_email');
}
$currentUserID = $userID;
// If the custom is anoymous user
if ($currentUserID == $anonymousUserID) {
$accountEmail = $order->attribute('email');
if ($currentUserEmail == "") {
$accountName = $order->attribute('account_name');
$currentUserEmail = $accountEmail;
}
if ($currentUserEmail != $accountEmail) {
$customArray[] = array('account_name' => $accountName, 'orders_info' => $ordersInfo, 'user_id' => $currentUserID, 'email' => urlencode($currentUserEmail));
$ordersInfo = array();
$accountName = $order->attribute('account_name');
$accountEmail = $order->attribute('account_email');
$currentUserEmail = $accountEmail;
}
$currentUserEmail = $accountEmail;
} else {
$currentUserEmail = 0;
}
$accountName = $order->attribute('account_name');
if (!isset($ordersInfo[$currencyCode])) {
$ordersInfo[$currencyCode] = array('order_count' => 0, 'sum_ex_vat' => 0, 'sum_inc_vat' => 0);
}
if ($currentOrderID != $orderID) {
$ordersInfo[$currencyCode]['order_count']++;
}
$currentOrderID = $orderID;
if ($productItem['ignore_vat'] == true) {
$vatValue = 0;
} else {
$vatValue = $productItem['vat_value'];
}
$price = $productItem['price'];
if ($productItem['is_vat_inc']) {
$priceExVAT = $price / (100 + $vatValue) * 100;
$priceIncVAT = $price;
} else {
$priceExVAT = $price;
$priceIncVAT = $price * (100 + $vatValue) / 100;
}
$count = $productItem['item_count'];
$realPricePercent = (100 - $productItem['discount']) / 100;
$ordersInfo[$currencyCode]['sum_ex_vat'] += round($count * $priceExVAT * $realPricePercent, 2);
$ordersInfo[$currencyCode]['sum_inc_vat'] += round($count * $priceIncVAT * $realPricePercent, 2);
}
if (count($productItemArray) != 0) {
$customArray[] = array('account_name' => $accountName, 'orders_info' => $ordersInfo, 'user_id' => $currentUserID, 'email' => urlencode($currentUserEmail));
}
return $customArray;
}
示例11: execute
function execute($process, $event)
{
$http = eZHTTPTool::instance();
$siteINI = eZINI::instance('site.ini');
$shopINI = eZINI::instance('shop.ini');
$payoneINI = eZINI::instance('xrowpayone.ini');
$processParams = $process->attribute('parameter_list');
$errors = array();
$process_id = $process->ID;
//get the current order
$order_id = $processParams['order_id'];
$order = eZOrder::fetch($order_id);
//checking if its only a redirect and so the preauthorisation is already finished
$paymentObj = xrowPaymentObject::fetchByOrderID($order_id);
if (is_object($paymentObj) && $paymentObj->approved()) {
//now disapprove again because its 3d CC payment and its only paid when capture is successful
$paymentObj->reject();
xrowPayoneCreditCardGateway::setPaymentMethod($order);
eZLog::write("SUCCESS in step 2 ('preauthorisation') ::3D Secure Card detected - FINISHED :: for order ID " . $order_id, $logName = 'xrowpayone.log', $dir = 'var/log');
return eZWorkflowType::STATUS_ACCEPTED;
}
//STEP 2: preauthorisation
if ($http->hasPostVariable('pseudocardpan')) {
//fetching settings
$pseudocardpan = $http->postVariable('pseudocardpan');
$site_url = $siteINI->variable('SiteSettings', 'SiteURL');
$aid = $payoneINI->variable('GeneralSettings', 'AID');
$mid = $payoneINI->variable('GeneralSettings', 'MID');
$portal_id = $payoneINI->variable('GeneralSettings', 'PortalID');
$mode = $payoneINI->variable('GeneralSettings', 'Mode');
$key = $payoneINI->variable('GeneralSettings', 'Key');
$algorithm = $payoneINI->variable('GeneralSettings', 'Algorithm');
$api_version = $payoneINI->variable('GeneralSettings', 'APIVersion');
$response_type = $payoneINI->variable('GeneralSettings', 'ResponseType');
$cc_3d_secure_enabled = $payoneINI->variable('CC3DSecure', 'Enabled');
$error_url = $payoneINI->variable('CC3DSecure', 'ErrorURL');
$success_url = $payoneINI->variable('CC3DSecure', 'SuccessURL');
$siteaccess = $GLOBALS['eZCurrentAccess'];
$siteaccess = $siteaccess["name"];
//prepare some parameter values
$error_url = "https://" . $site_url . "/" . $siteaccess . "/" . $error_url . "/orderID/" . $order_id;
$success_url = "https://" . $site_url . "/" . $siteaccess . "/" . $success_url . "/orderID/" . $order_id;
$order_total_in_cent = (string) $order->totalIncVAT() * 100;
$currency_code = $order->currencyCode();
$order_xml = simplexml_load_string($order->DataText1);
$country_alpha3 = (string) $order_xml->country;
$country = eZCountryType::fetchCountry($country_alpha3, "Alpha3");
$country_alpha2 = $country["Alpha2"];
$last_name = (string) $order_xml->last_name;
//create hash array
$hash_array["aid"] = $aid;
$hash_array["mid"] = $mid;
$hash_array["portalid"] = $portal_id;
$hash_array["api_version"] = $api_version;
$hash_array["mode"] = $mode;
$hash_array["request"] = "preauthorization";
$hash_array["responsetype"] = $response_type;
$hash_array["clearingtype"] = "cc";
$hash_array["reference"] = $order_id;
$hash_array["amount"] = $order_total_in_cent;
$hash_array["currency"] = $currency_code;
if ($cc_3d_secure_enabled == "true") {
$hash_array["successurl"] = $success_url;
$hash_array["errorurl"] = $error_url;
}
//please note: country, lastname and pseudocardpan are not needed to be added to the hash because they are not allwoed (p.25 client doc)
//create param array
$param_array["aid"] = $aid;
$param_array["mid"] = $mid;
$param_array["portalid"] = $portal_id;
$param_array["api_version"] = $api_version;
$param_array["mode"] = $mode;
$param_array["request"] = "preauthorization";
$param_array["responsetype"] = $response_type;
$param_array["hash"] = xrowPayoneHelper::generate_hash($algorithm, $hash_array, $key);
$param_array["clearingtype"] = "cc";
$param_array["reference"] = $order_id;
$param_array["amount"] = $order_total_in_cent;
$param_array["currency"] = $currency_code;
$param_array["lastname"] = urlencode($last_name);
$param_array["country"] = $country_alpha2;
$param_array["pseudocardpan"] = $pseudocardpan;
if ($cc_3d_secure_enabled == "true") {
$param_array["successurl"] = $success_url;
$param_array["errorurl"] = $error_url;
}
//sort params in alphabetic order
ksort($param_array);
$parameter_string = "?";
foreach ($param_array as $key => $parameter) {
$parameter_string .= $key . "=" . $parameter . "&";
}
$url = "https://secure.pay1.de/client-api" . $parameter_string;
if ($siteINI->hasVariable('ProxySettings', 'ProxyServer') && $siteINI->variable('ProxySettings', 'ProxyServer') != "") {
$proxyserver = $siteINI->variable('ProxySettings', 'ProxyServer');
//now get the proxy url
if (strpos($proxyserver, "://") !== false) {
$proxy_parts = explode("://", $proxyserver);
$proxyserver = $proxy_parts[1];
}
//.........这里部分代码省略.........
示例12: checkCurrency
function checkCurrency($orderID)
{
$returnStatus = array('status' => eZModuleOperationInfo::STATUS_CONTINUE);
$order = eZOrder::fetch($orderID);
$productCollection = $order->attribute('productcollection');
$currencyCode = $productCollection->attribute('currency_code');
$currencyCode = trim($currencyCode);
if ($currencyCode == '') {
$returnStatus = array('status' => eZModuleOperationInfo::STATUS_CANCELLED);
}
$locale = eZLocale::instance();
$localeCurrencyCode = $locale->currencyShortName();
// Reverse logic to avoid calling eZCurrencyData::currencyExists() if the first expression is true.
if (!($currencyCode == $localeCurrencyCode or eZCurrencyData::currencyExists($currencyCode))) {
$returnStatus = array('status' => eZModuleOperationInfo::STATUS_CANCELLED);
}
return $returnStatus;
}
示例13: execute
public function execute($process, $event)
{
$parameters = $process->attribute('parameter_list');
$order = eZOrder::fetch($parameters['order_id']);
$filter = self::filterOrderPayment($order);
$process->Template = array();
$process->Template['templateName'] = 'design:workflow/ezpaymentselect.tpl';
$process->Template['templateVars'] = array('order' => $order, 'filter' => $filter);
if (!$this->checkPayment()) {
return eZWorkflowType::STATUS_FETCH_TEMPLATE_REPEAT;
} else {
eZPaymentSelectType::storeOrderData($order, $_POST['payment'], serialize($_POST));
return eZWorkflowType::STATUS_ACCEPTED;
}
}
示例14: DOMDocument
<?php
$Module =& $Params['Module'];
$http = eZHTTPTool::instance();
$tpl = eZTemplate::factory();
if ($http->hasPostVariable('txid')) {
$txid = $http->PostVariable('txid');
$txaction = $http->PostVariable('txaction');
if ($txaction === "appointed") {
eZLog::write("PENDING in step 2 ('preauthorisation') ::transaction module call:: for txid " . $txid . " :::::status:::: " . $txaction, $logName = 'xrowpayone.log', $dir = 'var/log');
$db = eZDB::instance();
$relevant_order = $db->arrayQuery("SELECT * FROM ezorder where data_text_1 LIKE '%<txid>{$txid}</txid>%';");
if (count($relevant_order) == 1) {
$order = eZOrder::fetch($relevant_order[0]["id"]);
$doc = new DOMDocument('1.0', 'utf-8');
$doc->loadXML($order->DataText1);
$shop_account_element = $doc->getElementsByTagName('shop_account');
$cc3d_sec_elements = $doc->getElementsByTagName('cc3d_reserved');
//detecting if its a 3d secure CC so we need to do something if its normal CC transaction then we just do nothing
if ($cc3d_sec_elements->length >= 1) {
$db->begin();
$cc3d_sec_element = $cc3d_sec_elements->item(0);
//change value
$cc3d_sec_element->nodeValue = "true";
$order->setAttribute('data_text_1', $doc->saveXML());
$order->store();
$db->commit();
}
} else {
eZLog::write("PENDING in step 2 ('preauthorisation') ::transaction module call:: for txid " . $txid . " specific order could not be determined (this is normal if the action was caused by a normal credit card without 3d secure protection!)", $logName = 'xrowpayone.log', $dir = 'var/log');
}