Questions tagged [array]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
65 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) { $...
user avatar
0 votes
1 answer
23 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" => "...
user avatar
1 vote
0 answers
38 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. ...
user avatar
0 votes
1 answer
54 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:...
user avatar
  • 320
0 votes
1 answer
118 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 ...
user avatar
  • 536
1 vote
2 answers
178 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 ...
user avatar
  • 45
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 ...
user avatar
  • 136
0 votes
0 answers
372 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....
user avatar
0 votes
2 answers
98 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, ...
user avatar
  • 138
0 votes
2 answers
1k 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] => ...
user avatar
0 votes
1 answer
21 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($...
user avatar
0 votes
1 answer
248 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&...
user avatar
0 votes
1 answer
3k views

Cannot read property 'push' of undefined

When pushing an array's contents i get here is my code
user avatar
0 votes
1 answer
97 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->...
user avatar
  • 383
0 votes
1 answer
575 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/...
user avatar
  • 536
0 votes
2 answers
19 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 ...
user avatar
  • 138
0 votes
1 answer
84 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 ...
user avatar
0 votes
1 answer
59 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 ...
user avatar
0 votes
2 answers
130 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": { ...
user avatar
0 votes
1 answer
459 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 |...
user avatar
0 votes
2 answers
444 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:...
user avatar
0 votes
1 answer
39 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/...
user avatar
0 votes
2 answers
821 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] => ...
user avatar
  • 99
1 vote
1 answer
2k 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(), '...
user avatar
  • 1,521
2 votes
1 answer
494 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 - ...
user avatar
  • 377
0 votes
3 answers
230 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\...
user avatar
  • 3,111
1 vote
0 answers
131 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 ...
user avatar
1 vote
0 answers
99 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 ...
user avatar
1 vote
2 answers
398 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 ...
user avatar
  • 700
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 ...
user avatar
3 votes
0 answers
493 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 ...
user avatar
  • 1,434
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 ...
user avatar
0 votes
3 answers
33 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 ( [...
user avatar
  • 553
4 votes
1 answer
360 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 ...
user avatar
  • 341
0 votes
1 answer
580 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] => ...
user avatar
  • 1,779
-1 votes
1 answer
281 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 ( '...
user avatar
  • 379
0 votes
1 answer
1k 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 ...
user avatar
  • 1,515
0 votes
1 answer
120 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']), ...
user avatar
  • 119
4 votes
3 answers
825 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
user avatar
  • 2,172
1 vote
1 answer
507 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 ( ...
user avatar
  • 11
3 votes
3 answers
235 views

Need to get array values

Array ( [requestId] => 69a6#16a49c12847 [result] => Array ( [0] => Array ( [seq] => 0 [marketoGUID] =>...
user avatar
  • 1,023
1 vote
1 answer
52 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 ...
user avatar
  • 31
6 votes
2 answers
3k 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 ...
user avatar
3 votes
2 answers
1k 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://...
user avatar
  • 1,047
1 vote
2 answers
148 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(); ...
user avatar
  • 828
1 vote
1 answer
738 views

How to filter duplicate values in magento array?

I am trying to get attribute option values for specific products. $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $baseUrl = $objectManager->get('Magento\...
user avatar
  • 828
2 votes
1 answer
471 views

Unserialize large data not working in Magento 1.9

I've created a custom module on my Magento 1.9.4.0 website, which creates a CSV feed file with all products and you can add dynamically what product attributes to display in the file. Something like ...
user avatar
  • 527
-1 votes
1 answer
1k views

Warning: strpos() expects parameter 1 to be string, array given in vendor/magento/module-eav/Model/Entity/Attribute/Source/Table.php on line 157

1 exception(s): Exception #0 (Exception): Warning: strpos() expects parameter 1 to be string, array given in /home/equpo/public_html/demo/vendor/magento/module-eav/Model/Entity/Attribute/Source/Table....
user avatar
  • 1,047
1 vote
1 answer
631 views

How to add dynamic multi-select list drop-down in admin edit.php file

I have create Model/Source But I want to add this in admin multiselect dropdown list Like: $fieldset->addField( 'special', 'multiselect', [ 'label' => __(...
user avatar
1 vote
1 answer
718 views

How to implode a array object

Here my code: public function getTime(){ $store = $this->getStoreId(); $mapping_time = $this->scopeConfig->getValue(self::XPATH_HOURMAX, ScopeInterface::SCOPE_STORE, $store); ...
user avatar
  • 1,389