本文整理汇总了PHP中eZOrder类的典型用法代码示例。如果您正苦于以下问题:PHP eZOrder类的具体用法?PHP eZOrder怎么用?PHP eZOrder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZOrder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: testIssue18233
public function testIssue18233()
{
// insert orders
$orderData = array('account_identifier' => 'ez', 'created' => 130252369, 'data_text_1' => '\\<?xml ?\\>', 'email' => 'xc@ez.no', 'productcollection_id' => '5', 'status_modifier_id' => '14', 'user_id' => 14);
$order = new eZOrder($orderData);
$order->store();
$oldOrderNR = $order->attribute('order_nr');
$order->activate();
$this->assertEquals($oldOrderNR + 1, $order->attribute('id'));
$this->assertEquals(0, $order->attribute('is_temporary'));
}
示例6: 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];
}
//.........这里部分代码省略.........
示例7: foreach
<?php
/**
* @copyright Copyright (C) 1999-2013 eZ Systems AS. All rights reserved.
* @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
* @version //autogentag//
* @package kernel
*/
$Module = $Params['Module'];
$http = eZHTTPTool::instance();
$archiveIDArray = $http->sessionVariable("OrderIDArray");
$db = eZDB::instance();
$db->begin();
foreach ($archiveIDArray as $archiveID) {
eZOrder::archiveOrder($archiveID);
}
$db->commit();
$Module->redirectTo('/shop/orderlist/');
示例8: createOrder
function createOrder()
{
// Make order
$productCollectionID = $this->attribute('productcollection_id');
$user = eZUser::currentUser();
$userID = $user->attribute('contentobject_id');
$time = time();
$order = new eZOrder(array('productcollection_id' => $productCollectionID, 'user_id' => $userID, 'is_temporary' => 1, 'created' => $time, 'status_id' => eZOrderStatus::PENDING, 'status_modified' => $time, 'status_modifier_id' => $userID));
$db = eZDB::instance();
$db->begin();
$order->store();
$orderID = $order->attribute('id');
$this->setAttribute('order_id', $orderID);
$this->store();
$db->commit();
return $order;
}
示例9:
}
if ( $clean['tipafriend'] )
{
$cli->output( "Removing all counters for tip-a-friend" );
eZTipafriendCounter::cleanup();
}
if ( $clean['shop'] )
{
$cli->output( "Removing all baskets" );
eZBasket::cleanup();
$cli->output( "Removing all wishlists" );
eZWishList::cleanup();
$cli->output( "Removing all orders" );
eZOrder::cleanup();
$productCount = eZPersistentObject::count( eZProductCollection::definition() );
if ( $productCount > 0 )
{
$cli->warning( "$productCount product collections still exists, must be a leak" );
}
}
if ( $clean['forgotpassword'] )
{
$cli->output( "Removing all forgot password requests" );
eZForgotPassword::cleanup();
}
if ( $clean['workflow'] )
{
示例10:
<?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');
示例11: templateInit
// This program is free software; you can redistribute it and/or
// modify it under the terms of version 2.0 of the GNU General
// Public License as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of version 2.0 of the GNU General
// Public License along with this program; if not, write to the Free
// Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
// MA 02110-1301, USA.
//
//
//
include_once 'autoload.php';
include_once 'kernel/common/template.php';
$offset = 0;
$limit = 10;
$sortField = 'created';
$sortOrder = 'asc';
$orderArray = eZOrder::active(true, $offset, $limit, $sortField, $sortOrder);
$http = eZHTTPTool::instance();
$user = eZUser::currentUser();
$tpl = templateInit();
$Result = array();
$tpl->setVariable('order_list', $orderArray);
$Result['content'] = $tpl->fetch('design:portal/widgets/latestorders.tpl');
$Result['path'] = array();
$Result['pagelayout'] = false;
示例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:
}
$user = eZUser::currentUser();
$firstName = '';
$lastName = '';
$email = '';
if ($user->isLoggedIn()) {
$userObject = $user->attribute('contentobject');
$userMap = $userObject->dataMap();
$firstName = $userMap['first_name']->content();
$lastName = $userMap['last_name']->content();
$email = $user->attribute('email');
}
// Initialize variables
$street1 = $street2 = $zip = $place = $state = $country = $comment = $collect = '';
// Check if user has an earlier order, copy order info from that one
$orderList = eZOrder::activeByUserID($user->attribute('contentobject_id'));
if (count($orderList) > 0 and $user->isLoggedIn()) {
$accountInfo = $orderList[0]->accountInformation();
if ($accountInfo['collect']) {
$collect = $accountInfo['collect'];
} else {
if ($accountInfo['street1']) {
$street1 = $accountInfo['street1'];
} else {
if ($accountInfo['d_address1']) {
$street1 = $accountInfo['d_address1'];
} else {
if ($accountInfo['address1']) {
$street1 = $accountInfo['address1'];
}
}
示例14: foreach
if ($http->hasPostVariable('OrderIDArray')) {
$orderIDArray = $http->postVariable('OrderIDArray');
if ($orderIDArray !== null) {
$http->setSessionVariable('OrderIDArray', $orderIDArray);
$Module->redirectTo($Module->functionURI('archiveorder') . '/');
}
}
}
if ($http->hasPostVariable('SaveOrderStatusButton')) {
if ($http->hasPostVariable('StatusList')) {
foreach ($http->postVariable('StatusList') as $orderID => $statusID) {
$order = eZOrder::fetch($orderID);
$access = $order->canModifyStatus($statusID);
if ($access and $order->attribute('status_id') != $statusID) {
$order->modifyStatus($statusID);
}
}
}
}
$orderArray = eZOrder::active(true, $offset, $limit, $sortField, $sortOrder);
$orderCount = eZOrder::activeCount();
$tpl->setVariable('order_list', $orderArray);
$tpl->setVariable('order_list_count', $orderCount);
$tpl->setVariable('limit', $limit);
$viewParameters = array('offset' => $offset);
$tpl->setVariable('view_parameters', $viewParameters);
$tpl->setVariable('sort_field', $sortField);
$tpl->setVariable('sort_order', $sortOrder);
$Result = array();
$Result['path'] = array(array('text' => ezpI18n::tr('kernel/shop', 'Order list'), 'url' => false));
$Result['content'] = $tpl->fetch('design:shop/orderlist.tpl');
示例15: 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;
}
}