Questions tagged [array]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
3 answers
49 views

Sort Multidimensional Array by Alphanumeric value in Magento 2.4.6

For Example, my Array is something like this : $testArray = [ "01-01A" => [ 'name' => "test1", 'test' => "01-01A" ], "01-06B&...
Ronak Rathod's user avatar
  • 6,216
0 votes
1 answer
28 views

Display array when button in clicked in PHP

I have an array as such: Array([0]=>1001 [1]=>1002 [2]=>1003 [3]=>1004) Array([0]=>2001 [1]=>2002 [2]=>2003) I am trying to display the array in a table like below: Location ...
philtatos's user avatar
1 vote
1 answer
88 views

How to define array request in GraphQL in magento2

How to define details array in the below request: query{ results( id: "56", details: { name: "yamini", bloodGroup: "AB+" age:25 ...
Yamini Yerusu's user avatar
0 votes
1 answer
19 views

How do I create a Magento block that has input fields for to store values in variables?

My code for displaying rotating messages is currently hardcoded and I have to go in and update the messages manually. I want to replace this with a new block in magento so other people can just go ...
Alyx's user avatar
  • 1
1 vote
2 answers
509 views

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

I'm getting this error when I try so save api configure for Iyzico payment gateway TypeError: array_key_last(): Argument #1 ($array) must be of type array, string given in /chroot/home/a94b818d/...
Amjad Khoulani's user avatar
0 votes
2 answers
601 views

Convert Array to Magento2 Collection

I am converting an Array to Magento2 Collection $items = $this->getItems(); $collection = $this->collectionFactory->create(); foreach ($items as $item) { $...
Syed Hassan Zamir's user avatar
0 votes
1 answer
111 views

Join array values and keys between two php arrays

I need to merge (sort of join) two arrays with both same keys, and in result i want to have the values of the first as keys of the second one : Example : $keyArray = [ "key1" => "...
Marwen Jelloul's user avatar
1 vote
0 answers
137 views

Magento 2 / Intercept Array REST API Call with a Plugin?

is it possible to intercept the sales order API array export to manipulate the array? I've installed the Amasty Extrafee Extention, but our Merchandise Management System cannot work with this export. ...
MasterChief's user avatar
0 votes
1 answer
145 views

PHP Array Unique on exploded Keywords from MySQL problem

I'm trying to echo keywords from a MySQL database, separated by colon, and remove (don't show) duplicates. This is what I got. Keywords in DB Love:Sorrow:Death Happiness:Love:Excitement Excitement:...
Aknot's user avatar
  • 314
0 votes
1 answer
441 views

How to send array variables in Magento 2 email template?

I have created a custom module to send custom email template. But i want to send array value so need to use the loop i have tried in mail file but it doesn't work. Any one have any idea how to send ...
Prits's user avatar
  • 626
1 vote
2 answers
615 views

magento 2 how to get cms blocks toOptionArray

<?php namespace [Vendor\Module]\Model\System\Config; use Magento\Cms\Model\ResourceModel\Block\CollectionFactory; use Magento\Framework\Data\OptionSourceInterface; class CmsBlocks implements ...
Tj1997's user avatar
  • 47
0 votes
0 answers
28 views

Best way to do this?

I've been racking my brains for a long time trying to think of the best most efficient way to solve the following problem. Basically I have a set of questions which I'm looping through in the ...
SNAFU's user avatar
  • 176
0 votes
0 answers
1k views

Notice: Array to string conversion in vendor/magento/framework/Data/Form/Element/Select.php on line 135

When I am trying to delete any CMS page or delete any product in the admin backend it throws an error of the Array to String Conversion in directory /vendor/magento/framework/Data/Form/Element/Select....
Manoj Jarial's user avatar
0 votes
2 answers
507 views

How to format the price on the backend

I have a variable $ customerProductPrices that contains data like this. How to format data (price, special_price, price_value, special_price_value) in a variable That I would get not just a number, ...
Alice's user avatar
  • 148
0 votes
2 answers
2k views

PHP: How to move an array element with an unknown key to end?

I have an array which contains list of color values. Consider below array: Array ( [value] => 4 [label] => red ) Array ( [value] => 5 [label] => ...
quickshiftin's user avatar
0 votes
1 answer
26 views

Fetch data and arrange sequence in given format

This is my array: <?php $sku = ['HH017','HH018','HH005','HH010','20OZHHTUMBLER', '30OZTUMBLER2','HH006','HH-05']; $sequence = ['HH005','HH010','HH006','20OZHHTUMBLER',...]; print_r(sort($...
IntraPersonalLearner's user avatar
0 votes
1 answer
548 views

Magento 2 Pass array data to Custom Email template

I'm a beginner in magento and I have a custom email template as follows wishlist_email_template.html {{template config_path="design/email/header_template"}} <table cellspacing="0&...
Sahan Thilakarathna's user avatar
0 votes
1 answer
4k views

Cannot read property 'push' of undefined

When pushing an array's contents i get here is my code
Mevada Ketan's user avatar
0 votes
1 answer
151 views

Request Parameters with php 7.4 and magento 2.4.1

After updating from 2.3.5p2 to 2.4.1 and from php 7.1 to php 7.4 I have strange trouble with request parameters. I see, that there are parameters set, when I var_dump $parameters=$this->request->...
Mario's user avatar
  • 433
0 votes
1 answer
1k views

How to save array values with configWriter in Magento 2 core config data?

I want to save some data which is in array form and used this to save array but it will save Array keyword in this How to save array values with this. $this->configWriter->save('my/path/...
Prits's user avatar
  • 626
0 votes
2 answers
168 views

Help make a condition involving an array

I have data from the server: $this->getConfigData('groups') = "1,5,9,10" I need to make a condition, if one of these id matches the id from the custom group of the current user, then ...
Alice's user avatar
  • 148
0 votes
1 answer
532 views

How to build a multidimensional array from the Json decoded output?

What I'm trying to achieve is to build the array that should match exactly the structure of an Json decoded version. I am stuck where I need to address indexed array within an array. It would be a ...
CodeForGood's user avatar
0 votes
1 answer
225 views

Can any conditional operators be used with an element while defining a multidimensional array?

While building a multi-dimensional array as shown below, I need to use a loop to retrieve some value from $this_fulfillment_record to be assigned to "amount" =>. Can a if statement be ...
CodeForGood's user avatar
0 votes
2 answers
670 views

How to convert Json object to an associative array?

Building an associative array from json object is necessary when making an API call to Walmart. Could anyone please help me get the associative array from this object? { "orderShipment": { ...
CodeForGood's user avatar
0 votes
1 answer
1k views

Short array syntax must be used to define arrays Use ::class notation instead

I had things like that 90 | WARNING | [ ] Use ::class notation instead. 92 | WARNING | [x] Short array syntax must be used to define arrays 94 | WARNING | [ ] Use ::class notation instead. 96 |...
Giga Todadze's user avatar
0 votes
2 answers
793 views

Notice: A non well formed numeric value encountered

I'm trying to format the DB timestamp to 'm:d:y, something like 07/06/20`. Please change the piece of code below to help achieve it. echo $dbh->Record['fulfillmentDate']; Returns 2020-07-02 02:...
CodeForGood's user avatar
0 votes
1 answer
113 views

Sum of id element from n number of array inside array in PHP

I have an array like tree and i want to get sum of id element any idea how to get?? Thanks <?php $data=[ 0=>[ 'id'=>1, 'date'=>'3/3/...
Binit Kumar's user avatar
0 votes
2 answers
1k views

How to extract one of the properties from an object as an array in PHP?

I have an object that looks like below. I would like to pull out just the "DID" property as an array. How would I go about that in PHP? stdClass Object ( [t] => Array ( [0] => ...
R.P.'s user avatar
  • 99
1 vote
1 answer
3k views

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

I want to print multiple coupon/gift codes in the custom email template. I am getting a single code as: $templateVars = array( 'store' => $this->storeManager->getStore(), '...
Ajwad Syed's user avatar
  • 1,591
2 votes
1 answer
826 views

Magento 2.3 - How to pass array from controller to template

I am working on a custom module. I am getting array of attribute values in my custom controller and I want to pass these values in my template to list in a select dropdown. Please provide a solution - ...
chanchal's user avatar
  • 397
0 votes
3 answers
358 views

Custom module collection array not return

I have created a custom module and I have return collection array but it does not return foreach array in Magento 2.3.2. it returns the only foreach last value. Block Code <?php namespace Developer\...
Devidas's user avatar
  • 3,298
1 vote
0 answers
201 views

Magento 2 WYSIWYG in repeater field

I am trying to make a (very simplified) page builder for just the homepage in Magento 2.3. I figured out how to build a repeating field from a serialized array, like this : <field ...
Litsher - Nathan's user avatar
1 vote
0 answers
108 views

Magento 2.2.9 question about foreach data into popup modal

I am trying to do a popup modal with this information I have in an array. I have ID, NAME and DESCRIPTION So in a function, I have done foreach to gather all the information and i am showing it on ...
jibin george's user avatar
1 vote
2 answers
574 views

Passing array from one template to another in magento2

I have used two template for homepage(template inside another template) I am calling product template inside category template. Now my case scenario is 1. I am declaring one array in category ...
Nafsss's user avatar
  • 720
0 votes
1 answer
1k views

remove BOM byte ("" /ufeff"") from response

so im using m2e pro extension on magento 2.3 suddenly the synchronizing stopped from working. thats because that m2e pro uses their own cron job and they sends curl calls to the server, but my server ...
Almog Lahav's user avatar
3 votes
0 answers
763 views

How to show all data in array using jquery. Magento 2

I'm getting all the Data from Array in Jquery when I console.log() it then it shows me all the data of the array but when I append the data with <div> then it only returns me the last value I ...
Asad Khan's user avatar
  • 1,476
0 votes
2 answers
44 views

Remove a city from being able to purchase product

So in my explorations I've found that Magento only has the States stored in the back end, but I don't want to remove the entire state, just one city in that state. I've seen options to include a city ...
Al Borland's user avatar
0 votes
3 answers
47 views

Sorting went fail for array

I am having the array of color attribute options... I would like to sort the array based on 'store0' key... I have used multisort and usort but its not working [821] => Array ( [...
1990rk4's user avatar
  • 573
4 votes
1 answer
466 views

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

As of Magento 2.2 it's recommended to add config.php to your source control to facilitate pipeline deployment. I have some questions and issues with this. I'm hoping somebody can share their ...
Joke Puts's user avatar
  • 341
0 votes
1 answer
705 views

Magento2: How can I access Zend\Stdlib\Parameters Object array?

I have below result: echo "<pre>"; print_r($data); die(); Result Zend\Stdlib\Parameters Object ( [storage:ArrayObject:private] => Array ( [success_url] => ...
Ravi Soni's user avatar
  • 1,809
-1 votes
2 answers
471 views

Array Get Value in magento2

i want to get profile id from this array [2019-05-21 07:30:24] main.DEBUG: array ( 'url' => 'https://api-3t.sandbox.paypal.com/nvp', 'CreateRecurringPaymentsProfile' => array ( '...
imtiazau's user avatar
  • 379
0 votes
1 answer
2k views

array convert into Magento 2 collection

I have 2 collection 1 is $bestsalecollection that show in dashboard . second is product collection. After filter collection when i return it generate error Call to a member function isLoaded() on ...
HaFiz Umer's user avatar
  • 1,620
0 votes
1 answer
525 views

Multiple For each loop value to Json string

$data= array(); foreach($itfdatas as $key=>$itfdata){ $checkemps = explode(',',$itfdata['employee_id']); $data[] = array( 'id'=>mysql_real_escape_string($itfdata['P_id']), ...
Sheenu's user avatar
  • 119
4 votes
3 answers
972 views

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

where it Is made Breadcrumb Array in Magento 2.3.1? In Detail page has show Breadcrumb but i m not able to find where it Is made Breadcrumb Array Can somebody help me? Thanks
Savan Patel's user avatar
  • 2,298
1 vote
1 answer
732 views

How to get _data:protected on printing customer data in Magento 2.2.6?

How to access this value from array [value] => 11113610 ? Array ( [is_saml] => Magento\Framework\Api\AttributeValue Object ( [_data:protected] => Array ( ...
rued's user avatar
  • 11
3 votes
3 answers
516 views

Need to get array values

Array ( [requestId] => 69a6#16a49c12847 [result] => Array ( [0] => Array ( [seq] => 0 [marketoGUID] =>...
Shomita's user avatar
  • 1,103
1 vote
1 answer
69 views

Custom report without using collection

I have a request which to make custom report, and data for the report need to calculate by helper function and will generate a data array with row and columns. Is there any solution to let data array ...
Artick's user avatar
  • 31
6 votes
2 answers
4k views

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

Exception #0 (Exception): Notice: Array to string conversion in /public_html/vendor/magento/framework/View/Element/Html/Select.php on line 244 line 235-244 of the Select.php public function ...
Mage Explorer's user avatar
3 votes
2 answers
2k views

Magento2 : How to show button in admin for custom module page?

I want to show the button in my custom module (admin page) but I am getting an error I want to add a button and how I add action process for that button i already tried this answer : (https://...
prabhakaran7's user avatar
  • 1,057
1 vote
2 answers
199 views

Magento Api request foreach error

I am trying to get attribute option Ids for a sku using this below api call. http://localhost/rest/V1/configurable-products/sh8/options/all I used this curl request: $curl = curl_init(); ...
Ramesh KR's user avatar
  • 836