Questions tagged [array]
The array tag has no usage guidance.
145
questions
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&...
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
...
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
...
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 ...
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/...
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) {
$...
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" => "...
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.
...
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:...
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 ...
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 ...
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 ...
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....
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, ...
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] => ...
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($...
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&...
0
votes
1
answer
4k
views
Cannot read property 'push' of undefined
When pushing an array's contents i get
here is my code
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->...
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/...
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 ...
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 ...
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 ...
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": {
...
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 |...
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:...
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/...
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] => ...
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(),
'...
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 - ...
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\...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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
(
[...
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 ...
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] =>
...
-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 (
'...
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 ...
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']),
...
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
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
(
...
3
votes
3
answers
516
views
Need to get array values
Array
(
[requestId] => 69a6#16a49c12847
[result] => Array
(
[0] => Array
(
[seq] => 0
[marketoGUID] =>...
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 ...
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 ...
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://...
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();
...