Hot answers tagged

52

You can easily resolve any ambiguous where condition by using the following method of collection: addFilterToMap($filterName, $alias, $group = 'fields') $filter - it is the name of the filter that is used in addFieldToFilter() method, for your case it is increment_id $alias - it is the full name of the column that is associated to the filter, for you case ...


16

You could write this one pretty easily. Create a php file called something like export.php. <?php require("app/Mage.php"); // load the main Mage file Mage::app(); // not run() because you just want to load Magento, not run it. // load all of the active categories in the system and include all attributes $categories = Mage::getModel('catalog/...


16

note: I get crystal clear explanation of custom import option from this link Please first download the whole zip file from this github link then change the module name as per your requirement. Just alter the two files is enough to import your custom CSV to custom table. step1: alter app/code/vendor/module_name/etc/import.xml from your download github ...


15

First you have to upload alll the images you want to import in the media/import/yourimagesfolder/ The in the CSV columns for image, thumbnail and small_image your image path should look like this /yourimagefolder/imagename.jpg


13

Try this below code: $this->addExportType('*/*/exportExcel', Mage::helper('{module}')->__('Excel')); public function exportExcelAction() { $fileName = 'excel_name.xls'; $content = $this->getLayout()->createBlock('{module}/adminhtml_{module}_grid')->getExcelFile(); $this->_prepareDownloadResponse($fileName, $content); ...


10

You can add in your grid columns that are visible only on export. In the _prepareColumns() method add this: if ($this->_isExport) { $this->addColumn('col_id', array( 'header' => Mage::helper('helper_alias')->__('Header'), 'index' => 'col_id', )); } Just like any other column, just wrapped in if ($this->_isExport) ...


10

Got it, if set is_system true for a column, it will not be exported.So $this->addColumn('customer_name', array( 'header' => Mage::helper('sales')->__('Customer'), 'index' => 'email_address1', 'width' => '60', 'type' => 'text', 'is_system' => true, 'filter_index' => 'email_address1' ...


9

First, unfortunately Magento doesn't import the files generated by it's export. AFAIK, this is true for both import/export module and default out-of-box dataflow profiles. Second, I'll try to bring more light on images question as I see for many it's unclear how it works: When you import, it expects that images are placed in media/import. So if you have a ...


9

You can use sales/orders grid as example. exportButton ui component responsable for UI <exportButton name="export_button"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="selectProvider" xsi:type="string">sales_order_grid....


7

The class that handles that button is Mage_Adminhtml_Block_System_Config_Form_Field_Export. and it has the url in one of the methods, so you cannot use <frontend_type>export</frontend_type> for your custom button. You have to create a new field renderer similar to Mage_Adminhtml_Block_System_Config_Form_Field_Export and add your url in there. Try ...


7

I would suggest to extend the Magento 2's default import functionality. To do that register a new module (lets say "Custom Import" for now) Create a module.xml file at app/code/Foo/CustomImport/etc/module.xml <?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:...


7

(Reading the comments, it seems that you're trying to create a way to easily and reliably synchronize your production database to your staging site. Perhaps you could update the question to make this more clear.) This is a common problem and having a tool to do this reliably is really beneficial. I have written my own bash script to do it and this is the ...


6

Ah hah! According to the Apache error log: PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 84 bytes) in /Zend/Db/Statement/Pdo.php on line 290 So apparently Magento needs over 256MB of memory to export customers. OK the store in question has about 20,000 customers but that still sounds like quite a lot. Plus, this ...


6

I would strongly advise against altering core tables or their auto increment. Instead translate it when retrieved for export/import using str_pad or sprintf i.e.: $id = 1; $exportId = str_pad($id, 5, '0', STR_PAD_LEFT); -> 3v4l example OR $id = 1; $exportId = sprintf('%05d',$id); -> 3v4l example


6

You can make a quick standalone script and run the following: $collection = Mage::getResourceModel('sales/order_invoice_collection'); $pdf = Mage::getModel('sales/order_pdf_invoice')->getPdf($invoices); header("Content-type:application/pdf"); header("Content-Disposition:attachment;filename='invoices.pdf'"); $pdf->render(); Although, with the ...


6

All custom attributes get appeared under "additional_attributes" header in the export separated by a comma (,). I am using Magento 2.0.7. To make these attributes occupy a separate cell, we can add more columns to the CSV.


6

I have found the issue, Inside columns tag, you need to have selectionsColumn . <columns name="custom_order_grid_data_columns"> <selectionsColumn name="ids"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> <item name="indexField" xsi:type="string">id</item&...


6

I don't think there is such a thing as "state of the art" import tool for M2 at the moment. But I can say since 2.1.4 (afaik) we have been using the native importer for products and for our use cases it worked just fine. We had to spend some time preparing and fixing input data but in the end, it just worked. Also worth saying that we had a lot of troubles ...


6

1) Add Below code in ("app/code/NameSpace/Module/view/adminhtml/ui_component/") listing xml file between <listingToolbar></listingToolbar> tags <exportButton class="Magento\Ui\Component\ExportButton"> <argument name="data" xsi:type="array"> <item name="config" xsi:type="array"> &...


6

We've got a similar setup and scenario. We went with a database level sync of product based tables. It works by dumping and importing tables. The copy site is down for about 15 mins in early hours. It was trial and error over which tables to sync. Watch for eav tables though. There is a table which stores increment ids for orders, invoices etc. You dont ...


6

not sure how your copy store works, but you can use many options: Magento Sync Products paid extension Odoo connector Example free connector/ Odoo bridge Example Webkul paid extension Magmi Magento Mass Importer Store manager for magento Magento Dataflow


6

If your var/importexportxxx file is blank try; php bin/magento queue:consumers:start exportProcessor https://github.com/magento/magento2/issues/23450


5

Just to clarify, I assume you are using the Import/Export module, NOT Dataflow. If you have been using Dataflow please try the same process with Import/Export module and see if your results improve. This is definitely standard functionality - please see my linked CSV export from a fresh install of Magento CE 1.7.0.2 with sample data installed. Do a search ...


5

You can use set column_css_class and header_css_class as no-display to the column you want to hide. This will hide your column from the admin grid. However, this column will be present in the exported csv or xml. $this->addColumn('YOUR_COLUMN_ID', array( 'header' => Mage::helper('YOUR_HELPER_NAME')->__('YOUR_COLUMN_NAME'), 'width'...


5

You can try code given below. It works for me hope also help you. $options = $item->getBuyRequest()->getData('options'); $totalCustomOptionPrice = 0; foreach ($options as $key => $value) { $optionData = $item->getProduct()->getOptionById($key); if ($optionData['type'] == 'field') { $totalCustomOptionPrice = $optionData['...


5

Solution : For this Need to do some changes in vendor\magento\module-catalog-import-export\Model\Export\Product.php file or override same model file in your custom module . In vendor\magento\module-catalog-import-export\Model\Export\Product.php file add custom_attributes code those you want in separate cell ( not in additional_attributes cell) in $...


5

I found a free Magento 2 extension from BSS Commerce which helped me work around this: https://bsscommerce.com/blog/how-to-export-custom-product-attributes-in-magento-2/ https://bsscommerce.com/custom-product-attribute-export-for-magento-2.html It provides some override code for the Model\Export\Product core class which breaks out the ...


5

For this you can create your php script, create one php file on root directory of your website and use following code.for ex: if file name is exportCustomer.php and your url is like http://magentowebsite.com then after placing this file in root you need to visit url like http://magentowebsite.com/exportCustomer.php then you will get a csv in your root ...


5

You can create a stand alone page on root of the magento folder and proceed in this manner : <?php use Magento\Framework\App\Bootstrap; require __DIR__ . '/app/bootstrap.php'; $orderData = getOrderCollection(); echo '<pre>';print_r($orderData);die; function getOrderCollection() { $bootstrap = Bootstrap::create(BP, $_SERVER); ...


5

To add SKUs Column in order Ui grid. You need to modify below files. TO add column, add below code in your module [vendor]/[module]/view/adminhtml/ui_component/sales_order_grid.xml <?xml version="1.0" encoding="UTF-8"?> <listing xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:...


Only top voted, non community-wiki answers of a minimum length are eligible