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){
...
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 ...
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 ...
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 ...
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.
*/...
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;
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 ...
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 ...
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->...
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\...
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.
...
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 ...
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 $...
2
votes
How to convert this object data into array?
You can use the method toArray().
\Magento\Customer\Model\Customer $customer;
$customer->toArray();
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.
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 ...
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'),
'...
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 ...
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.
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 ...
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' =>...
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\...
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 ...
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($...
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;
}
);
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 ...
1
vote
How to convert this object data into array?
Try like this one:
$data = $this->dataObjectConverter->toFlatArray($Customer, [], \Magento\Customer\Model\Customer::class);
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);
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
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', ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
array × 146magento2 × 42
php × 33
magento-1.9 × 25
collection × 15
database × 9
json × 9
attributes × 8
magento2.3 × 7
magento-1.7 × 6
category × 5
javascript × 5
model × 5
object × 5
product × 4
module × 4
customer × 4
admin × 3
template × 3
rest-api × 3
email-templates × 3
ajax × 3
jquery × 3
phtml × 3
sku × 3