The Stack Overflow podcast is back! Listen to an interview with our new CEO.
5

I solved it by override TransportBuilder. It has many private methods that's why I override whole class. You need only this one file. app/code/vendor/module/etc/di.xml <preference for="\Magento\Framework\Mail\Template\TransportBuilder" type="Vendor\Module\Model\Mail\Template\TransportBuilder" /> app/code/vendor/module/model/mail/template/...


4

You can create UpgradeSchema.php file in your module and add below content in that file app/code/Vendor/Module/Setup/UpgradeSchema.php <?php namespace Vendor\Module\Setup; use Magento\Framework\Setup\UpgradeSchemaInterface; use Magento\Framework\Setup\ModuleContextInterface; use Magento\Framework\Setup\SchemaSetupInterface; class UpgradeSchema ...


3

You can run this step-by-step to check the possible things. Run this command to get the Magerun2 to made the changes easier. wget https://files.magerun.net/n98-magerun2.phar && chmod +x ./n98-magerun2.phar && alias n98="./n98-magerun2.phar" Run this command to see if there is some additional base URL in your configurations that aren't ...


2

di.xml App/code/Vendor/Module/etc/frontend <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Vendor\Module\Model\ConfigProvider"> <arguments> <argument name="blockId" xsi:...


2

In Your Module try this in Vendor/HelloWorld/Model/ProductReviews.php <?php namespace Vendor\HelloWorld\Model; use Magento\Framework\Model\AbstractModel; class ProductReviews extends AbstractModel{ protected $_ratingFactory; protected $_productFactory; protected $_ratingFactory; protected $_reviewFactory; public function ...


2

If you want to add CSS only for my account page title then you can add below css .account.customer-account-index .page-title{ /*css code write here*/ }


2

You can override this file vendor/magento/framework/Logger/Handler/System.php here in this directory.. lib/internal/Magento/Framework/Logger/Handler/System.php Hope this will help you!


2

You can unselect it. For that first select any single country option there and then click on that option with CTRL key, after that you can save configuration and clear/flush cache using below commands php bin/magento cache:clean php bin/magento cache:flush Hope this will help you!


2

You can add below line in your csv file here app/design/frontend/Vendor/Theme/i18n/en_US.csv "You submitted your review for moderation.","Thanks, you submitted your review." If any spell mistake is there in your text then your translation will not work. In your case, Can you please check spelling of moderation ? You've added moderdation that may be ...


2

You can update your magento version using following command composer require magento/product-community-edition=2.3.3 --no-update and then composer update after composer update finished run setup:upgrade Ref: Dev docs


2

Please check __construct() in this file. Vendor\Magento\Block\Adminhtml\Module\Edit\Renderer\CustomField.php <?php namespace Vendor\Magento\Block\Adminhtml\Module\Edit\Renderer; class CustomField extends \Magento\Framework\Data\Form\Element\AbstractElement { protected $_blockFactory; public function __construct( \Magento\Framework\...


2

you want to use product CollectionFactory <?php namespace Vendor\Yourmodule\Block; class ProductCollection extends \Magento\Framework\View\Element\Template { protected $_productCollectionFactory; public function __construct( \Magento\Backend\Block\Template\Context $context, \Magento\Catalog\Model\ResourceModel\...


2

You can add filter like this.. protected $_product; public function __construct( \Magento\Catalog\Model\Product $product ) { $this->_product = $product; } public function execute() { $productCollection = $this->_product->getCollection()->addAttributeToFilter('brand', array('eq' => 'test')); } You can change your condition in ...


2

Load product collection with specific attribute $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $productCollectionFactory = $objectManager->get('\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory'); $collection = $productCollectionFactory->create(); $collection->addAttributeToSelect('*'); $collection->...


2

Whenever you will get blank page (white screen), you can just uncomment below line in this file. app/bootstrap.php #ini_set('display_errors', 1); Remove # sign in this line.. ini_set('display_errors', 1); You'll get error message on your screen after doing this. Hope this will help you!


2

I assume, In Category page you are trying to sort by the price and not getting the correct order while you want your prices to be displayed as well as used in sorting. etc/frontend/di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/...


2

You want to update checkUniqueOption() this function and because of that function is private you need to rename this as _checkUniqueOption() or something else, and in that file there are some other functions which are also private so you need to do same thing for that all functions as well. So your new Controller file's content will be : Vendor/Module/...


2

routes.xml file in /app/code/Vendor/Module/etc/adminhtml <?xml version="1.0"?> <!-- ~ Copyright © BrainActs Commerce OÜ. All rights reserved. ~ See LICENSE.txt for license details. --> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:App/etc/routes.xsd"> <router ...


2

a) Yes, it is bad practice b) Yes, it is purely to maintain backward compatibility :)


2

I have searched over the web and didn't find something that can solve your problem, but I think such kind of feature will be very useful, so I've written my own solution for this problem: module-translation-helper you can install it by composer: composer require underser/module-translation-helper:v0.2.3-beta *don't forget update your composer.json ...


2

You can override from vendor/magento/module-checkout/view/frontend/web/template/shipping-address/address-renderer/default.html to app/design/frontend/Vendor/Module/Magento_Checkout/web/template/shipping-address/address-renderer/default.html <!-- /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ --&...


2

After lot's of debug found that This issue in Magento 2.3.3 Default version. In order to prevent this bug on 2.3.3, you need to update "vendor\magento\module-store\etc or override : magento2/app/code/Magento/Store/etc/di.xml and comment to hashGenerator then the store switcher works for logged in customers. Before <type name="Magento\Store\Model\...


2

get the productdata by id or sku i am using getbyId $productData = $this->productRepository->getById($productId); $attributeValue = $productData->getAttributeText("attribute_code");//pass your attribute code


2

Try Below way.. You can do it with layout <referenceContainer name="before.body.end"> <block class="\Magento\Framework\View\Element\Template" template="You_Module::js.phtml" name="module_js"/> </referenceContainer> and in js.phtml <scrip src="example.com/jp2/test.js" /> Or <reference name="before_body_end">...


1

You can create a checkout_index_index.xml in your module or theme, then add it via an uiComponent, as you can see in this example below. <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> <body> <...


1

use magento2 Sections with knockout js MAGENTO2 SECTIONS


1

Read your code。 You are not using Knockoutjs, if it is just normal validation behavior, then: Add the disabled attribute to the select control using jquery's attr method. Hope can help you。


1

go to bootstrap.php which will be in app/bootstrap.php (nano app/bootstrap.php) and uncomment the #ini_set('display_errors', 1);line in the sense it will be like ini_set('display_errors', 1); it will help you to show error message in front-end and fix the error.Happy coding fell free to drop any comments


1

Magento updated the AbstractExtensibleObject::_getExtensionAttributes method to generate a empty object if it has no extension attributes https://github.com/magento/magento2/commit/375132a81b95fafa4a03a17b72dbacdc90afa745#diff-56d044692f579051647a8284ff39cc0eR165 so it will never return null. They do still need to update the API annotation though, e.g. in ...


1

You have to create a rest API endpoint. Your route has to call a service with a method. Then, make a preference for your API Class to your Model. Then in your Model save your data <route url="/V1/products" method="POST"> <service class="Magento\Catalog\Api\ProductRepositoryInterface" method="save"/> <resources> ...


Only top voted, non community-wiki answers of a minimum length are eligible