diazwatson
  • Member for 7 years, 11 months
  • Last seen this week
6 answers
61 votes
55k views
Magento 2: Changing a Block's Template
18 votes

The following worked for me in Magento EE 2.2.3 <?xml version="1.0"?> <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/...

View answer
2 answers
9 votes
16k views
Magento2: How to convert JSON to Array of nested objects
17 votes

\Magento\Framework\Json\Helper\Data is deprecated since Magento 100.2.0 You could use \Magento\Framework\Serialize\Serializer\Json instead. Ie. public function __construct( \Magento\...

View answer
2 answers
6 votes
8k views
How to Add a viewModel to a core block?
Accepted answer
9 votes

It is possible and it works as expected! The reason why it was not working was because I was not implementing the right interface in my viewModel class. All viewModels need to to implement ...

View answer
5 answers
147 votes
11k views
How to write a custom extension?
9 votes

@marius, regarding Coding Standards (point 24 in your list). I like to use PHP_CodeSniffer along with EQP and ECG CS to automatically enforce these standards. Using PHP_CodeSniffer you don't have ...

View answer
3 answers
0 votes
442 views
Is any Payment Gateway exits for overseas customer pay as a dollar for my INR (INDIA) currency based websites
6 votes

I did a bit of research about it and this is what I understand. Unfortunately PayPal does not seem to be accepted in India to pay in INR. You can use PayPal in India if you want to sell your ...

View answer
4 answers
1 votes
11k views
Magento Programmatically Customer Group Create and Update
6 votes

I also needed to create a customer group programmatically. In my case I used an update script to do so. Code as follow: /* @var $installer Mage_Customer_Model_Resource_Setup */ $installer = $this; $...

View answer
1 answers
8 votes
3k views
Delta Delivering Failed - Deltalog for customer_entity, is not installed in Magento 2
Accepted answer
5 votes

In order to run bin/magento migrate:delta step you first need to run the bin/magento migrate:data step because it is in this step where the Data Migration Tool creates triggers in the source database. ...

View answer
1 answers
7 votes
5k views
Add an image product attribute in Magento 2 in module setup
5 votes

You can add and extra attribute image to product entity using an InstallData / UpgradeData file in your module. Have a look to the following example: <?php // vendor/ModuleName/Setup/InstallData....

View answer
3 answers
2 votes
2k views
The use of function pathinfo() is discouraged Magento 2
4 votes

You can use Magento\Framework\Filesystem\Io\File instead. Example: <?php namespace Vendor\ModuleName\Model; use Magento\Framework\Filesystem\Io\File; class MyClass { /** * @var File ...

View answer
1 answers
3 votes
605 views
Migrate Magento EE 1.14.3.1 to Magento CE 2.1.7
4 votes

The Data-migration-tool does not come with such functionality out of the box (and I guess it won't ever have) for obvious reasons not to mention the advantages and features you will loose if you ...

View answer
2 answers
1 votes
1k views
How to write database integration tests?
4 votes

Assuming you are using PHPUnit to write integration tests, the first step is to make sure your environment is correctly configured. For that you will need to have an empty database in place and use ...

View answer
2 answers
4 votes
2k views
How to remove particular mass action option from dropdown in Magento2
3 votes

You can also use the actionDisable setting in your custom module, that should disable the option in the dropdown: <massaction name="listing_massaction" component="Magento_Company/js/...

View answer
1 answers
2 votes
959 views
Magento_Integration schema: current version - 2.2.0, required version - 2.0.1
Accepted answer
3 votes

Have a look at setup_module table into the database. You should see something similar to this: In order to fix it, set the values manually to 2.0.1 for both schema and data and then try to upgrade ...

View answer
4 answers
27 votes
77k views
Magento 2 - How to get all items in cart?
2 votes

Like @Frank says Magento\Checkout\Model\Cart was deprecated in version 100.1.0 Another option is to use a Proxy and benefit from the performance optimization Here is how: public function __construct(...

View answer
4 answers
6 votes
4k views
Magento 2: How to add color picker in ui form
2 votes

There is already a colorPicker Component defined in the core. vendor/magento/module-ui/view/base/ui_component/etc/definition/colorPicker.xsd Try adding this to your form: <colorPicker name="...

View answer
5 answers
7 votes
18k views
Magento 2 saving update product in "All Store Views"
2 votes

@Silas Palmer solution seems a better approach to me to solve your issue, but if you still have issues setting the default store id, you set the store id using an observer on ...

View answer
3 answers
9 votes
2k views
Correct way to obtain a session object?
2 votes

As the warning indicates: Session object MUST NOT be requested in the constructor You should use proxies instead. You can find out more about proxy objects here: http://devdocs.magento.com/guides/...

View answer
1 answers
3 votes
4k views
payment-information 400 bad request when product quantity is bigger (or equal) than 3
2 votes

The original message is being overwritten as you can see in here: $this->savePaymentInformation($cartId, $email, $paymentMethod, $billingAddress); try { $orderId = $this->...

View answer
2 answers
1 votes
2k views
magento 2 : Enable maintenance mode frontend only?
2 votes

If yow want to prevent customers to use the site while you carry on making changes in the admin you could whitelist your IP(s): $ bin/magento maintenance:enable --ip="{your-ip-here}"

View answer
2 answers
1 votes
771 views
Magento 2.1: How to get Guest billing address on success.phtml
2 votes

First of all, I would not recommend to use ObjectManager as it is considered bad practice. Regarding your question, and instead of using the success.phtml to get the billing address, you could use ...

View answer
3 answers
2 votes
1k views
Check when custom cron task last ran
Accepted answer
2 votes

As @william-oakley suggested and unless you need to stick to the lastRunTime approach for some reason, it would be more robust to read and log which orders have been exported rather than rely on the ...

View answer
2 answers
2 votes
171 views
Is there anything wrong with keeping Magento 2 in Developer Mode?
2 votes

Keeping Magento in developer mode is not recommended. Instead I would recommend you to debug the issue until you find what is wrong and fixed it. Keeping Magento in Developer Model will: Slow down ...

View answer
2 answers
7 votes
3k views
Magento 2: How to Change shipping message?
2 votes

As far as I can see this sentence appears in two places: vendor/magento/module-checkout/view/frontend/web/template/shipping.html and vendor/magento/module-checkout/view/frontend/web/template/...

View answer
3 answers
1 votes
552 views
Missing Images with correct url and permissions
Accepted answer
2 votes

Check the following: Make sure mod_rewrite or equivalent is enabled in your web server. Check that .htaccess exists in your root folder (only if your web server is Apache) Check Search Engines ...

View answer
3 answers
3 votes
14k views
Installed magento extension is not showing in admin panel
Accepted answer
2 votes

In addition to @Talesh explanation I would like to mention something that was driving me crazy long ago and I recently saw again: Make sure that the file name in app/etc/modules/[Namespace]_[Module]....

View answer
7 answers
35 votes
42k views
Magento2 - programmatically add product attribute options
1 votes

My two cents here (similar to some of the answers provided): <?php declare(strict_types=1); namespace Acme\Setup\Setup\Patch\Data; use Magento\Customer\Model\Indexer\Address\AttributeProvider; ...

View answer
3 answers
6 votes
4k views
Disable customer attribute in magento admin form
1 votes

Or in more recent versions of Magento... And using @Shankar example You need to create Namespace/Module/view/base/ui_component/customer_form.xml and add the following code <fieldset name="...

View answer
2 answers
0 votes
269 views
How to add Color Picker in Admin Ui Component in Magento 2?
1 votes

There is already a ColorPicker Component defined in the core. vendor/magento/module-ui/view/base/ui_component/etc/definition/colorPicker.xsd Try adding this to your form: <colorPicker name="...

View answer
4 answers
4 votes
2k views
Disabling a UI component field while add new product in Magento 2
1 votes

According to the official docs Modifier classes should be used when you need to add validations to display only certain fields for certain product types and also when static declaration is not ...

View answer
2 answers
0 votes
3k views
Magento 2 : Adding a foreign key of customer_entity in a custom table
1 votes

$setup->getConnection() ->addForeignKey( $setup->getFkName( 'your_custom_table_name', // priTableName '...

View answer