Magento 2.3.0 How to get request parameters in event observer?error on review list pagemagento 2 unable to redirect to external url from observerMagento (2.0.5) review rest apiI created a custom module ,but getting error, not able to figure out what the error is about. How to get out of this error?Set custom price of product when adding to cart code not workingMy custom observer not workingMagento 2 Sending emails triggered by observerHow to see all the observers currently registered?Magento 2 module error after version upgradeDeleted ShipperHQ module causing error in “All Customers” section of Magento 2
Why does Arg'[1. + I] return -0.5?
Does Mathematica have an implementation of the Poisson binomial distribution?
Older movie/show about humans on derelict alien warship which refuels by passing through a star
Are there moral objections to a life motivated purely by money? How to sway a person from this lifestyle?
Combinatorics problem, right solution?
How much cash can I safely carry into the USA and avoid civil forfeiture?
Philosophical question on logistic regression: why isn't the optimal threshold value trained?
A faster way to compute the largest prime factor
Why do games have consumables?
"Whatever a Russian does, they end up making the Kalashnikov gun"? Are there any similar proverbs in English?
Do I need to watch Ant-Man and the Wasp and Captain Marvel before watching Avengers: Endgame?
Retract an already submitted recommendation letter (written for an undergrad student)
Creating a chemical industry without petroleum
Conditionally enable edit in lightning:datatable
How exactly does Hawking radiation decrease the mass of black holes?
Multiple fireplaces in an apartment building?
Why do real positive eigenvalues result in an unstable system? What about eigenvalues between 0 and 1? or 1?
What is the term for a person whose job is to place products on shelves in stores?
Island of Knights, Knaves and Spies
Multiple options vs single option UI
Can I criticise the more senior developers around me for not writing clean code?
Scheduling based problem
The weakest link
How do I reattach a shelf to the wall when it ripped out of the wall?
Magento 2.3.0 How to get request parameters in event observer?
error on review list pagemagento 2 unable to redirect to external url from observerMagento (2.0.5) review rest apiI created a custom module ,but getting error, not able to figure out what the error is about. How to get out of this error?Set custom price of product when adding to cart code not workingMy custom observer not workingMagento 2 Sending emails triggered by observerHow to see all the observers currently registered?Magento 2 module error after version upgradeDeleted ShipperHQ module causing error in “All Customers” section of Magento 2
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I would like to get a request parameter in the observer file.
Below is the observer code.
etc/frontend/di.xml
<event name="review_save_before">
<observer name="set_customer_data" instance="NamespaceModulenameObserverReviewSaveBeforeObserver"/>
</event>
Observer/ReviewSaveBeforeObserver
<?php
namespace NamespaceModulenameObserver;
use MagentoFrameworkEventObserver;
use MagentoFrameworkEventObserverInterface;
use MagentoReviewModelReview;
use PsrLogLoggerInterface;
use MagentoSalesApiDataOrderInterface;
use MagentoFrameworkAppRequestHttp;
class ReviewSaveBeforeObserver implements ObserverInterface
/**
* @var Http
*/
private $request;
/**
* @var OrderInterface
*/
private $orderInterface;
/** @var MagentoFrameworkLoggerMonolog */
protected $logger;
public function __construct(
LoggerInterface $loggerInterface,
OrderInterface $orderInterface,
Http $request
)
$this->logger = $loggerInterface;
$this->orderInterface = $orderInterface;
$this->request = $request;
/**
* This is the method that fires when the event runs.
*
* @param Observer $observer
*/
public function execute(Observer $observer)
$this->logger->addDebug('Executed Review Save After Observer');
/** @var Review $review */
$review = $observer->getDataByKey('object');
echo '<pre>';print_r($this->request->getParams());die;
//$review->setStatusId(Review::STATUS_APPROVED);
$review->setCustomerId(1);
But it is throwing below error.
Fatal error: Uncaught Exception: User Error: Some transactions have not been committed or rolled back in /var/www/html/CE/2.3.0/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on line 3955 in /var/www/html/CE/2.3.0/vendor/magento/framework/App/ErrorHandler.php:61 Stack trace: #0 [internal function]: MagentoFrameworkAppErrorHandler->handler(256, 'Some transactio...', '/var/www/html/C...', 3955, Array) #1 /var/www/html/CE/2.3.0/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(3955): trigger_error('Some transactio...', 256) #2 [internal function]: MagentoFrameworkDBAdapterPdoMysql->__destruct() #3 main thrown in /var/www/html/CE/2.3.0/vendor/magento/framework/App/ErrorHandler.php on line 61
Any help would be appreciated! Thanks.
module event-observer review magento2.3.0 request
add a comment |
I would like to get a request parameter in the observer file.
Below is the observer code.
etc/frontend/di.xml
<event name="review_save_before">
<observer name="set_customer_data" instance="NamespaceModulenameObserverReviewSaveBeforeObserver"/>
</event>
Observer/ReviewSaveBeforeObserver
<?php
namespace NamespaceModulenameObserver;
use MagentoFrameworkEventObserver;
use MagentoFrameworkEventObserverInterface;
use MagentoReviewModelReview;
use PsrLogLoggerInterface;
use MagentoSalesApiDataOrderInterface;
use MagentoFrameworkAppRequestHttp;
class ReviewSaveBeforeObserver implements ObserverInterface
/**
* @var Http
*/
private $request;
/**
* @var OrderInterface
*/
private $orderInterface;
/** @var MagentoFrameworkLoggerMonolog */
protected $logger;
public function __construct(
LoggerInterface $loggerInterface,
OrderInterface $orderInterface,
Http $request
)
$this->logger = $loggerInterface;
$this->orderInterface = $orderInterface;
$this->request = $request;
/**
* This is the method that fires when the event runs.
*
* @param Observer $observer
*/
public function execute(Observer $observer)
$this->logger->addDebug('Executed Review Save After Observer');
/** @var Review $review */
$review = $observer->getDataByKey('object');
echo '<pre>';print_r($this->request->getParams());die;
//$review->setStatusId(Review::STATUS_APPROVED);
$review->setCustomerId(1);
But it is throwing below error.
Fatal error: Uncaught Exception: User Error: Some transactions have not been committed or rolled back in /var/www/html/CE/2.3.0/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on line 3955 in /var/www/html/CE/2.3.0/vendor/magento/framework/App/ErrorHandler.php:61 Stack trace: #0 [internal function]: MagentoFrameworkAppErrorHandler->handler(256, 'Some transactio...', '/var/www/html/C...', 3955, Array) #1 /var/www/html/CE/2.3.0/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(3955): trigger_error('Some transactio...', 256) #2 [internal function]: MagentoFrameworkDBAdapterPdoMysql->__destruct() #3 main thrown in /var/www/html/CE/2.3.0/vendor/magento/framework/App/ErrorHandler.php on line 61
Any help would be appreciated! Thanks.
module event-observer review magento2.3.0 request
add a comment |
I would like to get a request parameter in the observer file.
Below is the observer code.
etc/frontend/di.xml
<event name="review_save_before">
<observer name="set_customer_data" instance="NamespaceModulenameObserverReviewSaveBeforeObserver"/>
</event>
Observer/ReviewSaveBeforeObserver
<?php
namespace NamespaceModulenameObserver;
use MagentoFrameworkEventObserver;
use MagentoFrameworkEventObserverInterface;
use MagentoReviewModelReview;
use PsrLogLoggerInterface;
use MagentoSalesApiDataOrderInterface;
use MagentoFrameworkAppRequestHttp;
class ReviewSaveBeforeObserver implements ObserverInterface
/**
* @var Http
*/
private $request;
/**
* @var OrderInterface
*/
private $orderInterface;
/** @var MagentoFrameworkLoggerMonolog */
protected $logger;
public function __construct(
LoggerInterface $loggerInterface,
OrderInterface $orderInterface,
Http $request
)
$this->logger = $loggerInterface;
$this->orderInterface = $orderInterface;
$this->request = $request;
/**
* This is the method that fires when the event runs.
*
* @param Observer $observer
*/
public function execute(Observer $observer)
$this->logger->addDebug('Executed Review Save After Observer');
/** @var Review $review */
$review = $observer->getDataByKey('object');
echo '<pre>';print_r($this->request->getParams());die;
//$review->setStatusId(Review::STATUS_APPROVED);
$review->setCustomerId(1);
But it is throwing below error.
Fatal error: Uncaught Exception: User Error: Some transactions have not been committed or rolled back in /var/www/html/CE/2.3.0/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on line 3955 in /var/www/html/CE/2.3.0/vendor/magento/framework/App/ErrorHandler.php:61 Stack trace: #0 [internal function]: MagentoFrameworkAppErrorHandler->handler(256, 'Some transactio...', '/var/www/html/C...', 3955, Array) #1 /var/www/html/CE/2.3.0/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(3955): trigger_error('Some transactio...', 256) #2 [internal function]: MagentoFrameworkDBAdapterPdoMysql->__destruct() #3 main thrown in /var/www/html/CE/2.3.0/vendor/magento/framework/App/ErrorHandler.php on line 61
Any help would be appreciated! Thanks.
module event-observer review magento2.3.0 request
I would like to get a request parameter in the observer file.
Below is the observer code.
etc/frontend/di.xml
<event name="review_save_before">
<observer name="set_customer_data" instance="NamespaceModulenameObserverReviewSaveBeforeObserver"/>
</event>
Observer/ReviewSaveBeforeObserver
<?php
namespace NamespaceModulenameObserver;
use MagentoFrameworkEventObserver;
use MagentoFrameworkEventObserverInterface;
use MagentoReviewModelReview;
use PsrLogLoggerInterface;
use MagentoSalesApiDataOrderInterface;
use MagentoFrameworkAppRequestHttp;
class ReviewSaveBeforeObserver implements ObserverInterface
/**
* @var Http
*/
private $request;
/**
* @var OrderInterface
*/
private $orderInterface;
/** @var MagentoFrameworkLoggerMonolog */
protected $logger;
public function __construct(
LoggerInterface $loggerInterface,
OrderInterface $orderInterface,
Http $request
)
$this->logger = $loggerInterface;
$this->orderInterface = $orderInterface;
$this->request = $request;
/**
* This is the method that fires when the event runs.
*
* @param Observer $observer
*/
public function execute(Observer $observer)
$this->logger->addDebug('Executed Review Save After Observer');
/** @var Review $review */
$review = $observer->getDataByKey('object');
echo '<pre>';print_r($this->request->getParams());die;
//$review->setStatusId(Review::STATUS_APPROVED);
$review->setCustomerId(1);
But it is throwing below error.
Fatal error: Uncaught Exception: User Error: Some transactions have not been committed or rolled back in /var/www/html/CE/2.3.0/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php on line 3955 in /var/www/html/CE/2.3.0/vendor/magento/framework/App/ErrorHandler.php:61 Stack trace: #0 [internal function]: MagentoFrameworkAppErrorHandler->handler(256, 'Some transactio...', '/var/www/html/C...', 3955, Array) #1 /var/www/html/CE/2.3.0/vendor/magento/framework/DB/Adapter/Pdo/Mysql.php(3955): trigger_error('Some transactio...', 256) #2 [internal function]: MagentoFrameworkDBAdapterPdoMysql->__destruct() #3 main thrown in /var/www/html/CE/2.3.0/vendor/magento/framework/App/ErrorHandler.php on line 61
Any help would be appreciated! Thanks.
module event-observer review magento2.3.0 request
module event-observer review magento2.3.0 request
asked 6 hours ago
Chirag PatelChirag Patel
2,678423
2,678423
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Try using
MagentoFrameworkAppRequestInterface::getParams()
In replacement for:
MagentoFrameworkAppRequestHttp::getParams()
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f272465%2fmagento-2-3-0-how-to-get-request-parameters-in-event-observer%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try using
MagentoFrameworkAppRequestInterface::getParams()
In replacement for:
MagentoFrameworkAppRequestHttp::getParams()
add a comment |
Try using
MagentoFrameworkAppRequestInterface::getParams()
In replacement for:
MagentoFrameworkAppRequestHttp::getParams()
add a comment |
Try using
MagentoFrameworkAppRequestInterface::getParams()
In replacement for:
MagentoFrameworkAppRequestHttp::getParams()
Try using
MagentoFrameworkAppRequestInterface::getParams()
In replacement for:
MagentoFrameworkAppRequestHttp::getParams()
edited 6 hours ago
answered 6 hours ago
magefmsmagefms
2,8262529
2,8262529
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f272465%2fmagento-2-3-0-how-to-get-request-parameters-in-event-observer%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown