CsvImport
in package
CSV Import
Tags
Table of Contents
Properties
- $arrName2Fieldname : mixed
- $arrTemplateArray : mixed
- $delimiter : mixed
- $escapor : mixed
- $separator : mixed
Methods
- __construct() : mixed
- DBfieldsName() : mixed
- getAvailableNamesMenuOptions() : array<string|int, mixed>
- Return the menu options of available names that can be assigned to the fields of the file to be imported.
- getCategoryId() : int
- Returns the ID of the ShopCategory with the given name and parent ID, if present.
- GetFileContent() : array<string|int, mixed>
- Get the file content from the csv file
- getFilefieldMenuOptions() : string
- Get the file field menu options
- GetFirstCat() : int
- Returns the ID of the first ShopCategory found in the database.
- GetImageChoice() : mixed
- GetImgListDelete() : mixed
- getNameArray() : array<string|int, mixed>
- Returns an array of template names, indexed by respective IDs
- getTemplateArray() : mixed
- initTemplateArray() : mixed
- InsertNewCat() : int
- Insert a new ShopCategory into the database.
Properties
$arrName2Fieldname
private
mixed
$arrName2Fieldname
= false
$arrTemplateArray
private
mixed
$arrTemplateArray
= false
$delimiter
private
static mixed
$delimiter
= '"'
$escapor
private
static mixed
$escapor
= '"'
$separator
private
static mixed
$separator
= ';'
Methods
__construct()
public
__construct() : mixed
DBfieldsName()
public
DBfieldsName([mixed $name = '' ]) : mixed
Parameters
- $name : mixed = ''
getAvailableNamesMenuOptions()
Return the menu options of available names that can be assigned to the fields of the file to be imported.
public
getAvailableNamesMenuOptions() : array<string|int, mixed>
Return values
array<string|int, mixed> —The available names
getCategoryId()
Returns the ID of the ShopCategory with the given name and parent ID, if present.
public
static getCategoryId(string $catName[, int $catParent = null ]) : int
If the ShopCategory cannot be found, a new ShopCategory with the given name is inserted and its ID returned.
Parameters
- $catName : string
-
The ShopCategory name
- $catParent : int = null
-
The optional parent ShopCategory ID, or null to ignore it (default)
Tags
Return values
int —The ID of the ShopCategory, or 0 on failure.
GetFileContent()
Get the file content from the csv file
public
GetFileContent(string $file) : array<string|int, mixed>
Parameters
- $file : string
-
file name with path
Return values
array<string|int, mixed>getFilefieldMenuOptions()
Get the file field menu options
public
getFilefieldMenuOptions(string $file) : string
Parameters
- $file : string
-
file name with path
Return values
stringGetFirstCat()
Returns the ID of the first ShopCategory found in the database.
public
static GetFirstCat() : int
If none is available, a default ShopCateogry named 'Import' is inserted and its ID returned instead.
Tags
Return values
int —The ShopCategory, or 0 on failure
GetImageChoice()
public
GetImageChoice() : mixed
GetImgListDelete()
public
GetImgListDelete(mixed $DeleteText) : mixed
Parameters
- $DeleteText : mixed
getNameArray()
Returns an array of template names, indexed by respective IDs
public
getNameArray() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —The array of template names
getTemplateArray()
public
getTemplateArray() : mixed
initTemplateArray()
public
initTemplateArray() : mixed
InsertNewCat()
Insert a new ShopCategory into the database.
public
static InsertNewCat(string $catName, int $catParent) : int
Parameters
- $catName : string
-
The new ShopCategory name
- $catParent : int
-
The parent ShopCategory ID
Tags
Return values
int —The ID of the new ShopCategory, or 0 on failure.