Skip to main content
7 votes
Accepted

Magento 2 Modal Popup - Buttons

I adding the second button correctly to the array? No, you add another property to the options object. Try with this: require([ "jquery", "Magento_Ui/js/modal/modal" ], function($, modal){ ...
Adrian's user avatar
  • 366
7 votes
Accepted

Array Manipulation

This class is dedicated to handling/manipulating nested associative arrays. More specifically, heavily nested associative arrays. It is used primarily when handling data from UiComponents within ...
Ethan Yehuda's user avatar
6 votes
Accepted

How to resolve Exception #0 (Exception): Notice: Array to string conversion Mailchimp Error

It is an error of Mailchimp module just go to the below location Magento_root/vendor/mailchimp/mc-magento2/Block/Adminhtml/System/Config/Form/Field/CustomerMap.php On the line number 68 comment ...
Abhishek Tripathi's user avatar
4 votes

Magento 2.2: Weird $_files array after image upload

Didn't test this, but I think $result = $this->imageUploader->upload('slide'); should be $result = $this->imageUploader->upload('image'); //use the name of the field not of the ...
Marius's user avatar
  • 199k
3 votes
Accepted

How can we return an array of search results in APIs Magento 2

I just fixed this. Need to create one more interface for this. CategoryArrayItemInterface <?php namespace Vendor\CustomAPIs\Api\Data; /** * Interface which represents associative array item. */...
Ramkishan Suthar's user avatar
3 votes

Extract higher and lower price list products

$price_array[] = array($prezzo_scontato); $prezzo_pieno[]= array($prezzo_pieno_down); should be $price_array[] = $prezzo_scontato; $prezzo_pieno[]= $prezzo_pieno_down;
Marius's user avatar
  • 199k
3 votes

class [] does not exist for custom extension_attributes over webapi

I finally manage to resolve this issue. After digging into the Magento core, I found that in the \Magento\Framework\Reflection\ExtensionAttributeProcessor::buildOutputDataArray method, Magento get the ...
eInyzant's user avatar
  • 331
3 votes

Why would you add the modules array in app/etc/config.php to source control?

It is necessary because it ensures all developers run the app with same disabled/enabled modules and config. I run into conflicts with config.php a lot due to changed module array. I haven't put this ...
Ryan Sun's user avatar
  • 186
2 votes
Accepted

If multiple items are ordered they should have their own line item section

find Updated code $orderIncrementId = "1000001"; $orderCollection = Mage::getModel('sales/order'); $orderCollection->loadByIncrementId($orderIncrementId); $order_data = $orderCollection->...
Gopal Patel's user avatar
  • 3,139
2 votes

Magento2: Products group by filterable attributes

You can get lsit of filters from \Magento\Catalog\Model\Layer\FilterList::getFilters(). Then you get array of all filters represented by objects extending from \Magento\Catalog\Model\Layer\Filter\...
Bartosz Kubicki's user avatar
2 votes
Accepted

something is wrong in the code. theows an error->getNodeChildrenData() must be an instance of Varien_Data_Tree_Node,on line 18

The issue seems to be with your function updateTopMenuJson, You have used $node = ''; and then you are passing it to $categoryData = $this->getNodeChildrenData($node); which triggers the error. ...
Jaimin Sutariya's user avatar
2 votes

Magento 2 Short array syntax is not allowed while Module testing.

This is because the Marketplace coding standard enforces the old long array syntax array() instead of [] for historic reasons. You have three options: ignore the "error" accept the coding standard ...
Fabian Schmengler's user avatar
2 votes

Checking if an attribute exists within an array of loaded attributes

in_array() does not work on multidimensional arrays. You could write a recursive function to do that for you: function in_array_r($needle, $haystack, $strict = false) { foreach ($haystack as $...
Qaisar Satti's user avatar
  • 32.5k
2 votes

How to convert this object data into array?

You can use the method toArray(). \Magento\Customer\Model\Customer $customer; $customer->toArray();
Gabriel Fernandes's user avatar
2 votes
Accepted

How to display created dynamic attibute into the customer array?

simple is that add this in attribute array visible' => true, and use the attribute_code as the field name. magento autosave the value.
Qaisar Satti's user avatar
  • 32.5k
2 votes

In Magento 2 how to unserialized the array to get a data?

The "Magento way" would be to create a Serializer object (depending on the way your data is serialized, for example Json or Serialize) and call the unserialize method there. For example like this (of ...
HelgeB's user avatar
  • 4,541
2 votes
Accepted

In Magento 2 how to unserialized the array to get a data?

Try this: <?php //get data of an unserialized array $serialized_data = serialize(array('_1550496532530_530',array('field1'=>'27-02-2019'), '...
fmsthird's user avatar
  • 4,612
2 votes
Accepted

How to implode a array object

If I understand the question correctly it sounds like within your foreach $value is an array with two values (keys field1 and field2), and you would like both the value and label of the dropdown ...
rain2o's user avatar
  • 465
2 votes

How to resolve Exception #0 (Exception): Notice: Array to string conversion Mailchimp Error

The error says that the return data type in select is Array but it has been printed as a string. To resolve this, you have to change the way return type is printed using print_r function.
fmsthird's user avatar
  • 4,612
2 votes
Accepted

How to Find out where it Is made Breadcrumb Array in Magento 2.3.1

For product page breadcrumbs loading from https://github.com/magento/magento2/blob/2.3/app/code/Magento/Catalog/view/frontend/web/js/product/breadcrumbs.js function _resolveCategoryUrl Basically ...
Rohit Prajapati's user avatar
2 votes
Accepted

Magento 2 - How to print array values in custom html email template by looping?

Please add this to the PHP file. $giftcods = ['VFDFRVXSW43VF', 'FFRFRFVSW43VF', 'VFDFGFGFXSW43VF']; $templateVars = [ 'store' => $this->storeManager->getStore(), 'customer_name' =>...
Dhaduk Mitesh's user avatar
2 votes

How to convert Json object to an associative array?

This also what I am using everywhere it's working. You could use \Magento\Framework\Serialize\Serializer\Json instead. Ie. public function __construct( \Magento\Framework\Serialize\Serializer\...
Tushar's user avatar
  • 513
2 votes
Accepted

How to format the price on the backend

as you haven't mentioned where the array variable $_customerProductPrices is from, whether its from a Block or from a ViewModel or in a template (.phtml file). As well as its also not mentioned how do ...
Haijerome's user avatar
  • 2,211
2 votes

TypeError: array_key_last(): Argument #1 ($array) must be of type array, string given in xx/Controller/IyzicoBase/IyzicoPkiStringBuilder.php:109

Please Check your variable name replace $Ddata = (array) $data; $newData = $data[array_key_last($data)]; with $Ddata = (array) $data; $newData = $data[array_key_last($...
Pruthvi Raval's user avatar
1 vote
Accepted

How can Select arrays from associate array in php on the basis on element

Use the array_filter php function. $filtered = array_filter( $arrItems['items'], function ($item) { return isset($item['seller_id']) && $item['seller_id'] == 1; } );
Marius's user avatar
  • 199k
1 vote

Accessing Array with space in key Value

that's not an array, that's a string. And another problem is, that it's not even valid json nor valid php code. you have to fix this first. But the much better solution is to figure out were that ...
Philipp Sander's user avatar
1 vote

How to convert this object data into array?

Try like this one: $data = $this->dataObjectConverter->toFlatArray($Customer, [], \Magento\Customer\Model\Customer::class);
Chirag Parmar's user avatar
1 vote

How to convert this object data into array?

The simple way you can do it via php function json_encode and json_decode. $object = 'your_object_variable' $myArray = json_decode(json_encode($object), true); print_r($myarray);
Himanshu's user avatar
  • 1,776
1 vote

Magento 2: my_variable is not defined in ArraySerialized

Simple....Remove your config entry in core_config_data. Try adding all columns at a time in protected function _prepareToRender() and run upgrade, compile and flush commands
kiran kumar's user avatar
1 vote

Don't execute foreach loop if array is empty

except getSize() you can use count as well, like below $orders = Mage::getModel('sales/order')->getCollection() ->addAttributeToSelect('*') ->addAttributeToFilter('created_at', ...
Murtuza Zabuawala's user avatar

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