PHP code example of hounddd / wn-mallimportexport-plugin

1. Go to this page and download the library: Download hounddd/wn-mallimportexport-plugin library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hounddd / wn-mallimportexport-plugin example snippets


/**
 * Extend products controller export columns definition
 */
Event::listen('hounddd.mallimportexport.config.update', function ($controller, $config) {
    $exportColumns = $config->export['list']->columns;
    $position = 1;

    $config->export['list']->columns = 
        array_slice($exportColumns, 0, $position, true) +
        [
            'name' => [
                'label' => 'offline.mall::lang.product.name'
            ]
        ] + 
        array_slice($exportColumns, $position, count($exportColumns) - 1, true);
});



return [
    'import' => [
    ],

    'export' => [
        'fileName' => 'Export_produits',    // New export filename, default "Products_export"
        'appendDate' => true,               // Append date to filename, default true
        'dateFormat' => '_Y-m-d-z',         // How to format appended date, default '_Y-m-d'
    ],

    'useCurrencySymbol' => true,            // Use currency symbol (true), code (false), or nothing (null), default true
    'removeDiacritics' => false,            // Remove diactritcis chars in additional prices column labels, default false
];


    return [

        'columns' => [
            'allow_out_of_stock_purchases' => 'Vente hors stock',
            'price'                        => 'Prix en',
            'published'                    => 'Publié',
            'stock'                        => 'Stock',
            'user_defined_id'              => 'Référence',
            'weight'                       => 'Poids en g',
        ],

    ];