ePages 6.15.1 - DE_EPAGES/Picalike/API/CSV/PicalikeExportDriver.pm

Package DE_EPAGES::Picalike::API::CSV::PicalikeExportDriver

This module implements a csv driver to export object Picalike products

Example
use DE_EPAGES::Picalike::API::CSV::PicalikeExportDriver;

my $Driver = DE_EPAGES::Picalike::API::CSV::PicalikeExportDriver->new(
    Handler => $Handler
);
$Driver->exportCSV;

Functions

allProducts
exportCSV
exportLine
getExportValues
isProductValid
writeHeader

allProducts

Returns the product identifiers to be exported. If the option "ExportAllVariation" is selected all SubProducts of a MasterProduct are exported, else only default SubProducts are exported.

Syntax
$aProductIDs = $self->allProducts;
Return
$aProductIDs (ref.array.int)
product identifier

exportCSV

exports data (2 dim. array) into a file. sets default file format parameters : sep_char = ";" , always_quote = 1 , encoding = utf8

Syntax
$Exporter->exportCSV($FileName, $hFormat, $aColumns, $ViewObject, $aObjects );
Input
$FileName (string)
export file
$hFormat (ref.hash)
export file format
$aColumns (attribute object)
column attributes (used for header and values)
$ViewObject (object)
object to view monitor should be the shop
$aObjects (ref.array.object)
list of objects
Return
status of succeeded export

exportLine

Writes one line to the CSV file. Gets the values of the current export item from the function getValues. Increments the monitor counter if defined $self->monitor.

Syntax
$self->exportLine();
Return
$self->writeLine($self->getExportValues($Object));

getExportValues

helper method of exportLine to convert column names to methods names of this exporter and calls the method to get the values of the exported object. The order of return values depends on order of column names.

Syntax
$self->getExportValues($Product);
Input
$Product (object)
product
Return
$aValues (ref.array.string)
list of values

isProductValid

Throws error if not valid, (not visible).

Syntax
$self->isProductValid;
Input
$Product (object)
product
Return
true if no error occurs

writeHeader

Writes the header line using the attribute names of the columns.

Syntax
$self->writeHeader();