Need to get name of product from previous page Magento 2.2

by GerPhysio   Last Updated June 21, 2018 15:09 PM

I had a Request A Quote button on certain product pages on my Magento 1.9 site and when clicked, it would bring users to a custom contact form which would have the Product Name field filled in with the name of the product they came from.

I done it in Magento 1.9 using the below on the custom contacts forms .phtml page:

<form method="post">
    <?php $productName = $_POST['productname'];?>

Then using $productName in the field where needed.

How would I achieve this in Magento 2.2?

Answers 1

You can manage it like below:

Create a link with product id like where 4 is the product id.

<a href="">Request A Quote</a>

When user click "Request a Quote" link then it will be redirected to quote page when you can get the product id by request parameter and then you can load the product name and show according to your requirement.

Sukumar Gorai
Sukumar Gorai
June 21, 2018 15:06 PM

Related Questions

Add further checkout form validation Magento 2

Updated October 09, 2018 06:09 AM