How to get parameter value from template.phtml file to plugin.php file in magento 2?How do I use PHP to get the current year?A potentially dangerous Request.Form value was detected from the clientHow do I get (extract) a file extension in PHP?How does the SQL injection from the “Bobby Tables” XKCD comic work?How can I get query string values in JavaScript?How do I get PHP errors to display?How do I get a YouTube video thumbnail from the YouTube API?How to Sort Multi-dimensional Array by Value?How to get the client IP address in PHPGetting a 500 error when I try to login to the Magento 2 admin panel
How can faith be maintained in a world of living gods?
Maze generator & animator in Python
Why is the the worst case for this function O(n*n)
Short story: Interstellar inspector senses "off" nature of planet hiding aggressive culture
How to calculate the proper layer height multiples?
When did computers stop checking memory on boot?
More than three domains hosted on the same IP address
What is the difference between tl_to_str:V and tl_to_str:N?
What's the biggest difference between these two photos?
Quick Shikaku Puzzle: Stars and Stripes
Distinguishing between octahedral and tetrahedral holes
What is the difference between a translation and a Galilean transformation?
Why can linguists decide which use of language is correct and which is not?
The pirate treasure of Leatherback Atoll
How to handle fsck "Error while scanning inodes"?
Chandrayaan 2: Why is Vikram Lander's life limited to 14 Days?
Is mountain bike good for long distances?
How to reference a custom counter that shows section number?
Why is it that I have to play this note on the piano as A sharp?
Friend is very nitpicky about side comments I don't intend to be taken too seriously
Do aarakocra have arms as well as wings?
is it possible to change a material depending on whether it is intersecting with another object?
Is a MySQL database a viable alternative to LDAP?
UK citizen travelling to France at the end of November
How to get parameter value from template.phtml file to plugin.php file in magento 2?
How do I use PHP to get the current year?A potentially dangerous Request.Form value was detected from the clientHow do I get (extract) a file extension in PHP?How does the SQL injection from the “Bobby Tables” XKCD comic work?How can I get query string values in JavaScript?How do I get PHP errors to display?How do I get a YouTube video thumbnail from the YouTube API?How to Sort Multi-dimensional Array by Value?How to get the client IP address in PHPGetting a 500 error when I try to login to the Magento 2 admin panel
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
In magento 2.2.7 when AddToCart button is clicked i need to
validate Delivery Postcode field.Only if the customer enter the
correct post code the product should added to the cart.The Delivery Postcode is a separate extension. Inside the extension
i wrote before plugin (using beforeAddProduct class)and try to get
the postcode parameter but i am unable to do so, but i can able to
get the product related parameter.For ex. product quantity i can
able get. Can you please guide me how to get the postcode value
inside the plugin?Extension Folder structure :https://www.screencast.com/t/AP1nr6cPkWvn
My template code :https://www.screencast.com/t/sEFZ0rUM
My plugin code
/**
* @var MagentoFrameworkAppRequestHttp
*/
protected $request;
/**
* @var MagePrashantCheckDeliveryHelperData
*/
protected $helper;
/**
* @var MagentoFrameworkMessageManagerInterface
*/
protected $message;
/**
* Plugin constructor.
*
* @param MagentoCheckoutModelSession $checkoutSession
* @param MagentoFrameworkAppRequestHttp $request
* @param MagePrashantCheckDeliveryHelperData $helper
* @param MagentoFrameworkMessageManagerInterface $message
*/
public function __construct(
MagentoCheckoutModelSession $checkoutSession,
MagentoFrameworkAppRequestHttp $request,
MagePrashantCheckDeliveryHelperData $helper,
MagentoFrameworkMessageManagerInterface $message
)
$this->quote = $checkoutSession->getQuote();
$this->request = $request;
$this->helper = $helper;
$this->message = $message;
/**
* beforeAddProduct
*
* @param $subject
* @param $productInfo
* @param null $requestInfo
*
* @return array
* @throws LocalizedException
*/
public function beforeAddProduct($subject, $productInfo, $requestInfo = null)
$postcode = $this->request->getParam('postcode');
print_r($postcode);
//Null
print_r($this->request->getParams());
//Array ( [uenc] => aHR0cDovLzEyNy4wLjAuMS9QZXRzeS9wZWRpZ3JlZS1wdXBweS1taWxrLWFuZC12ZWdldGFibGUuaHRtbA,, [product] => 59 [selected_configurable_option] => [related_product] => [item] => 59 [form_key] => BIYNJmVlffX0A95H [super_attribute] => Array ( [140] => 10 ) [qty] => 1 )
}
php validation plugins magento2 pin-code
add a comment |
In magento 2.2.7 when AddToCart button is clicked i need to
validate Delivery Postcode field.Only if the customer enter the
correct post code the product should added to the cart.The Delivery Postcode is a separate extension. Inside the extension
i wrote before plugin (using beforeAddProduct class)and try to get
the postcode parameter but i am unable to do so, but i can able to
get the product related parameter.For ex. product quantity i can
able get. Can you please guide me how to get the postcode value
inside the plugin?Extension Folder structure :https://www.screencast.com/t/AP1nr6cPkWvn
My template code :https://www.screencast.com/t/sEFZ0rUM
My plugin code
/**
* @var MagentoFrameworkAppRequestHttp
*/
protected $request;
/**
* @var MagePrashantCheckDeliveryHelperData
*/
protected $helper;
/**
* @var MagentoFrameworkMessageManagerInterface
*/
protected $message;
/**
* Plugin constructor.
*
* @param MagentoCheckoutModelSession $checkoutSession
* @param MagentoFrameworkAppRequestHttp $request
* @param MagePrashantCheckDeliveryHelperData $helper
* @param MagentoFrameworkMessageManagerInterface $message
*/
public function __construct(
MagentoCheckoutModelSession $checkoutSession,
MagentoFrameworkAppRequestHttp $request,
MagePrashantCheckDeliveryHelperData $helper,
MagentoFrameworkMessageManagerInterface $message
)
$this->quote = $checkoutSession->getQuote();
$this->request = $request;
$this->helper = $helper;
$this->message = $message;
/**
* beforeAddProduct
*
* @param $subject
* @param $productInfo
* @param null $requestInfo
*
* @return array
* @throws LocalizedException
*/
public function beforeAddProduct($subject, $productInfo, $requestInfo = null)
$postcode = $this->request->getParam('postcode');
print_r($postcode);
//Null
print_r($this->request->getParams());
//Array ( [uenc] => aHR0cDovLzEyNy4wLjAuMS9QZXRzeS9wZWRpZ3JlZS1wdXBweS1taWxrLWFuZC12ZWdldGFibGUuaHRtbA,, [product] => 59 [selected_configurable_option] => [related_product] => [item] => 59 [form_key] => BIYNJmVlffX0A95H [super_attribute] => Array ( [140] => 10 ) [qty] => 1 )
}
php validation plugins magento2 pin-code
add a comment |
In magento 2.2.7 when AddToCart button is clicked i need to
validate Delivery Postcode field.Only if the customer enter the
correct post code the product should added to the cart.The Delivery Postcode is a separate extension. Inside the extension
i wrote before plugin (using beforeAddProduct class)and try to get
the postcode parameter but i am unable to do so, but i can able to
get the product related parameter.For ex. product quantity i can
able get. Can you please guide me how to get the postcode value
inside the plugin?Extension Folder structure :https://www.screencast.com/t/AP1nr6cPkWvn
My template code :https://www.screencast.com/t/sEFZ0rUM
My plugin code
/**
* @var MagentoFrameworkAppRequestHttp
*/
protected $request;
/**
* @var MagePrashantCheckDeliveryHelperData
*/
protected $helper;
/**
* @var MagentoFrameworkMessageManagerInterface
*/
protected $message;
/**
* Plugin constructor.
*
* @param MagentoCheckoutModelSession $checkoutSession
* @param MagentoFrameworkAppRequestHttp $request
* @param MagePrashantCheckDeliveryHelperData $helper
* @param MagentoFrameworkMessageManagerInterface $message
*/
public function __construct(
MagentoCheckoutModelSession $checkoutSession,
MagentoFrameworkAppRequestHttp $request,
MagePrashantCheckDeliveryHelperData $helper,
MagentoFrameworkMessageManagerInterface $message
)
$this->quote = $checkoutSession->getQuote();
$this->request = $request;
$this->helper = $helper;
$this->message = $message;
/**
* beforeAddProduct
*
* @param $subject
* @param $productInfo
* @param null $requestInfo
*
* @return array
* @throws LocalizedException
*/
public function beforeAddProduct($subject, $productInfo, $requestInfo = null)
$postcode = $this->request->getParam('postcode');
print_r($postcode);
//Null
print_r($this->request->getParams());
//Array ( [uenc] => aHR0cDovLzEyNy4wLjAuMS9QZXRzeS9wZWRpZ3JlZS1wdXBweS1taWxrLWFuZC12ZWdldGFibGUuaHRtbA,, [product] => 59 [selected_configurable_option] => [related_product] => [item] => 59 [form_key] => BIYNJmVlffX0A95H [super_attribute] => Array ( [140] => 10 ) [qty] => 1 )
}
php validation plugins magento2 pin-code
In magento 2.2.7 when AddToCart button is clicked i need to
validate Delivery Postcode field.Only if the customer enter the
correct post code the product should added to the cart.The Delivery Postcode is a separate extension. Inside the extension
i wrote before plugin (using beforeAddProduct class)and try to get
the postcode parameter but i am unable to do so, but i can able to
get the product related parameter.For ex. product quantity i can
able get. Can you please guide me how to get the postcode value
inside the plugin?Extension Folder structure :https://www.screencast.com/t/AP1nr6cPkWvn
My template code :https://www.screencast.com/t/sEFZ0rUM
My plugin code
/**
* @var MagentoFrameworkAppRequestHttp
*/
protected $request;
/**
* @var MagePrashantCheckDeliveryHelperData
*/
protected $helper;
/**
* @var MagentoFrameworkMessageManagerInterface
*/
protected $message;
/**
* Plugin constructor.
*
* @param MagentoCheckoutModelSession $checkoutSession
* @param MagentoFrameworkAppRequestHttp $request
* @param MagePrashantCheckDeliveryHelperData $helper
* @param MagentoFrameworkMessageManagerInterface $message
*/
public function __construct(
MagentoCheckoutModelSession $checkoutSession,
MagentoFrameworkAppRequestHttp $request,
MagePrashantCheckDeliveryHelperData $helper,
MagentoFrameworkMessageManagerInterface $message
)
$this->quote = $checkoutSession->getQuote();
$this->request = $request;
$this->helper = $helper;
$this->message = $message;
/**
* beforeAddProduct
*
* @param $subject
* @param $productInfo
* @param null $requestInfo
*
* @return array
* @throws LocalizedException
*/
public function beforeAddProduct($subject, $productInfo, $requestInfo = null)
$postcode = $this->request->getParam('postcode');
print_r($postcode);
//Null
print_r($this->request->getParams());
//Array ( [uenc] => aHR0cDovLzEyNy4wLjAuMS9QZXRzeS9wZWRpZ3JlZS1wdXBweS1taWxrLWFuZC12ZWdldGFibGUuaHRtbA,, [product] => 59 [selected_configurable_option] => [related_product] => [item] => 59 [form_key] => BIYNJmVlffX0A95H [super_attribute] => Array ( [140] => 10 ) [qty] => 1 )
}
php validation plugins magento2 pin-code
php validation plugins magento2 pin-code
edited Apr 4 at 17:01
Arul
asked Mar 28 at 7:30
ArulArul
451 silver badge10 bronze badges
451 silver badge10 bronze badges
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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/4.0/"u003ecc by-sa 4.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%2fstackoverflow.com%2fquestions%2f55392236%2fhow-to-get-parameter-value-from-template-phtml-file-to-plugin-php-file-in-magent%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- 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%2fstackoverflow.com%2fquestions%2f55392236%2fhow-to-get-parameter-value-from-template-phtml-file-to-plugin-php-file-in-magent%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