Class Mage_ImportExport_Model_Import_Entity_Product

Description

Import entity product model

Located in /ImportExport/Model/Import/Entity/Product.php (line 34)

Mage_ImportExport_Model_Import_Entity_Abstract
   |
   --Mage_ImportExport_Model_Import_Entity_Product
Class Constant Summary
BUNCH_SIZE = 20
COL_ATTR_SET = '_attribute_set'
COL_CATEGORY = '_category'
COL_SKU = 'sku'
COL_STORE = '_store'
COL_TYPE = '_type'
CONFIG_KEY_PRODUCT_TYPES = 'global/importexport/import_product_types'
ERROR_CHANGE_ATTR_SET = 'changeAttrSet'
ERROR_CHANGE_TYPE = 'changeProductType'
ERROR_DUPLICATE_SCOPE = 'duplicateScope'
ERROR_DUPLICATE_SKU = 'duplicateSKU'
ERROR_INVALID_ATTR_SET = 'invalidAttrSet'
ERROR_INVALID_CATEGORY = 'invalidCategory'
ERROR_INVALID_SCOPE = 'invalidScope'
ERROR_INVALID_STORE = 'invalidStore'
ERROR_INVALID_TIER_PRICE_GROUP = 'tierPriceGroupInvalid'
ERROR_INVALID_TIER_PRICE_QTY = 'invalidTierPriceOrQty'
ERROR_INVALID_TIER_PRICE_SITE = 'tierPriceWebsiteInvalid'
ERROR_INVALID_TYPE = 'invalidType'
ERROR_INVALID_WEBSITE = 'invalidWebsite'
ERROR_NO_DEFAULT_ROW = 'noDefaultRow'
ERROR_ROW_IS_ORPHAN = 'rowIsOrphan'
ERROR_SKU_IS_EMPTY = 'skuEmpty'
ERROR_SKU_NOT_FOUND_FOR_DELETE = 'skuNotFoundToDelete'
ERROR_TIER_DATA_INCOMPLETE = 'tierPriceDataIsIncomplete'
ERROR_TYPE_CHANGED = 'typeChanged'
ERROR_TYPE_UNSUPPORTED = 'productTypeUnsupported'
ERROR_VALUE_IS_REQUIRED = 'isRequired'
SCOPE_NULL = -1
VALUE_ALL = 'all'
Variable Summary
Method Summary
void __construct ()
Varien_Db_Adapter_Pdo_Mysql getConnection ()
string getEntityTypeCode ()
array getNewSku ()
array|null getNextBunch ()
array getOldSku ()
int getRowScope ( $rowData)
array getWebsiteCodes ()
boolean validateRow ( $rowData, int $rowNum)
bool _importData ()
bool _isProductCategoryValid ( $rowData, int $rowNum)
bool _isProductWebsiteValid ( $rowData, int $rowNum)
bool _isTierPriceValid ( $rowData, int $rowNum)
array _prepareRowForDb ( $rowData)
Variables
array $_attrSetIdToName = array() (line 98)

Pairs of attribute set ID-to-name.

  • access: protected
array $_attrSetNameToId = array() (line 105)

Pairs of attribute set name-to-ID.

  • access: protected
array $_categories = array() (line 112)

Categories text-path to ID hash.

  • access: protected
array $_customerGroups = array() (line 119)

Customer groups ID-to-name.

  • access: protected
array $_indexValueAttributes = array(
'status',
'tax_class_id',
'visibility',
'enable_googlecheckout',
'gift_message_available',
'custom_design'
)
(line 126)

Attributes with index (not label) value.

  • access: protected

Redefinition of:
Mage_ImportExport_Model_Import_Entity_Abstract::$_indexValueAttributes
Attributes with index (not label) value.
array $_linkNameToId = array(
'_links_related_' => Mage_Catalog_Model_Product_Link::LINK_TYPE_RELATED,
'_links_crosssell_' => Mage_Catalog_Model_Product_Link::LINK_TYPE_CROSSSELL,
'_links_upsell_' => Mage_Catalog_Model_Product_Link::LINK_TYPE_UPSELL
)
(line 140)

Links attribute name-to-link type ID.

  • access: protected
array $_messageTemplates = array(
self::ERROR_INVALID_SCOPE => 'Invalid value in Scope column',
self::ERROR_INVALID_WEBSITE => 'Invalid value in Website column (website does not exists?)',
self::ERROR_INVALID_STORE => 'Invalid value in Store column (store does not exists?)',
self::ERROR_INVALID_ATTR_SET => 'Invalid value for Attribute Set column (set does not exists?)',
self::ERROR_INVALID_TYPE => 'Product Type is invalid or not supported',
self::ERROR_INVALID_CATEGORY => 'Category does not exists',
self::ERROR_VALUE_IS_REQUIRED => "Required attribute '%s' has an empty value",
self::ERROR_TYPE_CHANGED => 'Trying to change type of existing products',
self::ERROR_SKU_IS_EMPTY => 'SKU is empty',
self::ERROR_NO_DEFAULT_ROW => 'Default values row does not exists',
self::ERROR_CHANGE_TYPE => 'Product type change is not allowed',
self::ERROR_DUPLICATE_SCOPE => 'Duplicate scope',
self::ERROR_DUPLICATE_SKU => 'Duplicate SKU',
self::ERROR_CHANGE_ATTR_SET => 'Product attribute set change is not allowed',
self::ERROR_TYPE_UNSUPPORTED => 'Product type is not supported',
self::ERROR_ROW_IS_ORPHAN => 'Orphan rows that will be skipped due default row errors',
self::ERROR_INVALID_TIER_PRICE_QTY => 'Tier Price data price or quantity value is invalid',
self::ERROR_INVALID_TIER_PRICE_SITE => 'Tier Price data website is invalid',
self::ERROR_INVALID_TIER_PRICE_GROUP => 'Tier Price customer group ID is invalid',
self::ERROR_TIER_DATA_INCOMPLETE => 'Tier Price data is incomplete',
self::ERROR_SKU_NOT_FOUND_FOR_DELETE => 'Product with specified SKU not found'
)
(line 151)

Validation failure message template definitions

  • access: protected

Redefinition of:
Mage_ImportExport_Model_Import_Entity_Abstract::$_messageTemplates
Validation failure message template definitions.
array $_newSku = array() (line 187)

Dry-runned products information from import file.

[SKU] => array( 'type_id' => (string) product type 'attr_set_id' => (int) product attribute set ID 'entity_id' => (int) product ID (value for new products will be set after entity save) 'attr_set_code' => (string) attribute set code )

  • access: protected
array $_oldSku = array() (line 201)

Existing products SKU-related information in form of array:

[SKU] => array( 'type_id' => (string) product type 'attr_set_id' => (int) product attribute set ID 'entity_id' => (int) product ID 'supported_type' => (boolean) is product type supported by current version of import module )

  • access: protected
array $_particularAttributes = array(
'_store', '_attribute_set', '_type', '_category', '_product_websites', '_tier_price_website',
'_tier_price_customer_group', '_tier_price_qty', '_tier_price_price', '_links_related_sku',
'_links_related_position', '_links_crosssell_sku', '_links_crosssell_position', '_links_upsell_sku',
'_links_upsell_position', '_custom_option_store', '_custom_option_type', '_custom_option_title',
'_custom_option_is_required', '_custom_option_price', '_custom_option_sku', '_custom_option_max_characters',
'_custom_option_sort_order', '_custom_option_file_extension', '_custom_option_image_size_x',
'_custom_option_image_size_y', '_custom_option_row_title', '_custom_option_row_price',
'_custom_option_row_sku', '_custom_option_row_sort'
)
(line 208)

Column names that holds values with particular meaning.

  • access: protected

Redefinition of:
Mage_ImportExport_Model_Import_Entity_Abstract::$_particularAttributes
Column names that holds values with particular meaning.
array $_permanentAttributes = array(self::COL_SKU) (line 224)

Permanent entity columns.

  • access: protected

Redefinition of:
Mage_ImportExport_Model_Import_Entity_Abstract::$_permanentAttributes
Permanent entity columns.
array $_productTypeModels = array() (line 231)

Array of supported product types as keys with appropriate model object as value.

  • access: protected
array $_storeCodeToId = array() (line 238)

All stores code-ID pairs.

  • access: protected
array $_storeIdToWebsiteStoreIds = array() (line 245)

Store ID to its website stores IDs.

  • access: protected
array $_websiteCodeToId = array() (line 252)

Website code-to-ID

  • access: protected
array $_websiteCodeToStoreIds = array() (line 259)

Website code to store code-to-ID pairs which it consists.

  • access: protected

Inherited Variables

Inherited from Mage_ImportExport_Model_Import_Entity_Abstract

Mage_ImportExport_Model_Import_Entity_Abstract::$_connection
Mage_ImportExport_Model_Import_Entity_Abstract::$_dataSourceModel
Mage_ImportExport_Model_Import_Entity_Abstract::$_dataValidated
Mage_ImportExport_Model_Import_Entity_Abstract::$_entityTypeId
Mage_ImportExport_Model_Import_Entity_Abstract::$_errors
Mage_ImportExport_Model_Import_Entity_Abstract::$_errorsCount
Mage_ImportExport_Model_Import_Entity_Abstract::$_errorsLimit
Mage_ImportExport_Model_Import_Entity_Abstract::$_importAllowed
Mage_ImportExport_Model_Import_Entity_Abstract::$_invalidRows
Mage_ImportExport_Model_Import_Entity_Abstract::$_notices
Mage_ImportExport_Model_Import_Entity_Abstract::$_parameters
Mage_ImportExport_Model_Import_Entity_Abstract::$_processedEntitiesCount
Mage_ImportExport_Model_Import_Entity_Abstract::$_processedRowsCount
Mage_ImportExport_Model_Import_Entity_Abstract::$_rowsToSkip
Mage_ImportExport_Model_Import_Entity_Abstract::$_source
Mage_ImportExport_Model_Import_Entity_Abstract::$_validatedRows
Methods
Constructor __construct (line 266)

Constructor.

  • access: public
void __construct ()

Redefinition of:
Mage_ImportExport_Model_Import_Entity_Abstract::__construct()
Constructor.
getAttrSetIdToName (line 1292)

Atttribute set ID-to-name pairs getter.

  • access: public
array getAttrSetIdToName ()
getConnection (line 1302)

DB connection getter.

  • access: public
Varien_Db_Adapter_Pdo_Mysql getConnection ()
getEntityTypeCode (line 1313)

EAV entity type code getter.

  • abstract:
  • access: public
string getEntityTypeCode ()

Redefinition of:
Mage_ImportExport_Model_Import_Entity_Abstract::getEntityTypeCode()
EAV entity type code getter.
getNewSku (line 1323)

New products SKU data.

  • access: public
array getNewSku ()
getNextBunch (line 1333)

Get next bunch of validatetd rows.

  • access: public
array|null getNextBunch ()
getOldSku (line 1343)

Existing products SKU getter.

  • access: public
array getOldSku ()
getRowScope (line 1354)

Obtain scope of the row from row data.

  • access: public
int getRowScope ( $rowData)
  • array $rowData
getWebsiteCodes (line 1370)

All website codes to ID getter.

  • access: public
array getWebsiteCodes ()
validateRow (line 1382)

Validate data row.

  • access: public
boolean validateRow ( $rowData, int $rowNum)
  • array $rowData
  • int $rowNum

Redefinition of:
Mage_ImportExport_Model_Import_Entity_Abstract::validateRow()
Validate data row.
_deleteProducts (line 284)

Delete products.

  • access: protected
_importData (line 313)

Create Product entity from raw data.

  • return: Result of operation.
  • throws: Exception
  • access: protected
bool _importData ()

Redefinition of:
Mage_ImportExport_Model_Import_Entity_Abstract::_importData()
Import data rows.
_initAttributeSets (line 334)

Initialize attribute sets code-to-id pairs.

  • access: protected
_initCategories (line 349)

Initialize categories text-path to ID hash.

  • access: protected
_initCustomerGroups (line 372)

Initialize customer groups.

  • access: protected
_initSkus (line 385)

Initialize existent product SKUs.

  • access: protected
_initStores (line 405)

Initialize stores hash.

  • access: protected
_initTypeModels (line 420)

Initialize product type models.

  • throws: Exception
  • access: protected
_initWebsites (line 451)

Initialize website values.

  • access: protected
_isProductCategoryValid (line 468)

Check product category validity.

  • access: protected
bool _isProductCategoryValid ( $rowData, int $rowNum)
  • array $rowData
  • int $rowNum
_isProductWebsiteValid (line 484)

Check product website belonging.

  • access: protected
bool _isProductWebsiteValid ( $rowData, int $rowNum)
  • array $rowData
  • int $rowNum
_isTierPriceValid (line 525)

Check tier orice data validity.

  • access: protected
bool _isTierPriceValid ( $rowData, int $rowNum)
  • array $rowData
  • int $rowNum
_prepareRowForDb (line 500)

Set valid attribute set and product type to rows with all scopes to ensure that existing products doesn't changed.

  • access: protected
array _prepareRowForDb ( $rowData)
  • array $rowData

Redefinition of:
Mage_ImportExport_Model_Import_Entity_Abstract::_prepareRowForDb()
Change row data before saving in DB table.
_saveCustomOptions (line 560)

Custom options save.

  • access: protected
_saveLinks (line 816)

Gather and save information about product links.

Must be called after ALL products saving done.

  • access: protected
_saveProductAttributes (line 910)

Save product attributes.

  • access: protected
Mage_ImportExport_Model_Import_Entity_Product _saveProductAttributes ( $attributesData)
  • array $attributesData
_saveProductCategories (line 941)

Save product categories.

  • access: protected
Mage_ImportExport_Model_Import_Entity_Product _saveProductCategories ( $categoriesData)
  • array $categoriesData
_saveProductEntity (line 980)

Update and insert data in entity table.

  • access: protected
Mage_ImportExport_Model_Import_Entity_Product _saveProductEntity ( $entityRowsIn,  $entityRowsUp)
  • array $entityRowsIn: Row for insert
  • array $entityRowsUp: Row for update
_saveProducts (line 1013)

Gather and save information about product entities.

  • access: protected
_saveProductTierPrices (line 1139)

Save product tier prices.

  • access: protected
Mage_ImportExport_Model_Import_Entity_Product _saveProductTierPrices ( $tierPriceData)
  • array $tierPriceData
_saveProductWebsites (line 1179)

Save product websites.

  • access: protected
Mage_ImportExport_Model_Import_Entity_Product _saveProductWebsites ( $websiteData)
  • array $websiteData
_saveStockItem (line 1219)

Stock item saving.

  • access: protected

Inherited Methods

Inherited From Mage_ImportExport_Model_Import_Entity_Abstract

Mage_ImportExport_Model_Import_Entity_Abstract::__construct()
Mage_ImportExport_Model_Import_Entity_Abstract::addMessageTemplate()
Mage_ImportExport_Model_Import_Entity_Abstract::addRowError()
Mage_ImportExport_Model_Import_Entity_Abstract::getAttributeOptions()
Mage_ImportExport_Model_Import_Entity_Abstract::getBehavior()
Mage_ImportExport_Model_Import_Entity_Abstract::getEntityTypeCode()
Mage_ImportExport_Model_Import_Entity_Abstract::getEntityTypeId()
Mage_ImportExport_Model_Import_Entity_Abstract::getErrorMessages()
Mage_ImportExport_Model_Import_Entity_Abstract::getErrorsCount()
Mage_ImportExport_Model_Import_Entity_Abstract::getErrorsLimit()
Mage_ImportExport_Model_Import_Entity_Abstract::getInvalidRowsCount()
Mage_ImportExport_Model_Import_Entity_Abstract::getNextAutoincrement()
Mage_ImportExport_Model_Import_Entity_Abstract::getNotices()
Mage_ImportExport_Model_Import_Entity_Abstract::getProcessedEntitiesCount()
Mage_ImportExport_Model_Import_Entity_Abstract::getProcessedRowsCount()
Mage_ImportExport_Model_Import_Entity_Abstract::getSource()
Mage_ImportExport_Model_Import_Entity_Abstract::importData()
Mage_ImportExport_Model_Import_Entity_Abstract::isAttributeParticular()
Mage_ImportExport_Model_Import_Entity_Abstract::isAttributeValid()
Mage_ImportExport_Model_Import_Entity_Abstract::isDataValid()
Mage_ImportExport_Model_Import_Entity_Abstract::isImportAllowed()
Mage_ImportExport_Model_Import_Entity_Abstract::isRowAllowedToImport()
Mage_ImportExport_Model_Import_Entity_Abstract::setParameters()
Mage_ImportExport_Model_Import_Entity_Abstract::setSource()
Mage_ImportExport_Model_Import_Entity_Abstract::validateData()
Mage_ImportExport_Model_Import_Entity_Abstract::validateRow()
Mage_ImportExport_Model_Import_Entity_Abstract::_getSource()
Mage_ImportExport_Model_Import_Entity_Abstract::_importData()
Mage_ImportExport_Model_Import_Entity_Abstract::_isRowScopeDefault()
Mage_ImportExport_Model_Import_Entity_Abstract::_prepareRowForDb()
Mage_ImportExport_Model_Import_Entity_Abstract::_saveValidatedBunches()
Class Constants
BUNCH_SIZE = 20 (line 41)

Size of bunch - part of products to save in one step.

COL_ATTR_SET = '_attribute_set' (line 63)
COL_CATEGORY = '_category' (line 65)
COL_SKU = 'sku' (line 66)
COL_STORE = '_store' (line 62)

Permanent column names.

Names that begins with underscore is not an attribute. This name convention is for to avoid interference with same attribute name.

COL_TYPE = '_type' (line 64)
CONFIG_KEY_PRODUCT_TYPES = 'global/importexport/import_product_types' (line 36)
ERROR_CHANGE_ATTR_SET = 'changeAttrSet' (line 84)
ERROR_CHANGE_TYPE = 'changeProductType' (line 81)
ERROR_DUPLICATE_SCOPE = 'duplicateScope' (line 82)
ERROR_DUPLICATE_SKU = 'duplicateSKU' (line 83)
ERROR_INVALID_ATTR_SET = 'invalidAttrSet' (line 74)
ERROR_INVALID_CATEGORY = 'invalidCategory' (line 76)
ERROR_INVALID_SCOPE = 'invalidScope' (line 71)

Error codes.

ERROR_INVALID_STORE = 'invalidStore' (line 73)
ERROR_INVALID_TIER_PRICE_GROUP = 'tierPriceGroupInvalid' (line 89)
ERROR_INVALID_TIER_PRICE_QTY = 'invalidTierPriceOrQty' (line 87)
ERROR_INVALID_TIER_PRICE_SITE = 'tierPriceWebsiteInvalid' (line 88)
ERROR_INVALID_TYPE = 'invalidType' (line 75)
ERROR_INVALID_WEBSITE = 'invalidWebsite' (line 72)
ERROR_NO_DEFAULT_ROW = 'noDefaultRow' (line 80)
ERROR_ROW_IS_ORPHAN = 'rowIsOrphan' (line 86)
ERROR_SKU_IS_EMPTY = 'skuEmpty' (line 79)
ERROR_SKU_NOT_FOUND_FOR_DELETE = 'skuNotFoundToDelete' (line 91)
ERROR_TIER_DATA_INCOMPLETE = 'tierPriceDataIsIncomplete' (line 90)
ERROR_TYPE_CHANGED = 'typeChanged' (line 78)
ERROR_TYPE_UNSUPPORTED = 'productTypeUnsupported' (line 85)
ERROR_VALUE_IS_REQUIRED = 'isRequired' (line 77)
SCOPE_DEFAULT = 1 (line 51)

Data row scopes.

SCOPE_NULL = -1 (line 54)
SCOPE_STORE = 0 (line 53)
SCOPE_WEBSITE = 2 (line 52)
VALUE_ALL = 'all' (line 46)

Value that means all entities (e.g. websites, groups etc.)

Inherited Constants

Inherited from Mage_ImportExport_Model_Import_Entity_Abstract

Mage_ImportExport_Model_Import_Entity_Abstract::DB_MAX_PACKET_COEFFICIENT
Mage_ImportExport_Model_Import_Entity_Abstract::DB_MAX_PACKET_DATA
Mage_ImportExport_Model_Import_Entity_Abstract::DB_MAX_TEXT_LENGTH
Mage_ImportExport_Model_Import_Entity_Abstract::DB_MAX_VARCHAR_LENGTH

Documentation generated on Fri, 11 Feb 2011 17:10:23 +0200 by phpDocumentor 1.4.3