本文整理汇总了PHP中eZShopFunctions类的典型用法代码示例。如果您正苦于以下问题:PHP eZShopFunctions类的具体用法?PHP eZShopFunctions怎么用?PHP eZShopFunctions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了eZShopFunctions类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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;
}
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:27,代码来源:ezsimpleshippingtype.php
示例2: customSortingSQL
function customSortingSQL($params)
{
$multipriceTableAlias = "mp";
if (isset($params['table_alias_suffix'])) {
$multipriceTableAlias .= $params['table_alias_suffix'];
}
$sql = array('from' => '', 'where' => '', 'sorting_field' => '');
$sql['from'] = "ezmultipricedata {$multipriceTableAlias}";
$and = '';
if (isset($params['contentobject_attr_id'])) {
$sql['where'] = "\n {$multipriceTableAlias}.contentobject_attr_id = {$params['contentobject_attr_id']}";
$and = ' AND';
}
if (isset($params['contentobject_attr_version'])) {
$sql['where'] .= "\n {$and} {$multipriceTableAlias}.contentobject_attr_version = {$params['contentobject_attr_version']}";
$and = ' AND';
}
if (!isset($params['currency_code'])) {
$params['currency_code'] = eZShopFunctions::preferredCurrencyCode();
}
if ($params['currency_code'] !== false) {
$sql['where'] .= "\n {$and} {$multipriceTableAlias}.currency_code = '{$params['currency_code']}'";
$and = ' AND';
}
$sql['sorting_field'] = "{$multipriceTableAlias}.value";
return $sql;
}
开发者ID:legende91,项目名称:ez,代码行数:27,代码来源:ezmultipricetype.php
示例3: canAddProduct
function canAddProduct($contentObject)
{
$error = eZError::SHOP_OK;
$productType = eZShopFunctions::productTypeByObject($contentObject);
if ($productType === false) {
$error = eZError::SHOP_NOT_A_PRODUCT;
} else {
if (!eZShopFunctions::isSimplePriceProductType($productType)) {
$error = eZShopFunctions::isPreferredCurrencyValid();
}
if ($error === eZError::SHOP_OK) {
$basketType = $this->type();
if ($basketType !== false && $basketType !== $productType) {
$error = eZError::SHOP_BASKET_INCOMPATIBLE_PRODUCT_TYPE;
}
}
}
return $error;
}
开发者ID:rmiguel,项目名称:ezpublish,代码行数:19,代码来源:ezbasket.php
示例4: array
}
$discountRule->store();
$db->commit();
// we changed prices => remove content cache
eZContentCacheManager::clearAllContentCache();
return $module->redirectTo( $module->functionURI( 'discountgroupview' ) . '/' . $discountGroupID );
}
$classList = eZContentClass::fetchList();
$productClassList = array();
foreach ( $classList as $class )
{
if ( eZShopFunctions::isProductClass( $class ) )
$productClassList[] = $class;
}
$sectionList = eZSection::fetchList();
$tpl = eZTemplate::factory();
$tpl->setVariable( 'module', $module );
$tpl->setVariable( 'discountgroup_id', $discountGroupID );
$tpl->setVariable( 'discountrule', $discountRule );
$tpl->setVariable( 'product_class_list', $productClassList );
$tpl->setVariable( 'section_list', $sectionList );
$tpl->setVariable( 'class_limitation_list', $discountRuleSelectedClasses );
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:31,代码来源:discountruleedit.php
示例5: isPreferredCurrencyValid
static function isPreferredCurrencyValid($currencyCode = false)
{
$error = eZError::SHOP_OK;
if ($currencyCode === false) {
$currencyCode = eZShopFunctions::preferredCurrencyCode();
}
$currency = eZCurrencyData::fetch($currencyCode);
if ($currency) {
if (!$currency->isActive()) {
$error = eZError::SHOP_PREFERRED_CURRENCY_INACTIVE;
eZDebug::writeWarning("Currency '{$currencyCode}' is inactive.", __METHOD__);
}
} else {
$error = eZError::SHOP_PREFERRED_CURRENCY_DOESNOT_EXIST;
eZDebug::writeWarning("Currency '{$currencyCode}' doesn't exist", __METHOD__);
}
return $error;
}
开发者ID:nfrp,项目名称:ezpublish,代码行数:18,代码来源:ezshopfunctions.php
示例6: fetchUserCountry
function fetchUserCountry()
{
// Get country saved in user preferences.
$country = eZShopFunctions::getPreferredUserCountry();
if ( !$country )
{
// If not found, get country from user object
// and save it to the preference.
$country = eZShopFunctions::getUserCountry();
if ( $country )
eZShopFunctions::setPreferredUserCountry( $country );
}
return array( 'result' => $country );
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:15,代码来源:ezshopfunctioncollection.php
示例7:
<?php
/**
* @copyright Copyright (C) 1999-2012 eZ Systems AS. All rights reserved.
* @license http://ez.no/Resources/Software/Licenses/eZ-Business-Use-License-Agreement-eZ-BUL-Version-2.1 eZ Business Use License Agreement eZ BUL Version 2.1
* @version 4.7.0
* @package kernel
*/
$module = $Params['Module'];
$preferredCurrency = $Params['Currency'];
if ( $module->isCurrentAction( 'Set' ) )
{
if ( $module->hasActionParameter( 'Currency' ) )
$preferredCurrency = $module->actionParameter( 'Currency' );
}
if ( $preferredCurrency )
eZShopFunctions::setPreferredCurrencyCode( $preferredCurrency );
eZRedirectManager::redirectTo( $module, false );
?>
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:24,代码来源:setpreferredcurrency.php
示例8: array
if ($updateData['rate_factor'] == '') {
$currency->setAttribute('rate_factor', 0);
}
}
$currency->sync();
}
}
$db->commit();
$error = array('code' => 0, 'description' => ezpI18n::tr('kernel/shop', 'Changes were stored successfully.'));
} else {
if ($module->isCurrentAction('UpdateAutoprices')) {
$error = eZShopFunctions::updateAutoprices();
eZContentCacheManager::clearAllContentCache();
} else {
if ($module->isCurrentAction('UpdateAutoRates')) {
$error = eZShopFunctions::updateAutoRates();
}
}
}
}
}
if ($error !== false) {
if ($error['code'] != 0) {
$error['style'] = 'message-error';
} else {
$error['style'] = 'message-feedback';
}
}
switch (eZPreferences::value('currencies_list_limit')) {
case '2':
$limit = 25;
开发者ID:netbliss,项目名称:ezpublish,代码行数:31,代码来源:currencylist.php
示例9: preferredCurrencyCode
function preferredCurrencyCode()
{
return eZShopFunctions::preferredCurrencyCode();
}
开发者ID:legende91,项目名称:ez,代码行数:4,代码来源:ezmultiprice.php
示例10: addToBasket
function addToBasket($objectID, $optionList, $quantity)
{
$object = eZContentObject::fetch($objectID);
$nodeID = $object->attribute('main_node_id');
$price = 0.0;
$isVATIncluded = true;
$attributes = $object->contentObjectAttributes();
$priceFound = false;
foreach ($attributes as $attribute) {
$dataType = $attribute->dataType();
if (eZShopFunctions::isProductDatatype($dataType->isA())) {
$priceObj = $attribute->content();
$price += $priceObj->attribute('price');
$priceFound = true;
}
}
if (!$priceFound) {
eZDebug::writeError('Attempted to add object without price to basket.');
return array('status' => eZModuleOperationInfo::STATUS_CANCELLED);
}
$currency = $priceObj->attribute('currency');
// Check for 'option sets' in option list.
// If found each 'option set' will be added as a separate product purchase.
$hasOptionSet = false;
foreach (array_keys($optionList) as $optionKey) {
if (substr($optionKey, 0, 4) == 'set_') {
$returnStatus = eZShopOperationCollection::addToBasket($objectID, $optionList[$optionKey]);
// If adding one 'option set' fails we should stop immediately
if ($returnStatus['status'] == eZModuleOperationInfo::STATUS_CANCELLED) {
return $returnStatus;
}
$hasOptionSet = true;
}
}
if ($hasOptionSet) {
return $returnStatus;
}
$unvalidatedAttributes = array();
foreach ($attributes as $attribute) {
$dataType = $attribute->dataType();
if ($dataType->isAddToBasketValidationRequired()) {
$errors = array();
if ($attribute->validateAddToBasket($optionList[$attribute->attribute('id')], $errors) !== eZInputValidator::STATE_ACCEPTED) {
$description = $errors;
$contentClassAttribute = $attribute->contentClassAttribute();
$attributeName = $contentClassAttribute->attribute('name');
$unvalidatedAttributes[] = array("name" => $attributeName, "description" => $description);
}
}
}
if (count($unvalidatedAttributes) > 0) {
return array('status' => eZModuleOperationInfo::STATUS_CANCELLED, 'reason' => 'validation', 'error_data' => $unvalidatedAttributes);
}
$basket = eZBasket::currentBasket();
/* Check if the item with the same options is not already in the basket: */
$itemID = false;
$collection = $basket->attribute('productcollection');
if (!$collection) {
eZDebug::writeError('Unable to find product collection.');
return array('status' => eZModuleOperationInfo::STATUS_CANCELLED);
} else {
$collection->setAttribute('currency_code', $currency);
$collection->store();
$count = 0;
/* Calculate number of options passed via the HTTP variable: */
foreach (array_keys($optionList) as $key) {
if (is_array($optionList[$key])) {
$count += count($optionList[$key]);
} else {
$count++;
}
}
$collectionItems = $collection->itemList(false);
foreach ($collectionItems as $item) {
/* For all items in the basket which have the same object_id: */
if ($item['contentobject_id'] == $objectID) {
$options = eZProductCollectionItemOption::fetchList($item['id'], false);
/* If the number of option for this item is not the same as in the HTTP variable: */
if (count($options) != $count) {
break;
}
$theSame = true;
foreach ($options as $option) {
/* If any option differs, go away: */
if (is_array($optionList[$option['object_attribute_id']]) && !in_array($option['option_item_id'], $optionList[$option['object_attribute_id']]) || !is_array($optionList[$option['object_attribute_id']]) && $option['option_item_id'] != $optionList[$option['object_attribute_id']]) {
$theSame = false;
break;
}
}
if ($theSame) {
$itemID = $item['id'];
break;
}
}
}
if ($itemID) {
/* If found in the basket, just increment number of that items: */
$item = eZProductCollectionItem::fetch($itemID);
$item->setAttribute('item_count', $quantity + $item->attribute('item_count'));
$item->store();
//.........这里部分代码省略.........
开发者ID:runelangseid,项目名称:ezpublish,代码行数:101,代码来源:ezshopoperationcollection.php
示例11: getUserCountry
/**
* Determine user's country.
*
* \public
* \static
*/
static function getUserCountry( $user = false, $considerPreferedCountry = true )
{
$requireUserCountry = eZVATManager::isUserCountryRequired();
// If current user has set his/her preferred country via the toolbar
if ( $considerPreferedCountry )
{
// return it
$country = eZShopFunctions::getPreferredUserCountry();
if ( $country )
{
eZDebug::writeDebug( "Applying user's preferred country <$country> while charging VAT" );
return $country;
}
}
// Otherwise fetch country saved in the user object.
if ( $user === false )
{
$user = eZUser::currentUser();
}
$userObject = $user->attribute( 'contentobject' );
$countryAttributeName = eZVATManager::getUserCountryAttributeName( $requireUserCountry );
if ( $countryAttributeName === null )
return null;
$userDataMap = $userObject->attribute( 'data_map' );
if ( !isset( $userDataMap[$countryAttributeName] ) )
{
if ( $requireUserCountry )
{
eZDebug::writeError( "Cannot find user country: there is no attribute '$countryAttributeName' in object '" .
$userObject->attribute( 'name' ) .
"' of class '" .
$userObject->attribute( 'class_name' ) . "'.",
__METHOD__ );
}
return null;
}
$countryAttribute = $userDataMap[$countryAttributeName];
$countryContent = $countryAttribute->attribute( 'content' );
if ( $countryContent === null )
{
if ( $requireUserCountry )
{
eZDebug::writeError( "User country is not specified in object '" .
$userObject->attribute( 'name' ) .
"' of class '" .
$userObject->attribute( 'class_name' ) . "'." ,
__METHOD__ );
}
return null;
}
if ( is_object( $countryContent ) )
$country = $countryContent->attribute( 'value' );
elseif ( is_array( $countryContent ) )
{
if ( is_array( $countryContent['value'] ) )
{
foreach ( $countryContent['value'] as $item )
{
$country = $item['Alpha2'];
break;
}
}
else
{
$country = $countryContent['value'];
}
}
else
{
if ( $requireUserCountry )
{
eZDebug::writeError( "User country is not specified or specified incorrectly in object '" .
$userObject->attribute( 'name' ) .
"' of class '" .
$userObject->attribute( 'class_name' ) . "'." ,
__METHOD__ );
}
return null;
}
return $country;
}
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:97,代码来源:ezvatmanager.php
示例12: array
if ( $productClassItem->attribute( 'identifier' ) === $productClassIdentifier )
{
$productClass = $productClassItem;
break;
}
}
}
else
{
// use first element of $productClassList
$productClass = $productClassList[0];
}
}
if ( is_object( $productClass ) )
$priceAttributeIdentifier = eZShopFunctions::priceAttributeIdentifier( $productClass );
switch ( eZPreferences::value( 'productsoverview_list_limit' ) )
{
case '2': { $limit = 25; } break;
case '3': { $limit = 50; } break;
default: { $limit = 10; } break;
}
$sortingField = eZPreferences::value( 'productsoverview_sorting_field' );
$sortingOrder = eZPreferences::value( 'productsoverview_sorting_order' );
$viewParameters = array( 'offset' => $offset );
$tpl = eZTemplate::factory();
$tpl->setVariable( 'product_class_list', $productClassList );
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:31,代码来源:productsoverview.php
示例13:
$root->appendChild($placeNode);
$stateNode = $doc->createElement("state", $state);
$root->appendChild($stateNode);
$countryNode = $doc->createElement("country", $country);
$root->appendChild($countryNode);
$commentNode = $doc->createElement("comment", $comment);
$root->appendChild($commentNode);
$collectNode = $doc->createElement("collect", $collect);
$root->appendChild($collectNode);
$xmlString = $doc->saveXML();
$order->setAttribute('data_text_1', $xmlString);
$order->setAttribute('account_identifier', "twrv2");
$order->setAttribute('ignore_vat', 0);
$order->store();
$db->commit();
eZShopFunctions::setPreferredUserCountry($country);
$http->setSessionVariable('MyTemporaryOrderID', $order->attribute('id'));
$module->redirectTo('/shop/confirmorder/');
return;
} else {
$tpl->setVariable("input_error", true);
}
}
$tpl->setVariable("first_name", $firstName);
$tpl->setVariable("last_name", $lastName);
$tpl->setVariable("email", $email);
$tpl->setVariable("street1", $street1);
$tpl->setVariable("street2", $street2);
$tpl->setVariable("zip", $zip);
$tpl->setVariable("place", $place);
$tpl->setVariable("state", $state);
开发者ID:stevoland,项目名称:ez_patch,代码行数:31,代码来源:userregister.php
示例14: validateCurrencyData
$error = eZCurrencyData::errorMessage($errCode);
} else {
$error = validateCurrencyData($currencyParams);
if ($error === false) {
eZShopFunctions::createCurrency($currencyParams);
eZContentCacheManager::clearAllContentCache();
return $module->redirectTo($module->functionURI('currencylist'));
}
}
} else {
if ($module->isCurrentAction('StoreChanges')) {
$originalCurrencyCode = $module->hasActionParameter('OriginalCurrencyCode') ? $module->actionParameter('OriginalCurrencyCode') : '';
if ($module->hasActionParameter('CurrencyData')) {
$currencyParams = $module->actionParameter('CurrencyData');
}
$errCode = eZShopFunctions::changeCurrency($originalCurrencyCode, $currencyParams['code']);
if ($errCode === eZCurrencyData::ERROR_OK) {
$error = validateCurrencyData($currencyParams);
if ($error === false) {
$currency = eZCurrencyData::fetch($currencyParams['code']);
if (is_object($currency)) {
$currency->setAttribute('symbol', $currencyParams['symbol']);
$currency->setAttribute('locale', $currencyParams['locale']);
$currency->setAttribute('custom_rate_value', $currencyParams['custom_rate_value']);
$currency->setAttribute('rate_factor', $currencyParams['rate_factor']);
$db = eZDB::instance();
$db->begin();
$currency->sync();
$db->commit();
eZContentCacheManager::clearAllContentCache();
return $module->redirectTo($module->functionURI('currencylist'));
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:31,代码来源:editcurrency.php
示例15: foreach
$db->begin();
foreach ($classList as $class) {
if (eZShopFunctions::isSimplePriceClass($class)) {
$classID = $class->attribute('id');
$objectListCount = eZContentObject::fetchSameClassListCount($classID);
if ($objectListCount == 0) {
$cli->output("No objects found for '" . $class->attribute('name') . "' class");
continue;
}
$cli->output("Processing objects of the '" . $class->attribute('name') . "' class");
$defaultCurrency = currencyForLocale();
if (!$defaultCurrency) {
$script->shutdown(1);
}
$defaultCurrencyCode = $defaultCurrency->attribute('code');
$priceClassAttribute = eZShopFunctions::priceAttribute($class);
$priceClassAttributeID = $priceClassAttribute->attribute('id');
// replace 'ezprice' class attribute with 'ezmultiprice'.
$priceClassAttribute->setAttribute('data_type_string', 'ezmultiprice');
$priceClassAttribute->setAttribute(eZMultiPriceType::DEFAULT_CURRENCY_CODE_FIELD, $defaultCurrencyCode);
$priceClassAttribute->store();
unset($GLOBALS['eZContentClassAttributeCache'][$priceClassAttributeID]);
// update objects
$offset = 0;
$limit = 1000;
$cli->output('Converting', false);
while ($offset < $objectListCount) {
$objectList = eZContentObject::fetchSameClassList($class->attribute('id'), true, $offset, $limit);
$offset += count($objectList);
foreach ($objectList as $object) {
$contentObjectID = $object->attribute('id');
开发者ID:netbliss,项目名称:ezpublish,代码行数:31,代码来源:convertprice2multiprice.php
示例16: verify
function verify($currency = false)
{
$contentObject = $this->attribute('contentobject');
if ($contentObject != null && $contentObject->attribute('main_node_id') > 0) {
$attributes = $contentObject->contentObjectAttributes();
$optionsPrice = $this->calculatePriceWithOptions($currency);
foreach ($attributes as $attribute) {
$dataType = $attribute->dataType();
if (eZShopFunctions::isProductDatatype($dataType->isA())) {
$priceObj = $attribute->content();
$price = $priceObj->attribute('price');
$priceWithOptions = $price + $optionsPrice;
if ($priceWithOptions != $this->attribute('price')) {
return false;
}
if ($priceObj->attribute('is_vat_included') != $this->attribute('is_vat_inc') > 0) {
return false;
}
if ($priceObj->attribute('vat_percent') != $this->attribute('vat_value')) {
return false;
}
if ($priceObj->discount() != $this->attribute('discount')) {
return false;
}
return true;
}
}
}
return false;
}
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:30,代码来源:ezproductcollectionitem.php
注:本文中的eZShopFunctions类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论