How to print array to csv

Hi am trying to export order data in magento 1 to csv here is my script <?php require_once ‘app/Mage.php’; Mage::app(); Mage::app()->getStore()->setId(Mage_Core_Model_App::ADMIN_STORE_ID); $orderCollection = Mage::getModel(‘sales/order’)->getCollection(); $fp = fopen(‘orders_exported.csv’, ‘w’); foreach ($orderCollection as $order) { $orders[‘orders’][] = array( ‘id’ => $order->getIncrementId(), ‘store’ => ‘magento’, ‘status’ => $order->getStatus(), ‘name’ => $order->getCustomerName(), ’email’ => $order->getCustomerEmail(), ‘telephone’ => $order->getShippingAddress()->getTelephone(), ‘street’…

Magento 2.3.3 – 502 Bad Gateway – Centos – Nginx

After placed Magento 2.3.3 files to usr/share/nginx/html/magento & created database then run following, php bin/magento setup:install –base-url=http://192.168.1.64/magento –db-host=localhost –db-name=”magento” –db-user=”root” –db-password=”” –admin-firstname=”abc” –admin-lastname=”abc” –[email protected] –admin-user=”magento” –admin-password=”magento” –language=”en_US” –currency=”INR” –timezone=”Asia/Kolkata” –use-rewrites=”1″ and also edit etc/nginx/conf.d/magento.conf upstream fastcgi_backend { server unix:/run/php-fpm/php-fpm.sock; } server { listen 8091; server_name http://192.168.1.64:8091/; set $MAGE_ROOT /usr/share/nginx/html/magento; include /usr/share/nginx/html/magento/nginx.conf.sample; } Screenshot : https://snipboard.io/K5t9Qm.jpg…

Is it possible to create “Assign customer group” option (dropdown) for my custom table in admin grid in magento 2?

Basically i have made a custom table in admin which has id,customer id,email,positon,department(custom column from custom table).Now i want to make customer groups from this custom table(in admin panel) only.How can i do that? So, is it possible to make “Add customer group” option, so admin can select customers from that custom table and can…

How to show tier price in Magento 2 catalog listing page

Tier price is working fine on the product page, but when we try to show on the listing page then it’s not working. <?php /* @escapeNotVerified */ echo ($block->getShowDetailedPrice() !== false) ? __( ‘Buy %1 for %2 each and <strong class=”benefit”>save<span class=”percent tier-%3″>&nbsp;%4</span>%</strong>’, $price[‘price_qty’], $priceAmountBlock, $index, $tierPriceModel->getSavePercent($price[‘price’]) ) : __(‘Buy %1 for %2 each’, $price[‘price_qty’],…

SQLSTATE[42000] while creating categories using REST API?

I created categories using REST api by below code. <?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $directory = $objectManager->get(‘\Magento\Framework\Filesystem\DirectoryList’); $rootPath = $directory->getRoot(); $filename = $rootPath . ‘/import.csv’; //$file = fopen(‘/var/www/html/magento2/correct.csv’, ‘wb’); $result = array(); $keys = array(“id”,”name”,”parent_id”,”is_active”,”is_anchor”,”include_in_menu”,”custom_use_parent_settings”,”description”,”meta_title”,”meta_keywords”,”meta_description”); if(file_exists($filename)){ foreach (file($filename) as $key => $str) { if ($key == 0) continue; $values = str_getcsv($str,”,”,'”‘); $result[] = array_combine($keys, $values); }…