Hot answers tagged

17 votes
Accepted

Errors during compilation: AbstractConfigOption.php

Since approx. 2hrs there is a pull request for symfony/console. This will fix that issue. https://github.com/symfony/console/pull/75
user avatar
14 votes

Errors during compilation: AbstractConfigOption.php

I had the same problem tonight. I did a trace to find out which module is causing the problem. I had to downgrade symfony/console to get it to compile. composer require symfony/console=4.4.26 After ...
user avatar
11 votes

Errors during compilation: AbstractConfigOption.php

A temporary fix that I have done taken backup of vendor/symfony/console/Input/InputOption.php file and modify it. After line 48 replace the comment as below before constructor: /** * @param ...
user avatar
  • 749
3 votes

Magento2 EE pagebuilder settings not workiing on custom entity

In my case I needed to add update handles for styles and editor for the layout file: <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:...
user avatar
2 votes
Accepted

Magento 2 - Does magento work with short_open_tag turned off?

Yes*. To try this out I turned off short_open_tag and ran through a few different tasks on a local instance and everything is fine. There are also 0 instances of the short open tag (on my local ...
user avatar
  • 420
2 votes
Accepted

How can I add PHPExcel_IOFactory in my custom module class in Magento 2?

Did you install the package with composer first? Also that library seems to be discontinued (https://packagist.org/packages/phpoffice/phpexcel) and replaced by https://packagist.org/packages/phpoffice/...
user avatar
  • 1,203
2 votes

Errors during compilation: AbstractConfigOption.php

I faced this issue too, downgrading symfony/console works. composer require symfony/console=4.4.26
user avatar
2 votes

Price on product detail page changed to 0.00 magento 2.4.3-p1

I guess you are struggling with a Bug in Magento 2.4.3 which is discussed in a couple of Magento tickets on GitHub (e.g. https://github.com/magento/magento2/issues/33798 ) Solution would be either a ...
user avatar
2 votes
Accepted

Magento 2: Add class to body from PHP

You can achieve your requirement by following steps: Step 1. Create registration.php under app/code/M2Expert/Classes/registration.php with below content: <?php \Magento\Framework\Component\...
user avatar
1 vote
Accepted

Magento 2 - Category url load very slow

Generally Category pages or any page will be slow if following not taken care of : From TTFB perspective or server execution time. Varnish or Full Page cache is used. Also to make sure no block is ...
user avatar
1 vote

Magento 1.9 set exisiting address as default billing and shipping address

Try this code : if(trim($data['postcode']) !='') { $customerAddress = Mage::getModel('customer/address'); $customerAddress->load(trim($data['id']); //ID means address Id $...
user avatar
1 vote
Accepted

Magento 2 get tax class id by product in website scope

You can check this code : $product = $this->getProduct(); $resource = $product->getResource(); $store = $this->_storeManager->getStore(); $resource->getAttributeRawValue($product->...
user avatar
1 vote
Accepted

Change order status for custom module

create app\code\Vendor\Extension\etc\events.xml with the following code. <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:...
user avatar
1 vote
Accepted

Issue: Magento import limited to 100 records

The problem is that your code is trying to overwrite a registry value, and this causes an error in Magento. Look for every instance in your codebase where register('movement_data') exists (both single ...
user avatar
1 vote
Accepted

Do a action before insert products by endpoint magento 2

I think what you're looking for is catalog_product_save_before. This event gets called for every product save action, including new products. In order to use it you could do the following in your ...
user avatar
  • 2,498
1 vote

Do a action before insert products by endpoint magento 2

For this one you need to understand the magento flow. Your above API call this service class. <service class="Magento\Catalog\Api\ProductRepositoryInterface" method="save"/&...
user avatar
1 vote
Accepted

Detect IE11 browser and show cms block modal with phtml script tag

Scripts in CMS Blocks sounds like something that Magento would block. If it is just the content of the "dontuseie" block that needs to be admin-editable, you could: Render that block in a ...
user avatar
  • 602
1 vote
Accepted

array_search() PHP fucntion not working on array

You must use json_encode with the second parameter set true, so that it returns an associative array otherwise it will return an array of objects. In your case it will return a multidimensional array. ...
user avatar
  • 126
1 vote
Accepted

How can I get the url of my new module?

Your module URL will load based on the "BaseUrl/frontName/controllerName/actionName" So as per your module code, frontName = unit3helloworldblock controllerName = Block actionName = Index ...
user avatar
1 vote
Accepted

magento 2.3.6 - Error: cannot call methods on priceBox prior to initialization

It sounds like the PriceBox jQuery widget hasn't been initialised yet. From looking through the code it appears this is how it is initialised on the product page: <script type="text/x-magento-...
user avatar
  • 15.2k
1 vote
Accepted

Magento 2 Insert / Move page.main.title inside my custom block

use getChildHtml('page.main.title'); to display it in your block "my.block" echo $block->getChildHtml('page.main.title'); OR add it after tag <referenceBlock name="page.main....
user avatar
1 vote
Accepted

Magento 2.4 - PayPal Smart Button Style

No need to create preference, we can use type create: app/code/Vendor/Extension/etc/di.xml <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation=&...
user avatar
  • 5,346
1 vote
Accepted

Magento 2 - How I can rewrite this file

create di.xml file on following location app\code\Vendor\Extension\etc\frontend\di.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"...
user avatar
1 vote

Magento 1.9 update street adress line 2 via PHP

to update Street1 and Street2 fields you just need to provide an array: $address->setStreet(['123 Main Street', 'Street 2']);
user avatar
  • 354
1 vote

Magento2: Importing additional images programatically - PHP error

Final code looks like this now, thanks! Still getting the other error though, but I will mark your answer as correct and post another question. Think it's permissions. <?php ini_set('...
user avatar
1 vote

Magento 2 | Item with the same ID already exists when join tables

My solution was different because I really needed that duplicates. I removed the original ID field from the request (by removing all the columns from the select): $select = $collection->getSelect();...
user avatar
1 vote
Accepted

php.ini on magento cloud readonly

For magento cloud, the production is in read-only mode. You have to change & push the codechanges from lower environments (staging, integration, etc) into production. Another option is to set the ...
user avatar
1 vote

Magento 2.4.2 composer install PHP extension errors

In case anyone searching for php8.1 ヅ sudo apt-get install php8.1-opcache php8.1-pdo php8.1-calendar php8.1-ctype php8.1-dom php8.1-exif php8.1-ffi php8.1-fileinfo php8.1-ftp php8.1-gettext php8.1-...
user avatar
1 vote

\Magento\Framework\Registry deprecated in magento 2.3, How to create instance with Registry?

The correct way of getting the current product on PDP page without using registry class is to use Catalog Helper class. public function __construct( \Magento\Catalog\Helper\Data $catalogHelper ...
user avatar
  • 428
1 vote

Magento 2.1 update special price dates programmatically

The following code should do the trick -: $dateValue = '2022-04-08' $value = date('Y-m-d', strtotime($dateValue)); /* Magento\Catalog\Model\ProductRepository */ $product = $this->...
user avatar

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