Files
interblue.pl/modules/pshowimporter/classes/PShow_Import_Feature.php
2024-10-25 14:16:28 +02:00

59 lines
1.5 KiB
PHP

<?php
/**
* File from http://PrestaShow.pl
*
* DISCLAIMER
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future.
*
* @authors PrestaShow.pl <kontakt@prestashow.pl>
* @copyright 2015 PrestaShow.pl
* @license http://PrestaShow.pl/license
*/
class PShow_Import_Feature extends PShow_Import_Object_Abstract
{
/**
* getNewObject()
*
* get new or existing object
*/
public function getNewObject($id = null)
{
if (array_key_exists('id_feature', $this->data)) {
try {
return parent::getNewObject((int) $this->data['id_feature'][0]);
} catch (PrestaShopDatabaseException $ex) {
return false;
}
}
return parent::getNewObject();
}
protected function _import($key, &$_value)
{
$classname = $this->getObjectName();
$thisObject = &PShow_Import::$objects[$classname];
if (!parent::_import($key, $_value)) {
return false;
}
$value = $_value;
switch ($key) {
default:
if (is_array($value))
$value = reset($value);
if (array_key_exists('lang', $classname::$definition['fields'][$key])) {
$this->prepareLangField(PShow_Import::$objects[$classname]->{$key}, $value);
} else {
PShow_Import::$objects[$classname]->$key = $value;
}
break;
}
}
}