Magento is most popular among the eCommerce platform and has been used over ~30% online stores due to its flexibility and source code availability. Recently we were working a Hotel booking aggregator for one of our clients. There are many hotel Booking Websites but only few are able to increase the traffic on their website because most of the users abandon their cart due to higher pricing. Our client wanted unique service to their customers so that they can negotiate the hotel price based on the situation. We built a new magento realtime pricing offer extension that allows customer and hotel owners to negotiate on the room price of the hotel. In this article, we demonstrated how to build magento realtime pricing in few hours and increase the sales of any ecommerce store?
Steps to build magento realtime pricing option
Step 1: Create Separate module in Magento 2.X
There are two ways to create module in magento 2 :
- Create Module using Online Tools : There are many online tools available to create magento 2 module. We can use the CED Module Creator , because its easy and straight forward.
- Create Module Manually : We can create magento 2 module manually. We need to remember the Folder structure of Magento 2. Please follow this article to create magento 2 module manually.
After create module the folder structure would be like this:
Step 2: Create Block for Realtime Price Offer
We need to create an product block which will define the layout of the Price Offer Feature. Follow the below steps to create product block for magento realtime pricing offer:
- Create the Negotiateprice.php under the Ipragmatech/Pricenegotiator/Block/Catalog/Product and write the function to get the current product which we will use in the View file.
<?php namespace IpragmatechPricenegotiatorBlockCatalogProduct; use IpragmatechPricenegotiatorModelNegotiatorFactory; class Negotiateprice extends MagentoFrameworkViewElementTemplate { protected $_negotiatorFactory; protected $_objectManager; protected $_catalogSession; public function __construct(MagentoFrameworkViewElementTemplateCont ext $context, MagentoFrameworkObjectManagerInterface $objectManager, N egotiatorFactory $negotiatorFactory, MagentoCatalogModelSession $cata logSession, array $data = []) { parent::__construct($context, $data); $this->_objectManager = $objectManager; $this->_negotiatorFactory = $negotiatorFactory; $this->_catalogSession = $catalogSession; } public function getQueryProduct() { $pro = $this->_objectManager->get('MagentoFrameworkRegistry')->registry('current_product'); if ($pro) { return $pro; } else { $productId = $this->_catalogSession->getQPId(); $pro = $this->_objectManager->get('MagentoCatalogModelProduct')->load ($productId); return $pro; } } }
- Create the view file of the block under the Ipragmatech/Pricenegotiator/view/templates/product/view.phtml which contain a form for send realtime query.
Step 3: Extend the product detail Layout
Extend the product detail Layout and add our created block into the product.info.price container. Create the catalog_product_view.xml file under the Ipragmatech/Pricenegotiator/view/frontend/layout directory and write the below code:
After extend the product detail layout would be like this :
Step 4: Create admin block for manage realtime query
The next step is to create an admin block for manage realtime queries. From this block admin will reply to customers for their queries. If admin agree on customers price then admin will create coupon for customer and send in reply.
Looking for ready-made solution
For some of you, it would be difficult to implement above solution but don’t be disappointed. These are the readily available solution which can add realtime pricing feature to your store in few minutes. Some of the solutions are:
- Price Negotiator Extension By Pragmaapps
- Price Bargain Extension By oCodewire
- Magento Price Offer/Bargain
Conclusion
The idea of magento realtime pricing is to increase conversion rate for your store . So in this article, we have demonstrated how to build magento realtime pricing offer in few hours and increase the conversion rate of your online store ? Feel free to contact us if you have any further query.