/** * attribute handler for datetime attributes * @param int $pid : product id * @param int $ivalue : initial value of attribute * @param array $attrdesc : attribute description * @return mixed : false if no further processing is needed, * string (magento value) for the datetime attribute otherwise */ public function handleDatetimeAttribute($pid, &$item, $storeid, $attrcode, $attrdesc, $ivalue) { $ovalue = deleteifempty(trim($ivalue)); //Handle european date format or other common separators if (preg_match("|([0-9]){1,2}\\D([0-9]){1,2}\\D([0-9]){4}|", $ovalue, $matches)) { $ovalue = sprintf("%4d-%2d-%2d", $matches[3], $matches[2], $matches[1]); } return $ovalue; }
/** * attribute handler for datetime attributes * @param int $pid : product id * @param int $ivalue : initial value of attribute * @param array $attrdesc : attribute description * @return mixed : false if no further processing is needed, * string (magento value) for the datetime attribute otherwise */ public function handleDatetimeAttribute($pid, &$item, $storeid, $attrcode, $attrdesc, $ivalue) { $ovalue = deleteifempty(trim($ivalue)); //Handle european date format if (preg_match("/(\\d){1,2}.(\\d){1,2}.(\\d){4}/", $ovalue, $matches)) { $ovalue = sprintf("%4d-%2d-%2d", $matches[3], $matches[2], $matches[1]); } return $ovalue; }
/** * attribute handler for Text attributes * * @param int $pid * : product id * @param array $item * : item to inges * @param int $storeid * : store for attribute value storage * @param int $attrcode * : attribute code * @param array $attrdesc * : attribute metadata * @param mixed $ivalue * : input value to import * @return new text value to set */ public function handleTextAttribute($pid, &$item, $storeid, $attrcode, $attrdesc, $ivalue) { $dval = $this->getDefaultValue($attrdesc, $ivalue); if ($dval !== null) { return $dval; } $ovalue = deleteifempty($ivalue); return $ovalue; }