Documentation

Shop_Item_Import_Csv_Controller extends Core_Servant_Properties
in package

Import Csv Controller

Доступные методы:

  • encoding('UTF-8') кодировка импорта
  • file('my.csv') имя импортируемого CSV-файла, который ранее был загружен во временную директорию
  • seek($int) позиция в файле импорта
  • time(20) ограничение времени импорта за шаг, из конфигурационного файла, по умолчанию 20
  • step(100) ограничение количества импортируемых за шаг, из конфигурационного файла, по умолчанию 100
  • entriesLimit(500) ограничение количества проводок в документе, из конфигурационного файла, по умолчанию 5000
  • separator($str) разделитель столбцов в CSV-файле, по умолчанию ';'
  • limiter() ограничитель строки в CSV-файле, по умолчанию '"'
  • firstlineheader(TRUE|FALSE) первая строка - название полей
  • csv_fields(array) массив соответствий полей CSV сущностям системы HostCMS
  • imagesPath($str) путь к импортируемым картинкам, конкатенируется с переденными в файле
  • importAction($int) действие с существующими товарами: 1 - обновить существующие товары, 2 - не обновлять существующие товары, 3 - удалить содержимое магазина до импорта. По умолчанию 1
  • searchIndexation(TRUE|FALSE) индексировать импортируемые данные, по умолчанию FALSE
  • deletePropertyValues(TRUE|FALSE|array()) удалять существующие значения дополнительных свойств перед импортом новых, по умолчанию TRUE
  • deleteUnsentModificationsByProperties(TRUE|FALSE) удалять непереданные модификации, созданные по дополнительным свойствам, по умолчанию FALSE
  • deleteImage(TRUE|FALSE) удалять основные изображения
Tags
subpackage

Shop

version
7.x
author

Hostmake LLC

copyright

© 2005-2022 ООО "Хостмэйк" (Hostmake LLC), http://www.hostcms.ru

Table of Contents

$aEntities  : mixed
$_aAdditionalGroups  : array<string|int, mixed>
List of additional group
$_aBarcodes  : array<string|int, mixed>
List of barcodes
$_aClearedGroupsPropertyValues  : array<string|int, mixed>
Array of ID's and GUIDs of cleared groups's properties
$_aClearedItemsPropertyValues  : array<string|int, mixed>
Array of ID's and GUIDs of cleared item's properties
$_aConfig  : array<string|int, mixed>
CSV config
$_aCreatedItemIDs  : mixed
IDs of created shop_items
$_aExternalPrices  : array<string|int, mixed>
List of external prices Вспомогательные массивы данных
$_aExternalProperties  : array<string|int, mixed>
List of goods' external properties
$_aExternalPropertiesDesc  : array<string|int, mixed>
List of descriptions of external properties
$_aExternalPropertiesSmall  : array<string|int, mixed>
List of small parts of external properties
$_aGroupExternalProperties  : array<string|int, mixed>
List of group's external properties
$_aInsertedGroupIDs  : array<string|int, mixed>
Array of inserted groups
$_aInsertedItemIDs  : array<string|int, mixed>
Array of inserted items
$_aItemTabs  : array<string|int, mixed>
List of item's tabs
$_allowedProperties  : array<string|int, mixed>
Allowed object properties
$_aModificationsByProperties  : array<string|int, mixed>
List of modification by properties
$_aPropertiesTree  : mixed
$_aPropertyDirsTree  : mixed
$_aSets  : array<string|int, mixed>
List of items GUID in the set
$_aShop_Warehouse_Inventory_Counts  : mixed
$_aShop_Warehouse_Inventory_Ids  : mixed
$_aShop_Warehouse_Inventory_Previous_Ids  : mixed
$_aTags  : mixed
Array of cached tags
$_aUpdatedGroupIDs  : array<string|int, mixed>
Array of updated groups
$_aUpdatedItemIDs  : array<string|int, mixed>
Array of updated items
$_aWarehouses  : array<string|int, mixed>
List of warehouses
$_iCurrentGroupId  : int
ID of current group
$_iCurrentShopId  : int
ID of current shop
$_InsertedGroupsCount  : int
Count of inserted groups
$_InsertedItemsCount  : int
Count of inserted items
$_jsonPath  : null|string
Path to the temprorary json file
$_oCurrentGroup  : Shop_Group_Model
Current group
$_oCurrentItem  : Shop_Item_Model
Current item
$_oCurrentOrder  : Shop_Item_Model
Current order
$_oCurrentOrderItem  : Shop_Order_Item_Model
Current order item
$_oCurrentShop  : Shop_Model
Current shop
$_oCurrentShopEItem  : Shop_Item_Digital_Model
Current digital item Текущий электронный товар
$_oCurrentShopSpecialPrice  : Shop_Specialprice_Model
Current special price Текущая специальная цена для товара
$_oShop_Price_Setting_Count  : mixed
$_oShop_Price_Setting_Id  : mixed
$_oShop_Price_Setting_Previous_Ids  : mixed
$_posted  : mixed
$_propertiesValues  : array<string|int, mixed>
Properties values
$_sAssociatedItemMark  : string
Mark of associated item Артикул родительского товара - признак того, что данный товар сопутствует товару с данным артикулом
$_sBigImageFile  : string
Path of the big image
$_sCurrentTags  : string
Current tags
$_sSmallImageFile  : string
Path of the small image
$_unlimitedProperties  : bool
Object has unlimited number of properties
$_UpdatedGroupsCount  : int
Count of updated groups
$_UpdatedItemsCount  : int
Count of updated items
__construct()  : mixed
Constructor.
__sleep()  : array<string|int, mixed>
Execute some routine before serialization
__toString()  : string
Convert object to string
__wakeup()  : self
Reestablish any database connections that may have been lost during serialization and perform other reinitialization tasks
addAllowedProperties()  : self
Add additional allowed properties
addAllowedProperty()  : self
Add additional allowed property
addField()  : mixed
Add Field
addFieldAsArray()  : mixed
Add Field
clear()  : self
Clear object
CorrectToEncoding()  : array<string|int, mixed>
Correct CSV-line encoding
deleteUploadedFile()  : bool
Delete uploaded CSV file
getCSVLine()  : array<string|int, mixed>
Get CSV line from file
getCurrentItem()  : Shop_Item_Model
Get $this->_oCurrentItem
getCurrentOrder()  : Shop_Order_Model
Get $this->_oCurrentOrder
getCurrentShop()  : Shop_Model
Get $this->_oCurrentShop
getFilePath()  : string
Get the full path of the CSV file
getInsertedGroupsCount()  : int
Get inserted groups count
getInsertedItemsCount()  : int
Get inserted items count
getPosted()  : mixed
getUpdatedGroupsCount()  : int
Get updated groups count
getUpdatedItemsCount()  : int
Get updated items count
import()  : mixed
Импорт CSV
postAll()  : mixed
postNext()  : mixed
set()  : self
Run when writing data to inaccessible properties
setCurrentItem()  : self
Set $this->_oCurrentItem
setCurrentOrder()  : self
Set $this->_oCurrentOrder
setUnlimitedProperties()  : self
Set unlimitedProperties
_addEntitiesOfProperties()  : mixed
_addGroupPropertyValue()  : mixed
Add property to group
_addItemPropertyValue()  : mixed
Add property to item
_allowPropertyForGroup()  : self
Allow Property For Group
_clearWhileLoop()  : mixed
_convertToPunycode()  : string
Convert url to Punycode
_doSaveGroup()  : Shop_Group
Save group
_getInventory()  : mixed
_getPriceSetting()  : mixed
_getTags()  : array<string|int, mixed>
Get cached tags of array
_incInsertedGroups()  : self
Increment inserted groups
_incInsertedItems()  : self
Increment inserted items
_incUpdatedGroups()  : self
Increment updated groups
_incUpdatedItems()  : self
Increment updated items
_setPrices()  : self
Set Prices by $this->_aExternalPrices
_uploadHttpFile()  : mixed
init()  : self
Initialization

Properties

$_aAdditionalGroups

List of additional group

protected array<string|int, mixed> $_aAdditionalGroups = array()

$_aBarcodes

List of barcodes

protected array<string|int, mixed> $_aBarcodes = array()

$_aClearedGroupsPropertyValues

Array of ID's and GUIDs of cleared groups's properties

protected array<string|int, mixed> $_aClearedGroupsPropertyValues = array()

$_aClearedItemsPropertyValues

Array of ID's and GUIDs of cleared item's properties

protected array<string|int, mixed> $_aClearedItemsPropertyValues = array()

$_aConfig

CSV config

protected array<string|int, mixed> $_aConfig = \NULL

$_aCreatedItemIDs

IDs of created shop_items

protected mixed $_aCreatedItemIDs = array()

$_aExternalPrices

List of external prices Вспомогательные массивы данных

protected array<string|int, mixed> $_aExternalPrices = array()

$_aExternalProperties

List of goods' external properties

protected array<string|int, mixed> $_aExternalProperties = array()

$_aExternalPropertiesDesc

List of descriptions of external properties

protected array<string|int, mixed> $_aExternalPropertiesDesc = array()

$_aExternalPropertiesSmall

List of small parts of external properties

protected array<string|int, mixed> $_aExternalPropertiesSmall = array()

$_aGroupExternalProperties

List of group's external properties

protected array<string|int, mixed> $_aGroupExternalProperties = array()

$_aInsertedGroupIDs

Array of inserted groups

protected array<string|int, mixed> $_aInsertedGroupIDs = array()

$_aInsertedItemIDs

Array of inserted items

protected array<string|int, mixed> $_aInsertedItemIDs = array()

$_aItemTabs

List of item's tabs

protected array<string|int, mixed> $_aItemTabs = array()

$_allowedProperties

Allowed object properties

protected array<string|int, mixed> $_allowedProperties = array('encoding', 'file', 'seek', 'time', 'step', 'entriesLimit', 'separator', 'limiter', 'firstlineheader', 'csv_fields', 'imagesPath', 'importAction', 'searchIndexation', 'deletePropertyValues', 'deleteUnsentModificationsByProperties', 'deleteImage')

$_aModificationsByProperties

List of modification by properties

protected array<string|int, mixed> $_aModificationsByProperties = array()

$_aPropertiesTree

protected mixed $_aPropertiesTree = array()

$_aPropertyDirsTree

protected mixed $_aPropertyDirsTree = array()

$_aSets

List of items GUID in the set

protected array<string|int, mixed> $_aSets = array()

$_aShop_Warehouse_Inventory_Counts

protected mixed $_aShop_Warehouse_Inventory_Counts = array()

$_aShop_Warehouse_Inventory_Ids

protected mixed $_aShop_Warehouse_Inventory_Ids = array()

$_aShop_Warehouse_Inventory_Previous_Ids

protected mixed $_aShop_Warehouse_Inventory_Previous_Ids = array()

$_aTags

Array of cached tags

protected mixed $_aTags = \NULL

$_aUpdatedGroupIDs

Array of updated groups

protected array<string|int, mixed> $_aUpdatedGroupIDs = array()

$_aUpdatedItemIDs

Array of updated items

protected array<string|int, mixed> $_aUpdatedItemIDs = array()

$_aWarehouses

List of warehouses

protected array<string|int, mixed> $_aWarehouses = array()

$_iCurrentGroupId

ID of current group

protected int $_iCurrentGroupId = 0

$_iCurrentShopId

ID of current shop

protected int $_iCurrentShopId = 0

$_InsertedGroupsCount

Count of inserted groups

protected int $_InsertedGroupsCount

$_InsertedItemsCount

Count of inserted items

protected int $_InsertedItemsCount

$_jsonPath

Path to the temprorary json file

protected null|string $_jsonPath = \NULL

$_oCurrentShopSpecialPrice

Current special price Текущая специальная цена для товара

protected Shop_Specialprice_Model $_oCurrentShopSpecialPrice

$_oShop_Price_Setting_Count

protected mixed $_oShop_Price_Setting_Count = \NULL

$_oShop_Price_Setting_Id

protected mixed $_oShop_Price_Setting_Id = \NULL

$_oShop_Price_Setting_Previous_Ids

protected mixed $_oShop_Price_Setting_Previous_Ids = array()

$_propertiesValues

Properties values

protected array<string|int, mixed> $_propertiesValues = array()

$_sAssociatedItemMark

Mark of associated item Артикул родительского товара - признак того, что данный товар сопутствует товару с данным артикулом

protected string $_sAssociatedItemMark

$_sBigImageFile

Path of the big image

protected string $_sBigImageFile = ''

$_sCurrentTags

Current tags

protected string $_sCurrentTags

$_sSmallImageFile

Path of the small image

protected string $_sSmallImageFile = ''

$_unlimitedProperties

Object has unlimited number of properties

protected bool $_unlimitedProperties = \FALSE

$_UpdatedGroupsCount

Count of updated groups

protected int $_UpdatedGroupsCount

$_UpdatedItemsCount

Count of updated items

protected int $_UpdatedItemsCount

Methods

__construct()

Constructor.

public __construct(int $iCurrentShopId, int $iCurrentGroupId) : mixed
Parameters
$iCurrentShopId : int

shop ID

$iCurrentGroupId : int

current group ID

Tags
hostcms-event

Shop_Item_Import_Csv_Controller.onAfterConstruct

Return values
mixed

__sleep()

Execute some routine before serialization

public __sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>

__toString()

Convert object to string

public __toString() : string
Return values
string

__wakeup()

Reestablish any database connections that may have been lost during serialization and perform other reinitialization tasks

public __wakeup() : self
Return values
self

addAllowedProperties()

Add additional allowed properties

public addAllowedProperties(array<string|int, mixed> $array) : self
Parameters
$array : array<string|int, mixed>

array of properties' names

Return values
self

addAllowedProperty()

Add additional allowed property

public addAllowedProperty(string $property) : self
Parameters
$property : string

property name

Return values
self

addField()

Add Field

public addField(string $caption, string $color, string $entityName) : mixed
Parameters
$caption : string
$color : string

color, e.g. #AAA

$entityName : string

entity name, e.g. seller_name

Return values
mixed

addFieldAsArray()

Add Field

public addFieldAsArray(string $entityName, array<string|int, mixed> $aField) : mixed
Parameters
$entityName : string

entity name, e.g. seller_name

$aField : array<string|int, mixed>

entity option, e.g. array('caption' => 'Seller Name', 'attr' => array('style' => 'background-color: #AAA'))

Return values
mixed

clear()

Clear object

public clear() : self
Return values
self

CorrectToEncoding()

Correct CSV-line encoding

public static CorrectToEncoding(array<string|int, mixed> $sLine, string $encodeTo[, string $encodeFrom = 'UTF-8' ]) : array<string|int, mixed>
Parameters
$sLine : array<string|int, mixed>

current CSV-file line

$encodeTo : string

detination encoding

$encodeFrom : string = 'UTF-8'

source encoding

Tags
deprecated
6.9.7
Return values
array<string|int, mixed>

deleteUploadedFile()

Delete uploaded CSV file

public deleteUploadedFile() : bool
Return values
bool

getCSVLine()

Get CSV line from file

public getCSVLine(mixed $fileDescriptor) : array<string|int, mixed>
Parameters
$fileDescriptor : mixed
Return values
array<string|int, mixed>

getFilePath()

Get the full path of the CSV file

public getFilePath() : string
Return values
string

getInsertedGroupsCount()

Get inserted groups count

public getInsertedGroupsCount() : int
Return values
int

getInsertedItemsCount()

Get inserted items count

public getInsertedItemsCount() : int
Return values
int

getPosted()

public getPosted() : mixed
Return values
mixed

getUpdatedGroupsCount()

Get updated groups count

public getUpdatedGroupsCount() : int
Return values
int

getUpdatedItemsCount()

Get updated items count

public getUpdatedItemsCount() : int
Return values
int

import()

Импорт CSV

public import() : mixed
Tags
hostcms-event

Shop_Item_Import_Csv_Controller.onBeforeImport

hostcms-event

Shop_Item_Import_Csv_Controller.onAfterImport

hostcms-event

Shop_Item_Import_Csv_Controller.onBeforeSwitch

hostcms-event

Shop_Item_Import_Csv_Controller.onBeforeFindByMarking

hostcms-event

Shop_Item_Import_Csv_Controller.onAfterFindByMarking

hostcms-event

Shop_Item_Import_Csv_Controller.onBeforeAdminUpload

hostcms-event

Shop_Item_Import_Csv_Controller.onBeforeImportItemProperty

hostcms-event

Shop_Item_Import_Csv_Controller.onBeforeCaseDefault

hostcms-event

Shop_Item_Import_Csv_Controller.onBeforeAssociated

hostcms-event

Shop_Item_Import_Csv_Controller.onAfterImportItem

Return values
mixed

postAll()

public postAll() : mixed
Return values
mixed

postNext()

public postNext() : mixed
Return values
mixed

set()

Run when writing data to inaccessible properties

public set(string $property, string $value) : self
Parameters
$property : string

property name

$value : string

property value

Return values
self

setUnlimitedProperties()

Set unlimitedProperties

public setUnlimitedProperties([bool $value = TRUE ]) : self
Parameters
$value : bool = TRUE

default TRUR

Return values
self

_addEntitiesOfProperties()

protected _addEntitiesOfProperties(mixed $prefix, mixed $color, mixed $parent_id, mixed $level) : mixed
Parameters
$prefix : mixed
$color : mixed
$parent_id : mixed
$level : mixed
Return values
mixed

_addGroupPropertyValue()

Add property to group

protected _addGroupPropertyValue(Shop_Group_Model $oShop_Group, Property_Model $oProperty, string $sPropertyValue, mixed $position) : mixed
Parameters
$oShop_Group : Shop_Group_Model
$oProperty : Property_Model
$sPropertyValue : string

property value

$position : mixed
Tags
hostcms-event

Shop_Item_Import_Csv_Controller.onBeforeImportGroupProperty

hostcms-event

Shop_Item_Import_Csv_Controller.onAddGroupPropertyValueDefault

Return values
mixed

_addItemPropertyValue()

Add property to item

protected _addItemPropertyValue(Shop_Item_Model $oShopItem, Property_Model $oProperty, string $sPropertyValue, mixed $position) : mixed
Parameters
$oShopItem : Shop_Item_Model

item

$oProperty : Property_Model
$sPropertyValue : string

property value

$position : mixed
Tags
hostcms-event

Shop_Item_Import_Csv_Controller.onAddItemPropertyValueDefault

Return values
mixed

_allowPropertyForGroup()

Allow Property For Group

protected _allowPropertyForGroup(Property_Model $oProperty, int $shop_group_id) : self
Parameters
$oProperty : Property_Model
$shop_group_id : int
Return values
self

_clearWhileLoop()

protected _clearWhileLoop() : mixed
Return values
mixed

_convertToPunycode()

Convert url to Punycode

protected _convertToPunycode(string $url) : string
Parameters
$url : string
Return values
string

_getInventory()

protected _getInventory(mixed $shop_warehouse_id) : mixed
Parameters
$shop_warehouse_id : mixed
Return values
mixed

_getPriceSetting()

protected _getPriceSetting() : mixed
Return values
mixed

_getTags()

Get cached tags of array

protected _getTags() : array<string|int, mixed>
Return values
array<string|int, mixed>

_incInsertedGroups()

Increment inserted groups

protected _incInsertedGroups(int $iGroupId) : self
Parameters
$iGroupId : int

group ID

Return values
self

_incInsertedItems()

Increment inserted items

protected _incInsertedItems(int $iItemId) : self
Parameters
$iItemId : int

item ID

Return values
self

_incUpdatedGroups()

Increment updated groups

protected _incUpdatedGroups(int $iGroupId) : self
Parameters
$iGroupId : int

group ID

Return values
self

_incUpdatedItems()

Increment updated items

protected _incUpdatedItems(int $iItemId) : self
Parameters
$iItemId : int

item ID

Return values
self

_uploadHttpFile()

protected _uploadHttpFile(mixed $sSourceFile) : mixed
Parameters
$sSourceFile : mixed
Return values
mixed

init()

Initialization

protected init() : self
Return values
self

Search results