TypeError: Illegal offset type in isset or empty

when trying to export to CSV, i get TypeError: Illegal offset type in isset or empty in vendor/magento/module-ui/Model/Export/MetadataProvider.php:174

line 174 is if (isset($options[$column][$key])) {

public function getRowData(DocumentInterface $document, $fields, $options): array { $row = []; foreach ($fields as $column) { if (isset($options[$column])) { $key = $document->getCustomAttribute($column)->getValue(); if (isset($options[$column][$key])) { $row[] = $options[$column][$key]; } else { $row[] = ''; } } else { $row[] = $document->getCustomAttribute($column)->getValue(); } } return $row; } 

any help with this?

submitted by /u/atherakber
[link] [comments]

When to use Extension Attributes instead of Custom Attributes?

It seems that both Custom Attributes and Extension Attributes can be used to add fields to entities. What should a developer consider when choosing between the two?

It seems that Custom Attribute fields may just “appear” on the backend, but will not just “appear” on the frontend in Magento Open Source. But they can be added to the frontend by editing the PHTML files I believe. Can Extension Attributes be presented on both the frontend and the backend? Will they just “appear” in either location? If not, how are they added to the PHTML fields? What must be done to get them to appear in the backend? How about Customers’ personal dashboards?

For instance, consider a text field on a Customer Address. This field should appear in the following Forms:

  1. Checkout Guest
  2. Checkout Logged In (Store New Address)
  3. Customer Dashboard -> Address Book -> Add New Address (customer_address_new)
  4. Customer Dashboard -> Address Book -> Edit Address (customer_address_edit)
  5. Admin Dashboard: Customers -> All Customers -> Edit -> Address tab (customer_index_edit)
  6. Admin Dashboard: Sales -> Orders -> Edit -> Billing Address

Should that be a Custom Attribute or Extension Attribute?

How about a field that would be directly on the Customer itself? Such a field should appear in the following Forms:

  1. Customer Account Create Form
  2. Customer Dashboard: Edit Account Information (customer_account_edit)
  3. Admin Dashboard: Customers -> All Customers -> Edit -> Account Information tab (customer_index_edit)

Should that be a Custom Attribute or Extension Attribute?

submitted by /u/dotancohen
[link] [comments]

In Magento, how does a Pool differ from a Collection?

Adding a Modifier for the adminhtml Product page is done by adding it’s class to the list of Modifiers.

“` // di.xml

<virtualType name=”%YourNamespaceYourModuleDataProviderModifierPool%” type=”MagentoUiDataProviderModifierPool”> “`

Why are these Modifies using a Pool, instead of a Collection? What is the fundamental difference between a Pool and a Collection here? It seems that the PoolInterface is used in three places, but I don’t see anything that distinguishes these places as being unable to use a Collection instead.

“` $ rg -u “interface PoolInterface” framework/View/Element/UiComponent/PoolInterface.php 13:interface PoolInterface

framework/View/Element/Message/Renderer/PoolInterface.php 12:interface PoolInterface

module-ui/DataProvider/Modifier/PoolInterface.php 12:interface PoolInterface “`

submitted by /u/dotancohen
[link] [comments]

Magento 2.4 Local Development Setup – Mac M2

So I have an original post regarding local development for Magento 2.4. While Warden did work perfectly for my use cases back then, I’m back at square one because I recently purchased a replacement workhorse in the form of a MacBook, now donning the M2 chip. My previous MacBook still had Intel in it so there was no issue.

Was wondering if anyone here already upgraded their workhorse to a similar machine with a similar chip (M1/M2) and maybe get new tips as Warden and other derivatives currently no longer works as expected out of the box.

submitted by /u/mblue1101
[link] [comments]

Why use a DI virtualType without an explicit type?

From the Customize using a modifier class tutorial:

<virtualType name="MagentoCatalogUiDataProviderProductFormModifierPool"> <arguments> <argument name="modifiers" xsi:type="array"> <item name="advancedInventory" xsi:type="array"> <item name="class" xsi:type="string">MagentoCatalogInventoryUiDataProviderProductFormModifierAdvancedInventory</item> <item name="sortOrder" xsi:type="number">20</item> </item> </argument> </arguments> </virtualType>

Why does the <virtualType> element not have a type attribute? Is it mistakenly omitted? Should the authors of that tutorial used a <type> element instead of a <virtualType> element?

submitted by /u/dotancohen
[link] [comments]

Malware – how to find the offending files

A client’s site apparently has js/spy.banker.kj malware on its basket/cart page. I found some code in View Source that matches code that is highlighted elsewhere as being the dodgy code – https://forum.eset.com/topic/35067-help-detecting-the-threat-jsspybankerkj-trojan/

I do not have a copy of the site locally and it is taking a while to download – I don’t have access to the site except through SSH and cpanel. On cpanel in the File manager, the search is only searching file names, not content. I have tried via SSH to grep the content with the likes of

rep -lrIi aHR0cHM6Ly93d3 public_html > outputfile.txt

find ./ -name "*.php" -exec grep -r -l -I "aHR0cHM6Ly93d3" {} ;

find / -type f -name "*.js" -exec grep -il 'aHR0cHM6Ly93d3' {}; > output.txt

grep -r "aHR0cHM6Ly93d3"

grep -rli "atob" *.php

but am getting errors like no such file etc:

[website@website-32 public_html]$ grep -lrIi aHR0cHM6Ly93d3 public_html > outputfile.txt

grep: public_html: No such file or directory

[website@website-32 public_html]$ grep -lrIi aHR0cHM6Ly93d3 outputfile.txt

[website@website-32 public_html]$ find ./ -name "*.php" -exec grep -r -l -I "aHR0cHM6Ly93d3" {}

> ^C

[website@website-32 public_html]$ find / -type f -name "*.js" -exec grep -il 'aHR0cHM6Ly93d3' {}; > output.txt

find: missing argument to -exec’`

[website@website-32 public_html]$ find / -type f -name "*.js" -exec grep -r -il 'aHR0cHM6Ly93d3' {}; > output.txt

find: missing argument to -exec’`

[website@website-32 public_html]$ cd lib

[website@website-32 lib]$ grep -r "aHR0cHM6Ly93d3" *.js

grep: *.js: No such file or directory

[website@website-32 lib]$ grep -r "aHR0cHM6Ly93d3"

[website@website-32 lib]$ grep -rli "atob" *.php

grep: *.php: No such file or directory

[website@website-32 lib]$

Can anyone suggest where to look for the source of the malware? Or how to grep successfully? Thanks!

submitted by /u/hawthornmage
[link] [comments]

Cant create files or directory on Bitnami/Magento stack

Hi,
Ive installed the bitnami/magento stack and all has gone well.
Ive enabled ssh and can sftp to the directory using the default bitnami user but I cant create any new directories. I try to update to 777 but it reverts back.
I tried to give user:bitnami r+w on the directory but it crashed the site and i had to re-install the server.

I assume bitnami is not the root user for sftp but I cant work out what user to log in to sftp with other then the default bitnami/bitnami

Any assistance would be great before I break the stack again.

here is the output from FileZilla
——

Command: cd “/bitnami/magento”

Response: New directory is: “/bitnami/magento”

Command: mkdir “Ie_connector”

Error: mkdir /bitnami/magento/Ie_connector: permission denied

Command: mkdir “/bitnami/magento/Ie_connector”

Error: mkdir /bitnami/magento/Ie_connector: permission denied

submitted by /u/GillyV1king
[link] [comments]