本文整理汇总了PHP中Mage_Core_Controller_Request_Http::getParam方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Controller_Request_Http::getParam方法的具体用法?PHP Mage_Core_Controller_Request_Http::getParam怎么用?PHP Mage_Core_Controller_Request_Http::getParam使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Controller_Request_Http
的用法示例。
在下文中一共展示了Mage_Core_Controller_Request_Http::getParam方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
* Perform an export according to the given request.
*
* @param Mage_Core_Controller_Request_Http $request
* @param Mage_Core_Controller_Response_Http $response
* @throws Exception
*/
public function process(Mage_Core_Controller_Request_Http $request, Mage_Core_Controller_Response_Http $response)
{
// In case store is part of URL path use it to choose config.
$store = $request->get('store');
if ($store) {
$store = Mage::app()->getStore($store);
}
$apiConfigCharset = Mage::getStoreConfig("api/config/charset", $store);
$start_date = strtotime($request->getParam('start_date'));
$end_date = strtotime($request->getParam('end_date'));
if (!$start_date || !$end_date) {
throw new Exception('Start and end dates are required', 400);
}
$page = (int) $request->getParam('page');
/* @var $orders Mage_Sales_Model_Mysql4_Order_Collection */
$orders = Mage::getResourceModel('sales/order_collection');
// might use 'created_at' attribute instead
$orders->addAttributeToFilter('updated_at', array('from' => date('Y-m-d H:i:s', $start_date), 'to' => date('Y-m-d H:i:s', $end_date)));
if ($store) {
$orders->addAttributeToFilter('store_id', $store->getId());
}
if ($page > 0) {
$orders->setPage($page, $this->_getExportPageSize());
}
$xml = new XMLWriter();
$xml->openMemory();
$xml->startDocument('1.0', $apiConfigCharset);
$this->_writeOrders($orders, $xml, $store ? $store->getId() : 0);
$xml->endDocument();
$response->clearHeaders()->setHeader('Content-Type', 'text/xml; charset=' . $apiConfigCharset)->setBody($xml->outputMemory(true));
}
示例2: login
/**
* Try to login user in admin
*
* @param string $username
* @param string $password
* @param Mage_Core_Controller_Request_Http $request
* @return Mage_Admin_Model_User|null
*/
public function login($username, $password, $request = null)
{
if (empty($username) || empty($password)) {
return;
}
$user = Mage::getModel('admin/user')->login($username, $password);
if ($user->getId() && $user->getIsActive() != '1') {
if ($request && !$request->getParam('messageSent')) {
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Your Account has been deactivated.'));
$request->setParam('messageSent', true);
}
} elseif (!Mage::getModel('admin/user')->hasAssigned2Role($user->getId())) {
if ($request && !$request->getParam('messageSent')) {
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Access Denied.'));
$request->setParam('messageSent', true);
}
} else {
if ($user->getId()) {
$session = Mage::getSingleton('admin/session');
$session->setIsFirstVisit(true);
$session->setUser($user);
$session->setAcl(Mage::getResourceModel('admin/acl')->loadAcl());
if ($request) {
header('Location: ' . $request->getRequestUri());
exit;
}
} else {
if ($request && !$request->getParam('messageSent')) {
Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Invalid Username or Password.'));
$request->setParam('messageSent', true);
}
}
}
return $user;
}
示例3: setPageFromRequest
/**
* Read settings
*
* @param Mage_Core_Controller_Request_Http $request
* @return $this
*/
public function setPageFromRequest(Mage_Core_Controller_Request_Http $request)
{
$this->_currentPage = max(1, $request->getParam('page'));
$limit = $request->getParam('limit', null);
if ($limit !== null) {
$this->_pageSize = (int) $limit;
}
return $this;
}
示例4: isApiKeyValid
/**
* @param Mage_Core_Controller_Request_Http $request
*
* @return bool
*/
public function isApiKeyValid(Mage_Core_Controller_Request_Http $request)
{
$apiKeyName = $this->getApiKeyName();
$postApiKey = $request->getParam($apiKeyName, NULL);
$key = $this->getApiKey();
return !empty($key) && $key === $postApiKey;
}
示例5: initFromRequest
/**
* @param Mage_Core_Controller_Request_Http $request
* @return string
* @throws Mage_Core_Exception
*/
public function initFromRequest(Mage_Core_Controller_Request_Http $request)
{
if ($request->getParam('expert_mode') == 'on') {
$cronExpression = $request->getParam('cron_expr');
return $cronExpression;
}
try {
// easy mapping
$params = $request->getParams();
$data = new Noovias_Cron_Data_CronExpression($params);
//
$cronExpression = $this->getGenerationService()->generateCronExprFromDataObject($data);
return $cronExpression;
} catch (Exception $e) {
throw new Mage_Core_Exception($e->getMessage());
}
}
示例6: process
/**
* Perform a notify using POSTed data.
*
* See Auctane API specification.
*
* @param Mage_Core_Controller_Request_Http $request
* @throws Exception
*/
public function process(Mage_Core_Controller_Request_Http $request)
{
// Raw XML is POSTed to this stream
$xml = simplexml_load_file('php://input');
// load some objects
$order = $this->_getOrder($xml->OrderNumber);
$qtys = $this->_getOrderItemQtys(@$xml->Items, $order);
$shipment = $this->_getOrderShipment($order, $qtys);
// this is where tracking is actually added
$track = Mage::getModel('sales/order_shipment_track')->setNumber($xml->TrackingNumber)->setCarrierCode($xml->Carrier)->setTitle($xml->Service);
$shipment->addTrack($track);
// 'NotifyCustomer' must be "true" or "yes" to trigger an email
$notify = filter_var(@$xml->NotifyCustomer, FILTER_VALIDATE_BOOLEAN);
$capture = filter_var($request->getParam('capture'), FILTER_VALIDATE_BOOLEAN);
if ($capture && $order->canInvoice()) {
$invoice = $order->prepareInvoice($qtys);
$invoice->setRequestedCaptureCase($invoice->canCapture() ? 'online' : 'offline')->register()->addComment($this->_getInvoiceComment(), $notify)->sendEmail($notify);
// always send to store manager, and optionally notify customer too
$order->setIsInProcess(true);
// updates status on save
}
// Internal notes are only visible to admin
if (@$xml->InternalNotes) {
$shipment->addComment($xml->InternalNotes);
}
// Customer notes have 'Visible On Frontend' set
if ($notify) {
// if no NotesToCustomer then comment is empty string
$shipment->sendEmail(true, (string) @$xml->NotesToCustomer)->setEmailSent(true);
}
if (@$xml->NotesToCustomer) {
$shipment->addComment($xml->NotesToCustomer, $notify, true);
}
$transaction = Mage::getModel('core/resource_transaction');
$transaction->addObject($shipment)->addObject($track);
if (isset($invoice)) {
// order has been captured, therefore has been modified
$transaction->addObject($invoice)->addObject($order);
}
$transaction->save();
if ($order->canInvoice() && !$order->canShip()) {
// then silently invoice if order is shipped to move status to "Complete")
$invoice = $order->prepareInvoice();
$invoice->setRequestedCaptureCase($invoice->canCapture() ? 'online' : 'offline')->register()->addComment($this->_getInvoiceComment(), false)->sendEmail(false);
// always send to store manager, and optionally notify customer too
$order->setIsInProcess(true);
// updates status on save
$transaction = Mage::getModel('core/resource_transaction');
if (isset($invoice)) {
// order has been captured, therefore has been modified
$transaction->addObject($invoice)->addObject($order);
}
$transaction->save();
}
}
示例7: _parseInRoleUsersFilter
/**
* Parse $_inRoleUsersFilter value from request
*
* @param Mage_Core_Controller_Request_Http $request
* @param Mage_Backend_Helper_Data $backendHelper
* @return int
*/
protected function _parseInRoleUsersFilter(Mage_Core_Controller_Request_Http $request, Mage_Backend_Helper_Data $backendHelper)
{
$result = self::IN_ROLE_USERS_ANY;
$filter = $backendHelper->prepareFilterString($request->getParam('filter', ''));
if (isset($filter[self::IN_ROLE_USERS_PARAMETER])) {
$result = $filter[self::IN_ROLE_USERS_PARAMETER] ? self::IN_ROLE_USERS_YES : self::IN_ROLE_USERS_NO;
} elseif (!$request->isAjax()) {
$result = self::IN_ROLE_USERS_YES;
}
return $result;
}
示例8: validateCustomerAttributeActions
/**
* Validate customer attribute actions
*
* @param Mage_Adminhtml_Controller_Action $controller
* @return bool
*/
public function validateCustomerAttributeActions($controller)
{
$actionName = strtolower($this->_request->getActionName());
$attributeId = $this->_request->getParam('attribute_id');
$websiteId = $this->_request->getParam('website');
if (in_array($actionName, array('new', 'delete')) || in_array($actionName, array('edit', 'save')) && !$attributeId || $websiteId && !$this->_role->hasWebsiteAccess($websiteId, true)) {
$this->_forward();
return false;
}
return true;
}
示例9: _hidePriceElements
/**
* Hide price elements on Price Tab of Product Edit Page if needed
*
* @param Mage_Core_Block_Abstract $block
* @return void
*/
protected function _hidePriceElements($block)
{
/** @var $product Mage_Catalog_Model_Product */
$product = Mage::registry('product');
$form = $block->getForm();
$group = $block->getGroup();
$fieldset = null;
if (!is_null($form) && !is_null($group)) {
$fieldset = $form->getElement('group_fields' . $group->getId());
}
if (!is_null($product) && !is_null($form) && !is_null($group) && !is_null($fieldset)) {
$priceElementIds = array('special_price', 'tier_price', 'group_price', 'special_from_date', 'special_to_date', 'cost', 'open_amount_max', 'open_amount_min', 'allow_open_amount', 'giftcard_amounts', 'msrp_enabled', 'msrp_display_actual_price_type', 'msrp');
// Leave price element for bundle product active in order to change/view price type when product is created
if (Mage::registry('product')->getTypeId() != Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
array_push($priceElementIds, 'price');
}
// Remove price elements or disable them if needed
foreach ($priceElementIds as &$priceId) {
if (!$this->_canReadProductPrice) {
$fieldset->removeField($priceId);
} elseif (!$this->_canEditProductPrice) {
$priceElement = $form->getElement($priceId);
if (!is_null($priceElement)) {
$priceElement->setReadonly(true, true);
}
}
}
if (!$this->_canEditProductPrice) {
// Handle Recurring Profile tab
if ($form->getElement('recurring_profile')) {
$form->getElement('recurring_profile')->setReadonly(true, true)->getForm()->setReadonly(true, true);
}
}
if ($product->isObjectNew()) {
if (!$this->_canEditProductPrice) {
// For each type of products accept except Bundle products, set default value for price if allowed
$priceElement = $form->getElement('price');
if (!is_null($priceElement) && $this->_canReadProductPrice && Mage::registry('product')->getTypeId() != Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
$priceElement->setValue($this->_defaultProductPriceString);
}
// For giftcard products set default amount
$amountsElement = $form->getElement('giftcard_amounts');
if (!is_null($amountsElement)) {
$storeId = (int) $this->_request->getParam('store', 0);
$websiteId = Mage::app()->getStore($storeId)->getWebsiteId();
$amountsElement->setValue(array(array('website_id' => $websiteId, 'value' => $this->_defaultProductPriceString, 'website_value' => (double) $this->_defaultProductPriceString)));
}
}
}
}
}
示例10: validateCmsHierarchyAction
/**
* Block editing of Hierarchy if GWS permissions are applicable
*
* @param Mage_Adminhtml_Controller_Action $controller
* @return bool|void
*/
public function validateCmsHierarchyAction($controller)
{
if (!$this->_role->getIsAll()) {
$requestAction = $this->_request->getActionName();
if ($requestAction == 'delete' || $requestAction == 'copy') {
$scopesParam = $this->_request->getParam('scopes');
$scopesParamIsArray = true;
if (!is_array($scopesParam)) {
$scopesParam = array($scopesParam);
$scopesParamIsArray = false;
}
$validatedScopes = array();
foreach (array_unique($scopesParam) as $value) {
if (0 === strpos($value, Enterprise_Cms_Helper_Hierarchy::SCOPE_PREFIX_WEBSITE)) {
$scopeId = (int) str_replace(Enterprise_Cms_Helper_Hierarchy::SCOPE_PREFIX_WEBSITE, '', $value);
if ($this->_role->hasExclusiveAccess((array) $scopeId)) {
$validatedScopes[] = $value;
}
} elseif (0 === strpos($value, Enterprise_Cms_Helper_Hierarchy::SCOPE_PREFIX_STORE)) {
$scopeId = (int) str_replace(Enterprise_Cms_Helper_Hierarchy::SCOPE_PREFIX_STORE, '', $value);
if ($this->_role->hasExclusiveStoreAccess((array) $scopeId)) {
$validatedScopes[] = $value;
}
}
}
if (count($validatedScopes) > 0) {
if ($requestAction == 'delete' && !$scopesParamIsArray && count($validatedScopes) == 1 && isset($validatedScopes[0])) {
$validatedScopes = $validatedScopes[0];
}
$this->_request->setParam('scopes', $validatedScopes);
} else {
$this->_forward();
return false;
}
} else {
$websiteCode = $controller->getRequest()->getParam('website');
$website = Mage::app()->getWebsite($websiteCode);
$websiteId = $website->getId();
if (!$this->_role->hasExclusiveAccess((array) $websiteId)) {
$storeCode = $controller->getRequest()->getParam('store');
$store = Mage::app()->getStore($storeCode);
$storeId = $store->getId();
if (!$this->_role->hasExclusiveStoreAccess((array) $storeId)) {
$this->_forward();
return false;
}
}
}
}
return true;
}
示例11: buildAndSendResponse
public function buildAndSendResponse(Mage_Core_Controller_Request_Http $httpRequest, Mage_Core_Controller_Response_Http $httpResponse)
{
try {
$categoryId = $httpRequest->getParam('category_id');
$allMode = $httpRequest->getParam('all_categories_mode');
if (!$allMode && !$categoryId) {
throw new Creatuity_MegaMenu_Model_Ajax_UserException("'category_id' parameter is missing");
}
$cacheKey = $allMode ? $categoryId : 0;
$this->_jsonResponse = $this->_cache()->loadCache($cacheKey);
if ($this->_jsonResponse === false) {
$this->_jsonResponse = $this->_process($categoryId, $allMode);
$this->_cache()->saveCache($cacheKey, $this->_jsonResponse);
}
$this->_renderResponse($httpResponse, $this->_jsonResponse, 200);
$this->_cache()->setNeverExpireBrowserCacheHeader($httpRequest, $httpResponse);
} catch (Creatuity_MegaMenu_Model_Ajax_UserException $e) {
$this->_renderResponse($httpResponse, $this->_errorResponse($e->getMessage()), 500);
} catch (Exception $e) {
Mage::logException($e);
$this->_renderResponse($httpResponse, $this->_errorResponse(Mage::getIsDeveloperMode() ? $e->getMessage() : ''), 500);
}
return $this;
}
示例12: getDefaultCurrency
/**
* Retrieve default currency for selected store, website or website group
*
* @param Mage_Core_Controller_Request_Http $request
* @return string
*/
public function getDefaultCurrency(Mage_Core_Controller_Request_Http $request)
{
if ($request->getParam('store')) {
$store = $request->getParam('store');
$currencyCode = $this->_app->getStore($store)->getBaseCurrencyCode();
} else {
if ($request->getParam('website')) {
$website = $request->getParam('website');
$currencyCode = $this->_app->getWebsite($website)->getBaseCurrencyCode();
} else {
if ($request->getParam('group')) {
$group = $request->getParam('group');
$currencyCode = $this->_app->getGroup($group)->getWebsite()->getBaseCurrencyCode();
} else {
$currencyCode = $this->_app->getStore()->getBaseCurrencyCode();
}
}
}
return $currencyCode;
}
示例13: _getFormNewCustomerAddress
/**
* Get New Customer Address from form
*
* @param Mage_Core_Controller_Request_Http $request
*
* @return Mage_Customer_Model_Address
*/
protected function _getFormNewCustomerAddress(Mage_Core_Controller_Request_Http $request)
{
$customerAddressId = $request->getParam('id');
$customerAddress = Mage::getModel('checkout/type_multishipping')->getCustomer()->getAddressById($customerAddressId);
/* @var Mage_Customer_Model_Form $addressForm*/
$addressForm = Mage::getModel('customer/form');
$addressForm->setFormCode('customer_address_edit')->setEntity($customerAddress);
$addressData = $addressForm->extractData($request);
$customerAddress->setData(array_merge($customerAddress->getData(), $addressData));
$customerAddress->setIsDefaultBilling($request->getParam('default_billing', false))->setIsDefaultShipping($request->getParam('default_shipping', false));
return $customerAddress;
}
示例14: getCatalogCategoryViewCacheTags
/**
* @param Mage_Core_Controller_Request_Http $request
* @return array
*/
protected function getCatalogCategoryViewCacheTags(Mage_Core_Controller_Request_Http $request)
{
$cacheTags = array();
$cacheTags[] = sha1('category');
$categoryId = (int) $request->getParam('id', false);
if ($categoryId) {
$cacheTags[] = sha1('category_' . $categoryId);
}
return $cacheTags;
}
示例15: _extractRequestEditValues
/**
* Extract edit values from given request
*
* @param string $type Grid block type
* @param array $config Edited value config
* @param Mage_Core_Controller_Request_Http $request Request object
* @return array
*/
protected function _extractRequestEditValues($type, $config, $request)
{
$idsKey = $config['config']['ids_key'];
$additionalKey = $config['config']['additional_key'];
$valuesKey = $config['config']['values_key'];
$params = array('ids' => $request->getParam($idsKey, array()), 'additional' => $request->getParam($additionalKey, array()), 'values' => $request->getParam($valuesKey, array()), 'global' => array_diff_key($request->getParams(), array_flip(array($idsKey, $additionalKey, $valuesKey))));
return array_map(create_function('$a', 'return (is_array($a) ? $a : array());'), $params);
}