Jump to content

Edit History

GeoPixel

GeoPixel

Buenos días,

Estoy realizando una importación de productos por .CSV mediante un script en php.

La importación se realiza correctamente con todos los campos menos las imagenes.

Dejo el código de la importación al final de la consulta.

Las imagenes las inserto mediante URL ( https://www.URL.com/resources/img/products/28231g.jpg )

Debo añadir algo al script para que se importen las imagenes o es necesario tocar alguna otra cosa para que me las reconozca?

 

<?php
header("Content-Type: text/html;charset=utf-8");
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

define('_PS_ADMIN_DIR_', getcwd());

//include_once(_PS_ADMIN_DIR_ . '/../config/settings.inc.php');
include_once(_PS_ADMIN_DIR_ . '/../config/config.inc.php');


use PrestaShop\PrestaShop\Core\Import\Configuration\ImportConfigInterface;
use PrestaShop\PrestaShop\Adapter\Tools;
use PrestaShop\PrestaShop\Core\ConfigurationInterface;
use PrestaShop\PrestaShop\Core\Hook\HookDispatcherInterface;
use Tools as LegacyTools;

$context = Context::getContext();
$employee = new Employee(1);
$context->employee = $employee;


function loadProductsPost() {

    $_POST = array (
        'tab' => 'AdminImport',
        'forceIDs' => '0',
        'skip' => '1',
        'csv' => 'productos.csv',
        'entity' => '1',
        'separator' => ';',
        'multiple_value_separator' => ',',
        'iso_lang' => 'es',
        'convert' => '',
        'import' => 'Importar datos csv',
        'type_value' => array(
            0 => 'id',
            1 => 'active',
            2 => 'no', //revisar
            3 => 'category',
            4 => 'price_tex',
            5 => 'id_tax_rules_group',
            6 => 'on_sale',
            7 => 'reduction_price',
            8 => 'reduction_percent',
            9 => 'reduction_from',
            10 => 'reduction_to',
            11 => 'reference',
            12 => 'supplier_reference',
            13 => 'supplier',
            14 => 'ean13',
            15 => 'height',
            16 => 'width',
            17 => 'depth',
            18 => 'weight',
            19 => 'quantity',
            20 => 'no',
            21 => 'minimal_quantity',
            22 => 'no',
            23 => 'no',
            24 => 'description',
            25 => 'no',
            26 => 'no',
            27 => 'no',
            28 => 'meta_title',
            29 => 'no',
            30 => 'no',
            31 => 'no',
            32 => 'image',
            33 => 'customizable',
            34 => 'visibility',
            35 => 'delivery_time',
            36 => 'features',
            37 => 'no',
            38 => 'no',
            39 => 'no',
            40 => 'no',
            41 => 'manufacturer',


        ),
    );
}


$import = New AdminImportControllerCore();
loadProductsPost();
$import->productImport();


echo ('ejecutado');
?>

 

GeoPixel

GeoPixel

Buenos días,

Estoy realizando una importación de productos por .CSV mediante un script en php.

La importación se realiza correctamente con todos los campos menos las imagenes.

Dejo el código de la importación al final de la consulta.

Las imagenes las inserto mediante URL ( https://www.URL.com/resources/img/products/28231g.jpg )

Debo añadir algo al script para que se importen las imagenes o es necesario tocar alguna otra cosa para que me las reconozca?

 

<?php
header("Content-Type: text/html;charset=utf-8");
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

define('_PS_ADMIN_DIR_', getcwd());

//include_once(_PS_ADMIN_DIR_ . '/../config/settings.inc.php');
include_once(_PS_ADMIN_DIR_ . '/../config/config.inc.php');


use PrestaShop\PrestaShop\Core\Import\Configuration\ImportConfigInterface;
use PrestaShop\PrestaShop\Adapter\Tools;
use PrestaShop\PrestaShop\Core\ConfigurationInterface;
use PrestaShop\PrestaShop\Core\Hook\HookDispatcherInterface;
use Tools as LegacyTools;

$context = Context::getContext();
$employee = new Employee(1);
$context->employee = $employee;


function loadProductsPost() {

    $_POST = array (
        'tab' => 'AdminImport',
        'forceIDs' => '0',
        'skip' => '1',
        'csv' => 'productos.csv',
        'entity' => '1',
        'separator' => ';',
        'multiple_value_separator' => ',',
        'iso_lang' => 'es',
        'convert' => '',
        'import' => 'Importar datos csv',
        'type_value' => array(
            0 => 'id',
            1 => 'active',
            2 => 'no', //revisar
            3 => 'category',
            4 => 'price_tex',
            5 => 'id_tax_rules_group',
            6 => 'on_sale',
            7 => 'reduction_price',
            8 => 'reduction_percent',
            9 => 'reduction_from',
            10 => 'reduction_to',
            11 => 'reference',
            12 => 'supplier_reference',
            13 => 'supplier',
            14 => 'ean13',
            15 => 'height',
            16 => 'width',
            17 => 'depth',
            18 => 'weight',
            19 => 'quantity',
            20 => 'no',
            21 => 'minimal_quantity',
            22 => 'no',
            23 => 'no',
            24 => 'description',
            25 => 'no',
            26 => 'no',
            27 => 'no',
            28 => 'meta_title',
            29 => 'no',
            30 => 'no',
            31 => 'no',
            32 => 'image',
            33 => 'customizable',
            34 => 'visibility',
            35 => 'delivery_time',
            36 => 'features',
            37 => 'no',
            38 => 'no',
            39 => 'no',
            40 => 'no',
            41 => 'manufacturer',


        ),
    );
}


$import = New AdminImportControllerCore();
loadProductsPost();
$import->productImport();


echo ('ejecutado');
?>

 

GeoPixel

GeoPixel

Buenos días,

Estoy realizando una importación de productos por .CSVmediante un script en php.

La importación se realiza correctamente con todos los campos menos las imagenes.

Dejo el código de la importación al final de la consulta.

Las imagenes las inserto mediante URL ( https://www.URL.com/resources/img/products/28231g.jpg )

Debo añadir algo al script para que se importen las imagenes o es necesario tocar alguna otra cosa para que me las reconozca?

 

<?php
header("Content-Type: text/html;charset=utf-8");
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

define('_PS_ADMIN_DIR_', getcwd());

//include_once(_PS_ADMIN_DIR_ . '/../config/settings.inc.php');
include_once(_PS_ADMIN_DIR_ . '/../config/config.inc.php');


use PrestaShop\PrestaShop\Core\Import\Configuration\ImportConfigInterface;
use PrestaShop\PrestaShop\Adapter\Tools;
use PrestaShop\PrestaShop\Core\ConfigurationInterface;
use PrestaShop\PrestaShop\Core\Hook\HookDispatcherInterface;
use Tools as LegacyTools;

$context = Context::getContext();
$employee = new Employee(1);
$context->employee = $employee;


function loadProductsPost() {

    $_POST = array (
        'tab' => 'AdminImport',
        'forceIDs' => '0',
        'skip' => '1',
        'csv' => 'productos.csv',
        'entity' => '1',
        'separator' => ';',
        'multiple_value_separator' => ',',
        'iso_lang' => 'es',
        'convert' => '',
        'import' => 'Importar datos csv',
        'type_value' => array(
            0 => 'id',
            1 => 'active',
            2 => 'no', //revisar
            3 => 'category',
            4 => 'price_tex',
            5 => 'id_tax_rules_group',
            6 => 'on_sale',
            7 => 'reduction_price',
            8 => 'reduction_percent',
            9 => 'reduction_from',
            10 => 'reduction_to',
            11 => 'reference',
            12 => 'supplier_reference',
            13 => 'supplier',
            14 => 'ean13',
            15 => 'height',
            16 => 'width',
            17 => 'depth',
            18 => 'weight',
            19 => 'quantity',
            20 => 'no',
            21 => 'minimal_quantity',
            22 => 'no',
            23 => 'no',
            24 => 'description',
            25 => 'no',
            26 => 'no',
            27 => 'no',
            28 => 'meta_title',
            29 => 'no',
            30 => 'no',
            31 => 'no',
            32 => 'image',
            33 => 'customizable',
            34 => 'visibility',
            35 => 'delivery_time',
            36 => 'features',
            37 => 'no',
            38 => 'no',
            39 => 'no',
            40 => 'no',
            41 => 'manufacturer',


        ),
    );
}


$import = New AdminImportControllerCore();
loadProductsPost();
$import->productImport();


echo ('ejecutado');
?>

 

×
×
  • Create New...