I have added a new field(tertiary_user_field) in the database table admin_user using the following. 1)Vendor/Module/etc/db_schema.xml 2)Vendor/Module/etc/adminhtml/di.xml 3)Vendor/Module/Plugin/Block/Adminhtml/User/Edit/Tab/Main.php OUTPUT:
Author: Abin Devasia
Get Invoice details by order id programmatically Magento 2
You can get the invoice data for the specific order by order id in Magento 2. Using Magento\Sales\Api\InvoiceRepositoryInterface interface, you need to use getList() function to fetch no. of invoice by sales order id. Using SearchCriteriaBuilder Class, You need to filter by order id and pass search criteria object to getList() method of InvoiceRepositoryInterface. <?php namespace Path\To\Class; use Exception; use Psr\Log\LoggerInterface; use Magento\Sales\Api\Data\InvoiceInterface;… Continue reading Get Invoice details by order id programmatically Magento 2
Method to Get Order Information By Order Id in Magento 2
With the below solution, you can get the order details like order items, order amount, location of the order delivery, order payment method, billing details, quantity, and the customer name. $orderId = 123; $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $order = $objectManager->create(‘\Magento\Sales\Model\OrderRepository’)->get($orderId); // Get Order Information $order->getEntityId(); $order->getIncrementId(); $order->getState(); $order->getStatus(); $order->getStoreId(); $order->getGrandTotal(); $order->getSubtotal(); $order->getTotalQtyOrdered(); $order->getOrderCurrencyCode(); //… Continue reading Method to Get Order Information By Order Id in Magento 2
How to Set Up Special Price Magento 2
To Set Up Special Prices in Magento 2: 1. Navigate to Catalog > Products and choose the product you want to configure the special price for. 2. Scroll down to the Price field and click on Advanced Pricing. 3. Enter the Special Price you want customers to see during the sale period. 4. Set up the Special Price From and To date to define the time when the special price… Continue reading How to Set Up Special Price Magento 2
Fetching API response using the CURL function
How to get product collection by product SKU in Magento 2?
You can get product data by product SKU in Magento 2 by below code snippets, <?php namespace Rbj\Training\Block; class Product extends \Magento\Framework\View\Element\Template { /** * Constructor * * @param \Magento\Framework\View\Element\Template\Context $context * @param array $data */ public function __construct( \Magento\Framework\View\Element\Template\Context $context, \Magento\Catalog\Api\ProductRepositoryInterface $productRepository, array $data = [] ) { $this->productRepository = $productRepository; parent::__construct($context, $data); } /** *… Continue reading How to get product collection by product SKU in Magento 2?
How to write HTML code inside
You can do like HTML in PHP : Or You can write like. PHP in HTML : <?php /*Do some PHP calculation or something*/ ?> Means:You can open a PHP tag with <?php, now add your PHP code, then close the tag with ?> and then write your HTML code. When needed to add more PHP, just open another… Continue reading How to write HTML code inside
How to Open Bootstrap Modal Popup on Button Click Using jQuery
HTML code JQuery $(document).ready(function(){$(‘#MybtnModal’).click(function(){$(‘#Mymodal’).modal(‘show’)});});
How to convert an Object manager to Block?
To get the source list, I am using object manager directly in my phtml template, but I read in docs that we should not use it directly. $objectManager = \Magento\Framework\App\ObjectManager::getInstance();$sourceList = $objectManager->get(‘\Magento\Inventory\Model\ResourceModel\Source\Collection’);$sourceListArr = $sourceList->load();foreach ($sourceListArr as $sourceItemName) {$sourceCode = $sourceItemName->getSourceCode();$sourceName = $sourceItemName->getName();} Solution: create a block for fetching the source collection. Then call the function… Continue reading How to convert an Object manager to Block?
DOMPDF: HTML to PDF converter for PHP
dompdf is (mostly) a CSS 2.1-compliant HTML layout and rendering engine written in PHP. It is a style-driven renderer: it will download and read external stylesheets, inline style tags, and the style attributes of individual HTML elements. It also supports most presentational HTML attributes. Limitations (Known Issues) Table cells are not pageable, meaning a table… Continue reading DOMPDF: HTML to PDF converter for PHP