本文整理汇总了PHP中Magento\Framework\Message\ManagerInterface::addWarning方法的典型用法代码示例。如果您正苦于以下问题:PHP ManagerInterface::addWarning方法的具体用法?PHP ManagerInterface::addWarning怎么用?PHP ManagerInterface::addWarning使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Message\ManagerInterface
的用法示例。
在下文中一共展示了ManagerInterface::addWarning方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkSalesRulesAvailability
/**
* Check rules that contains affected attribute
* If rules were found they will be set to inactive and notice will be add to admin session
*
* @param string $attributeCode
* @return $this
*/
public function checkSalesRulesAvailability($attributeCode)
{
/* @var $collection \Magento\SalesRule\Model\ResourceModel\Rule\Collection */
$collection = $this->_collectionFactory->create()->addAttributeInConditionFilter($attributeCode);
$disabledRulesCount = 0;
foreach ($collection as $rule) {
/* @var $rule \Magento\SalesRule\Model\Rule */
$rule->setIsActive(0);
/* @var $rule->getConditions() \Magento\SalesRule\Model\Rule\Condition\Combine */
$this->_removeAttributeFromConditions($rule->getConditions(), $attributeCode);
$this->_removeAttributeFromConditions($rule->getActions(), $attributeCode);
$rule->save();
$disabledRulesCount++;
}
if ($disabledRulesCount) {
$this->messageManager->addWarning(__('%1 Cart Price Rules based on "%2" attribute have been disabled.', $disabledRulesCount, $attributeCode));
}
return $this;
}
示例2: afterLogin
/**
* @param \Magento\Backend\Model\Auth $authModel
* @return void
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function afterLogin(\Magento\Backend\Model\Auth $authModel)
{
$this->sessionsManager->processLogin();
if ($this->sessionsManager->getCurrentSession()->isOtherSessionsTerminated()) {
$this->messageManager->addWarning(__('All other open sessions for this account were terminated.'));
}
}
示例3: send
/**
* Send email about new order.
* Process mail exception
*
* @param Order $order
* @return bool
*/
public function send(Order $order)
{
try {
$this->orderSender->send($order);
} catch (\Magento\Framework\Mail\Exception $exception) {
$this->logger->logException($exception);
$this->messageManager->addWarning(__('You did not email your customer. Please check your email settings.'));
return false;
}
return true;
}
示例4: _request
protected function _request($request)
{
$requestUrl = $this->_requestUrl($request);
$startTime = round(microtime(true) * 1000);
$cacheId = $this->cache->getId(__METHOD__, array($request));
if ($response = $this->cache->load($cacheId)) {
return $this->_parseResponse($response);
} else {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $this->_requestUrl($request));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 100);
curl_setopt($ch, CURLOPT_TIMEOUT, 400);
curl_setopt($ch, CURLOPT_ENCODING, "gzip,deflate");
curl_setopt($ch, CURLOPT_POST, 1);
$response = curl_exec($ch);
curl_close($ch);
$this->cache->save($response, $cacheId);
if ($this->helper->isRequestDebug()) {
$stime = round(microtime(true) * 1000) - $startTime;
$this->messageManager->addWarning(__('Celebros Search Engine:') . '<br>' . $requestUrl . ' <br>(' . $stime . 'ms)');
}
return $this->_parseResponse($response);
}
}
示例5: isActiveEngine
/**
* Check if Celebros engine is available
*
* @return bool
*/
public function isActiveEngine()
{
if ($this->engineStatus === null) {
$engineStatus = false;
if ($this->isEnabled()) {
if ($this->getCurrentWorkHanlde() == 'catalog_category' && $this->isNavToSearchEnabled()) {
if ($this->isNavToSearchBlacklistEnabled()) {
$categoryId = (int) $this->_request->getParam('id', FALSE);
if ($categoryId) {
$blacklist = $this->getNavToSearchBlacklist();
if (!in_array($categoryId, explode(',', $blacklist))) {
$engineStatus = true;
}
}
} else {
$engineStatus = true;
}
} elseif ($this->getCurrentWorkHanlde() == 'catalogsearch_result') {
$engineStatus = true;
}
}
if ($this->isRequestDebug()) {
$this->messageManager->addWarning(__('Celebros Search Engine') . ($engineStatus ? ' Enabled' : ' Disabled'));
}
$this->engineStatus = $engineStatus;
}
return $this->engineStatus;
}
示例6: act
/**
* / ! \ Changing notice will also change return type / ! \
* @param string $kind
* @param string $url
* @param array $dataJson
* @param bool $notice
* @return array
*/
protected function act($kind, $url, $dataJson = [], $notice = 0)
{
/* Prepairing request and it's header */
$request = $this->init($url);
$headerArray = array('X-Key: ' . $this->_xkey, 'Content-Type: application/json');
curl_setopt($request, CURLOPT_CUSTOMREQUEST, $kind);
/* if POST/PUT request, add Json parameters */
if (!empty($dataJson)) {
$data = json_encode($dataJson);
curl_setopt($request, CURLOPT_POSTFIELDS, $data);
$headerArray[] = 'Content-Length: ' . strlen($data);
}
if (empty($dataJson) && ($kind == self::REST_POST || $kind == self::REST_PUT)) {
$headerArray[] = 'Content-Length: 0';
}
/* filling header with Xkey and options */
curl_setopt($request, CURLOPT_HTTPHEADER, $headerArray);
/* Executing request and retrieveing infos about the request */
$result = curl_exec($request);
$info = curl_getinfo($request);
/* Prepairing return variables */
$result = $this->convertFromJson($result);
$resultArray = array('result' => $result, 'info' => $info);
curl_close($request);
/* Notice user about the error and return json array of result or null if error */
if ($notice > 0) {
if ($resultArray['info']['http_code'] != 200 && $resultArray['info']['http_code'] != 204 && $notice > 0) {
$text = '<p>Error ' . $tab['info']['http_code'] . ' : ""' . $kind . '"" on ' . $endUrl . ' failed.</p>';
if ($notive == 2) {
/* shows up a fancy message on the [next] loading[/ed] page */
$this->messageManager->addWarning($text);
} else {
if ($notice == 1) {
/* Directly echo the error on the page */
echo $text;
}
}
return null;
}
return json_encode($resultArray['result']);
}
/* Returns an array with all the details, including error results */
return $resultArray;
}
示例7: checkCatalogRulesAvailability
/**
* Check rules that contains affected attribute
* If rules were found they will be set to inactive and notice will be add to admin session
*
* @param string $attributeCode
* @return $this
*/
protected function checkCatalogRulesAvailability($attributeCode)
{
/* @var $collection RuleCollectionFactory */
$collection = $this->ruleCollectionFactory->create()->addAttributeInConditionFilter($attributeCode);
$disabledRulesCount = 0;
foreach ($collection as $rule) {
/* @var $rule Rule */
$rule->setIsActive(0);
/* @var $rule->getConditions() Combine */
$this->removeAttributeFromConditions($rule->getConditions(), $attributeCode);
$rule->save();
$disabledRulesCount++;
}
if ($disabledRulesCount) {
$this->ruleProductProcessor->markIndexerAsInvalid();
$this->messageManager->addWarning(__('You disabled %1 Catalog Price Rules based on "%2" attribute.', $disabledRulesCount, $attributeCode));
}
return $this;
}
示例8: addWarning
public function addWarning($message, $popupText = null, $popupTitle = null)
{
$popupId = $this->addPopup($popupText, $popupTitle);
$this->messageManager->addWarning($this->getMessageText($message, $popupId));
}
示例9: _checkCatalogRulesAvailability
/**
* Check rules that contains affected attribute
* If rules were found they will be set to inactive and notice will be add to admin session
*
* @param string $attributeCode
* @return $this
*/
protected function _checkCatalogRulesAvailability($attributeCode)
{
/* @var $collection Collection */
$collection = $this->_ruleCollectionFactory->create()->addAttributeInConditionFilter($attributeCode);
$disabledRulesCount = 0;
foreach ($collection as $rule) {
/* @var $rule Rule */
$rule->setIsActive(0);
/* @var $rule->getConditions() Combine */
$this->_removeAttributeFromConditions($rule->getConditions(), $attributeCode);
$rule->save();
$disabledRulesCount++;
}
if ($disabledRulesCount) {
$this->_ruleFactory->create()->applyAll();
$this->messageManager->addWarning(__('%1 Catalog Price Rules based on "%2" attribute have been disabled.', $disabledRulesCount, $attributeCode));
}
return $this;
}