2
votes
Accepted
Magento 2: How can we prevent HTML from being shown in the text that comes from en_US.csv file?
Short answer is no way with translation
In templates where used this translation it will be escaped
For example in default success template
vendor/magento/module-checkout/view/frontend/templates/...
2
votes
The use of helpers in templates is discouraged. Use ViewModel instead warning in magento 2
We all know Helpers from the days of Magento 1. Helpers are classes that provide functionalities for various features throughout the Magento website. Available for use anywhere on the website, Magento ...
2
votes
Magento 2: how to specify the module name in custom theme?
Override the Module changes in the Theme customization by using the Module name as a directory under the Theme vendor.
etc/module.xml
We can use either Module name as directory from etc/module.xml
<...
2
votes
Accepted
How to get Data from system.xml file
You should pass system.xml data to customer by CompositeConfigProvider.
define CompositeConfigProvider in your di.xml file
app/code/{{Vendorname}}/{Modulename}/etc/frontend/di.xml
<?xml version=&...
1
vote
Magento 2: Override model class
Please replace your constructor code with the below code.
public function __construct(
OrderFactory $orderFactory,
CustomerCartResolver $customerCartProvider,
GuestCartResolver $...
1
vote
Override ShippingMethodMangement.php
You have typo error in preference definition
Magento\Quote\Model\ShippingMethodMangement <- incorrect (missed a)
Magento\Quote\Model\ShippingMethodManagement <- correct
Better way to overwrite ...
1
vote
How to move attributes above product tabs
Try below code in your catalog_product_view.xml
<move element="product.attributes" destination="content" before="product.info.overview" />
1
vote
How to reinstall magento 2 extension properly?
For a module installed with composer:
# uninstall the module
bin/magento module:uninstall Vendor_ModuleName
# reinstall the module, given that it is still defined in composer.json
composer install
...
1
vote
Implement appointment slot booking with payment option
It's a really and don't so hard to implement on Magento end and make sense to do if you already has everything built on Magento.
I think best one option is implement custom product type based on ...
1
vote
Get current Date and time on frontend
It's 2 general ways:
// current time or any time in UTC
$now = new \DateTime('now', new \DateTimeZone('UTC'));
// instances
$timezone = \Magento\Framework\App\ObjectManager::getInstance()
->...
1
vote
Get current Date and time on frontend
Use below code.
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
class Yourclass extends AbstractClass
{
protected $timezoneInterface;
public function __construct(
...
...
1
vote
Get current Date and time on frontend
Please try below code.
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$timezone = $objectManager->create('Magento\Framework\Stdlib\DateTime\TimezoneInterface');
$today = $...
1
vote
Magento 2 - How to add color picker in admin configuration options?
In 2022, you can just return <input type="color"> in Block/Color.php
protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
{
return '<...
1
vote
Accepted
How can I intercept a sale order created from within the admin panel in Magento 2?
You can use an admin authentication session for this:
An example with a plugin for \Magento\Sales\Api\OrderManagementInterface:
Acme/StackExchange/Plugin/Sales/Api/OrderManagementInterfacePlugin.php
&...
1
vote
Accepted
Magento 2 : How to correctly return 401 unauthroized in graphql request
There is no way to do so without modifying (create a plugin, observer or overwrite) the basic Magento controller responsible for GraphQL.
You can check how it is realised in Magnento in the vendor/...
1
vote
Accepted
How to get vendor_module/view/frontend/web/images path within Setup/Patch script?
You don't need to create any Setup/Patch scripts
For create your own extension you just need to create 2 files in module
Create registration.php
<?php
declare(strict_types=1);
use Magento\...
1
vote
Accepted
Send order update email programatically?
You need to use \Magento\Sales\Model\Order\Email\Sender\OrderCommentSender
1
vote
Accepted
Magento 2.4.4 order export csv wrong data
I have fixed using this, try.
File name :Magento\Ui\Model\Export\MetadataProvider
public function getRowData(DocumentInterface $document, $fields, $options): array
{
$row = [];
...
1
vote
Magento 2.4.4 order export csv wrong data
Just checked in version 2.4.3 and 2.4.4 and both versions works correct for Order and export into CSV
First: check your locale in configuration
Second: check the date in database (sales_order)
How and ...
1
vote
Magento 2.4.4 order export csv wrong data
Magento will export the created date in UTC. if your store use another timezone, the time will be diffrent in the order grid (timezone of your store) and in the exported csv.
To get the order created ...
1
vote
How i can Create CustomLog File When I Add Product to Cart
Let's split the requirement into 2 parts.
Create Custom log file.
Add Observer to catch the Add to cart event and use the custom log file in the observer
Create handler.php to define the path and ...
1
vote
How i can Create CustomLog File When I Add Product to Cart
There is an event observer when a product is added to cart, please implement the event observer, the event name is - "checkout_cart_add_product_complete", please check out this link about ...
1
vote
Accepted
main.CRITICAL: Exception: Deprecated Functionality: array_key_exists(): Using array_key_exists() on objects is deprecated
Since PHP 7.4 the function array_key_exists allows only array and doesn't support ArrayObject anymore
The method getPost from Request returns \Laminas\Stdlib\Parameters which extends from ArrayObject
...
1
vote
How to set meta title dynamically for specific category in magento 2
I suggest to use the similar logic like described in https://magento.stackexchange.com/a/357049/91782
You need to create plugin for \Magento\Catalog\Block\Category\View and modify metadata on ...
1
vote
How can I get if is in this table 'catalog_product_entity_text' Use Default value on product Magento 2
Magento doesn't store any flags like use default
Magento EAV value tables designed with following rules:
Row with store_id=0 means default or fallback value
Row with store_id=1 means value for store
...
1
vote
How to change the favicon logo on the browser to open pdf files in Magento 2
I found a solution. I will share it here if anyone needs it
Let's create a file called favicon.ico and add it to the index.php file the directory Magento is pointing to may have a cache and you need ...
1
vote
Accepted
Magento2.4: How to get Salable quantity in list.phtml file?
Try This Code
app/code/VendorName/ModuleName/etc
di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation=...
1
vote
Magento 2 - Customer Type Table SQL
This is too vague question to advise anything concrete.
Customer model is based on EAV(Entity Attribute Value) and related customer data stored in tables like customer_entity_*
EAV metadata for link ...
1
vote
Accepted
How to add yotpo review to custom page: magento2
Please try this one and for information please visit the below blog :
https://support.yotpo.com/en/article/display-empty-stars-on-category-pages#adobe-commerce-formerly-magento-2
<!-- Yotpo's Star ...
1
vote
Magento 2: Open Popup Modal on Button Click in Admin Grid
Add component in column in grid layout file and add js and class file path
<column name="goflyy_order_id" class="Vendor\Module\Ui\Component\Listing\Column\Goflyy">
<...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
magento2 × 45679magento-2.1 × 2411
magento2.3 × 1946
product × 1781
checkout × 1720
php × 1425
module × 1321
layout × 1171
admin × 1148
javascript × 1136
database × 1130
magento2.2 × 958
uicomponent × 944
category × 872
customer × 852
api × 796
event-observer × 784
cart × 762
orders × 739
theme × 710
rest-api × 701
product-attribute × 681
error × 669
attributes × 664
blocks × 664