How to get a URL parameter in the Magento controller?

If your URL is the following structure: http://yoursiteurl.com/index.php/admin/sales_order_invoice/save/order_id/1795/ then use: If you want to get All Url Value or Parameter value then use the below code. If your URL is like this: http://magentoo.blogspot.com/magentooo/userId=21 then use this to get the value of the URL

Published
Categorized as Magento

Magento 2 Getting Image URL for template files and CMS Blocks.

Just a quick note on how to get image URLs in both template files and cms blocks for Magento 2. For template files: Images in Vendor/theme/Vendor_Module/web/images or app/code/Vendor/Module/view/frontend/web/images/ or if images are in Vendor/theme/web/images/ For CMS Static Blocks or Pages: Images in Vendor/theme/Vendor_Module/web/images or app/code/Vendor/Module/view/frontend/web/images/ or if images are in Vendor/theme/web/images/

Published
Categorized as Magento

Generate PDF programmatically in Magento2

we can apply the following code according to our requirements in any file, i.e. block, controller, model, helper, etc. <?php namespace Company\Module\Controller\Index; use Magento\Framework\App\Action\Action; use Magento\Framework\App\Action\Context; class Index extends Action { /** * @var \Magento\Framework\App\Response\Http\FileFactory */ protected $fileFactory; /** * @param Context $context */ public function __construct( Context $context, \Magento\Framework\App\Response\Http\FileFactory $fileFactory ) { $this->fileFactory =… Continue reading Generate PDF programmatically in Magento2

Published
Categorized as Magento

How to Remove a Link from My Account Menu

To remove a link from the My Account Menu, add the customer_account.xml layout via JJ/Statements/view/frontend/layout/customer_account.xml with the following content: <?xml version=”1.0″?> <!– /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ –> <page xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:framework:View/Layout/etc/page_configuration.xsd”> <referenceBlock name=”block_name” remove=”true”/> </page>

Published
Categorized as Magento

How to remove white space around product image in Magento 2

write the code on etc>view.xml <transparency>false</transparency> <aspect_ratio>false</aspect_ratio> <frame>false</frame> example: <image id=”category_page_list” type=”small_image”> <width>240</width> <height>300</height> <transparency>false</transparency> <aspect_ratio>false</aspect_ratio> <frame>false</frame> </image>

Published
Categorized as Magento

Method to Disable Compare Products in Magento 2:

Create default.xml file in Vendor/Extension/view/frontend/layout  and copy the below code: <page xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xsi:noNamespaceSchemaLocation=”urn:magento:framework:View/Layout/etc/page_configuration.xsd”> <body> <referenceBlock name=”catalog.compare.link” remove=”true” /> <referenceBlock name=”catalog.compare.sidebar” remove=”true”/> <referenceBlock name=”catalogsearch.product.addto.compare” remove=”true”/> <referenceBlock name=”category.product.addto.compare” remove=”true”/> <referenceBlock name=”crosssell.product.addto.compare” remove=”true” /> <referenceBlock name=”related.product.addto.compare” remove=”true” /> <referenceBlock name=”upsell.product.addto.compare” remove=”true” /> <referenceBlock name=”view.addto.compare” remove=”true” /> </body> </page>

Published
Categorized as Magento