本文整理汇总了PHP中is_empty_date函数的典型用法代码示例。如果您正苦于以下问题:PHP is_empty_date函数的具体用法?PHP is_empty_date怎么用?PHP is_empty_date使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_empty_date函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getSearchParam
/**
* Retrieve filter array
*
* @param Enterprise_Search_Model_Resource_Collection $collection
* @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
* @param string|array $value
* @return array
*/
protected function _getSearchParam($collection, $attribute, $value)
{
if (!is_string($value) && empty($value) || is_string($value) && strlen(trim($value)) == 0 || is_array($value) && isset($value['from']) && empty($value['from']) && isset($value['to']) && empty($value['to'])) {
return array();
}
if (!is_array($value)) {
$value = array($value);
}
$field = Mage::getResourceSingleton('enterprise_search/engine')->getSearchEngineFieldName($attribute, 'nav');
if ($attribute->getBackendType() == 'datetime') {
$format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
foreach ($value as &$val) {
if (!is_empty_date($val)) {
$date = new Zend_Date($val, $format);
$val = $date->toString(Zend_Date::ISO_8601) . 'Z';
}
}
unset($val);
}
if (empty($value)) {
return array();
} else {
return array($field => $value);
}
}
示例2: _beforeSave
/**
* Serialize fields for database storage
* @return AW_Autorelated_Model_Blocks
*/
protected function _beforeSave()
{
if ($this->getData('currently_viewed') && is_array($this->getData('currently_viewed'))) {
$this->setData('currently_viewed', @serialize($this->getData('currently_viewed')));
}
if ($this->getData('related_products') && is_array($this->getData('related_products'))) {
$this->setData('related_products', @serialize($this->getData('related_products')));
}
if ($this->getData('customer_groups') !== null && is_array($this->getData('customer_groups'))) {
$this->setData('customer_groups', @implode(',', $this->getData('customer_groups')));
}
if ($this->getData('date_to') && !is_empty_date($this->getData('date_to'))) {
$this->setData('date_to', date(AW_Autorelated_Model_Mysql4_Blocks::MYSQL_DATETIME_FORMAT, strtotime($this->getData('date_to'))));
} else {
$this->setData('date_to', null);
}
if ($this->getData('date_from') && !is_empty_date($this->getData('date_from'))) {
$this->setData('date_from', date(AW_Autorelated_Model_Mysql4_Blocks::MYSQL_DATETIME_FORMAT, strtotime($this->getData('date_from'))));
} else {
$this->setData('date_from', null);
}
if ($this->getData('store') !== null && is_array($this->getData('store'))) {
$this->setData('store', @implode(',', $this->getData('store')));
}
return parent::_beforeSave();
}
示例3: _beforeSave
protected function _beforeSave()
{
if (!$this->getCategory()) {
$this->setCategory('general');
}
if ($this->isDataEmptyFor(array('extension', 'category', 'subject', 'body'))) {
Mage::throwException($this->__('Missing data for item'));
}
if (Mage::getSingleton('ewcore/module')->exists($this->getExtension()) === false) {
Mage::throwException($this->__('Extensions %s does not exist', $this->getExtension()));
}
$this->setUpdatedAt(now());
if (is_empty_date($this->getCreatedAt())) {
$this->setCreatedAt(now());
}
return parent::_beforeSave();
}
示例4: _beforeSave
protected function _beforeSave()
{
$this->searchReplaceFieldValues(array('url', 'body'), '', null);
if ($this->isDataEmptyFor(array('severity', 'category', 'subject', 'reference_id'))) {
Mage::throwException($this->__('Missing data for item'));
}
if (!$this->getStatus()) {
$this->setStatus('enabled');
}
if (!$this->getState()) {
$this->setState('unread');
}
if ($this->isDataEmptyFor(array('sent_at'), 'date')) {
Mage::throwException($this->__('Missing data for item'));
}
$this->setUpdatedAt(now());
if (is_empty_date($this->getCreatedAt())) {
$this->setCreatedAt(now());
}
return parent::_beforeSave();
}
示例5: mapDirectiveSalePriceEffectiveDate
protected function mapDirectiveSalePriceEffectiveDate($params = array())
{
/** @var $product Mage_Catalog_Model_Product */
$product = $this->getProduct();
$assocMapArr = $this->getAssocMaps();
$cDate = Mage::app()->getLocale()->date(null, null, Mage::app()->getLocale()->getDefaultLocale());
$timezone = Mage::app()->getStore($this->getStoreId())->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE);
$cell = "";
if (!$this->hasSpecialPrice($product, $this->getSpecialPrice($product))) {
return $cell;
}
$has_default_qty = $this->_hasDefaultQty($assocMapArr);
$display_min = $this->getConfigVar('grouped_price_display_mode', 'columns');
if ($has_default_qty) {
if ($display_min == RocketWeb_GoogleBaseFeedGenerator_Model_Source_Pricegroupedmode::PRICE_SUM_DEFAULT_QTY) {
$product_from_date = $product_to_date = null;
$from_time = -1;
$to_time = PHP_INT_MAX;
foreach ($assocMapArr as $assocMap) {
$associatedProduct = $assocMap->getProduct();
if ($associatedProduct->getQty() > 0) {
if ($assocMap->hasSpecialPrice($associatedProduct, $assocMap->getSpecialPrice($associatedProduct))) {
if ($assocMap->hasPriceByCatalogRules($associatedProduct)) {
// Current date to cdate + ttl
$fromDate = clone $cDate;
$fromDate->setTime('00:00:00', 'HH:mm:ss');
$toDate = new Zend_Date(null, null, Mage::app()->getLocale()->getDefaultLocale());
if ($timezone) {
$toDate->setTimezone($timezone);
}
$toDate->setDate($cDate->toString('yyyy-MM-dd'), 'yyyy-MM-dd');
$toDate->setTime('23:59:59', 'HH:mm:ss');
$toDate->add((int) $this->getConfigVar('ttl', 'columns'), Zend_Date::DAY);
$compare_from_date = $fromDate->toString('yyyy-MM-dd 00:00:00');
$compare_to_date = $toDate->toString('yyyy-MM-dd 23:59:59');
} else {
$compare_from_date = $associatedProduct->getSpecialFromDate();
$compare_to_date = $associatedProduct->getSpecialToDate();
}
if ($from_time < $this->dateToTime($compare_from_date)) {
$product_from_date = $compare_from_date;
$from_time = $this->dateToTime($product_from_date);
}
if (!is_empty_date($compare_to_date) && $to_time > $this->dateToTime($compare_to_date)) {
$product_to_date = $compare_to_date;
$to_time = $this->dateToTime($product_to_date);
}
}
}
}
} else {
// RocketWeb_GoogleBaseFeedGenerator_Model_Source_Pricegroupedmode::PRICE_START_AT
$minAssocMap = $this->findMinimalPriceProduct($assocMapArr);
if ($minAssocMap === false) {
return $cell;
}
$associatedProduct = $minAssocMap->getProduct();
if ($minAssocMap->hasPriceByCatalogRules($associatedProduct)) {
// Current date to cdate + ttl
$fromDate = clone $cDate;
$fromDate->setTime('00:00:00', 'HH:mm:ss');
$toDate = new Zend_Date(null, null, Mage::app()->getLocale()->getDefaultLocale());
if ($timezone) {
$toDate->setTimezone($timezone);
}
$toDate->setDate($cDate->toString('yyyy-MM-dd'), 'yyyy-MM-dd');
$toDate->setTime('23:59:59', 'HH:mm:ss');
$toDate->add((int) $this->getConfigVar('ttl', 'columns'), Zend_Date::DAY);
$compare_from_date = $fromDate->toString('yyyy-MM-dd 00:00:00');
$compare_to_date = $toDate->toString('yyyy-MM-dd 23:59:59');
} else {
$compare_from_date = $associatedProduct->getSpecialFromDate();
$compare_to_date = $associatedProduct->getSpecialToDate();
}
$product_from_date = $compare_from_date;
$product_to_date = $compare_to_date;
}
} else {
// RocketWeb_GoogleBaseFeedGenerator_Model_Source_Pricegroupedmode::PRICE_START_AT
$minAssocMap = $this->findMinimalPriceProduct($assocMapArr);
if ($minAssocMap === false) {
return $cell;
}
$associatedProduct = $minAssocMap->getProduct();
$product_from_date = $associatedProduct->getSpecialFromDate();
$product_to_date = $associatedProduct->getSpecialToDate();
}
$fromDate = new Zend_Date(null, null, Mage::app()->getLocale()->getDefaultLocale());
if ($timezone) {
$fromDate->setTimezone($timezone);
}
if ($product_from_date) {
$fromDate->setDate(substr($product_from_date, 0, 10), 'yyyy-MM-dd');
$fromDate->setTime(substr($product_from_date, 11, 8), 'HH:mm:ss');
}
$toDate = new Zend_Date(null, null, Mage::app()->getLocale()->getDefaultLocale());
if (!is_empty_date($product_to_date)) {
if ($timezone) {
$toDate->setTimezone($timezone);
}
//.........这里部分代码省略.........
示例6: _getStoreDate
/**
* Retrieve Date value for store
*
* @param int $storeId
* @param string $date
* @return string
*/
protected function _getStoreDate($storeId, $date = null)
{
if (!isset($this->_dates[$storeId])) {
$timezone = Mage::getStoreConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE, $storeId);
$locale = Mage::getStoreConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_LOCALE, $storeId);
$locale = new Zend_Locale($locale);
$dateObj = new Zend_Date(null, null, $locale);
$dateObj->setTimezone($timezone);
$this->_dates[$storeId] = array($dateObj, $locale->getTranslation(null, 'date', $locale));
}
if (!is_empty_date($date)) {
list($dateObj, $format) = $this->_dates[$storeId];
$dateObj->setDate($date, Varien_Date::DATETIME_INTERNAL_FORMAT);
return $dateObj->toString($format);
}
return null;
}
示例7: _addStoreDateFormat
/**
* Transforms specified date to basic YYYY-MM-dd format.
*
* @param int $storeId
* @param string $date
* @return null|string
*/
protected function _addStoreDateFormat($storeId, $date = null)
{
if (!isset($this->_dateFormats[$storeId])) {
$timezone = Mage::getStoreConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE, $storeId);
$locale = Mage::getStoreConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_LOCALE, $storeId);
$locale = new Zend_Locale($locale);
$dateObj = new Zend_Date(null, null, $locale);
$dateObj->setTimezone($timezone);
$this->_dateFormats[$storeId] = array($dateObj, $locale->getTranslation(null, 'date', $locale));
}
if (is_empty_date($date)) {
return null;
}
list($dateObj, $localeDateFormat) = $this->_dateFormats[$storeId];
$dateObj->setDate($date, $localeDateFormat);
return $dateObj->toString('YYYY-MM-dd');
}
示例8: isStoreDateInInterval
/**
* Checks if current date of the given store (in the store timezone) is within the range
*
* @param int|string|Mage_Core_Model_Store $store
* @param string|null $dateFrom
* @param string|null $dateTo
* @return bool
*/
public function isStoreDateInInterval($store, $dateFrom = null, $dateTo = null)
{
if (!$store instanceof Mage_Core_Model_Store) {
$store = Mage::app()->getStore($store);
}
$storeTimeStamp = $this->storeTimeStamp($store);
$fromTimeStamp = strtotime($dateFrom);
$toTimeStamp = strtotime($dateTo);
if ($dateTo) {
// fix date YYYY-MM-DD 00:00:00 to YYYY-MM-DD 23:59:59
$toTimeStamp += 86400;
}
$result = false;
if (!is_empty_date($dateFrom) && $storeTimeStamp < $fromTimeStamp) {
} elseif (!is_empty_date($dateTo) && $storeTimeStamp > $toTimeStamp) {
} else {
$result = true;
}
return $result;
}
示例9: getParams
/**
* Returns an array of searched parameter.
*
* @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
* @param mixed $value
* @return array
*/
public function getParams($attribute, $value)
{
if (empty($value) || isset($value['from']) && empty($value['from']) && isset($value['to']) && empty($value['to'])) {
return false;
}
$fieldName = $this->getFieldName($attribute);
$backendType = $attribute->getBackendType();
if ($backendType == 'datetime') {
$dateFormat = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
if (is_array($value)) {
foreach ($value as &$val) {
if (!is_empty_date($val)) {
$date = new Zend_Date($val, $dateFormat);
$val = $date->toString(Zend_Date::ISO_8601) . 'Z';
}
}
unset($val);
} else {
if (!is_empty_date($value)) {
$date = new Zend_Date($value, $dateFormat);
$value = $date->toString(Zend_Date::ISO_8601) . 'Z';
}
}
}
if ($attribute->usesSource()) {
$attribute->setStoreId(Mage::app()->getStore()->getId());
}
return array($fieldName => $value);
}
示例10: getSearchParam
/**
* Retrieve filter array
*
* @deprecated since 1.12.0.0
*
* @param Enterprise_Search_Model_Resource_Collection $collection
* @param Mage_Catalog_Model_Resource_Eav_Attribute $attribute
* @param string|array $value
* @return array
*/
public function getSearchParam($collection, $attribute, $value)
{
if (empty($value) || isset($value['from']) && empty($value['from']) && isset($value['to']) && empty($value['to'])) {
return false;
}
$locale = Mage::app()->getStore()->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_LOCALE);
$languageSuffix = $this->getLanguageSuffix($locale);
$field = $attribute->getAttributeCode();
$backendType = $attribute->getBackendType();
$frontendInput = $attribute->getFrontendInput();
if ($frontendInput == 'multiselect') {
$field = 'attr_multi_' . $field;
} elseif ($backendType == 'decimal') {
$field = 'attr_decimal_' . $field;
} elseif ($frontendInput == 'select' || $frontendInput == 'boolean') {
$field = 'attr_select_' . $field;
} elseif ($backendType == 'datetime') {
$field = 'attr_datetime_' . $field;
$format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
if (is_array($value)) {
foreach ($value as &$val) {
if (!is_empty_date($val)) {
$date = new Zend_Date($val, $format);
$val = $date->toString(Zend_Date::ISO_8601) . 'Z';
}
}
} else {
if (!is_empty_date($value)) {
$date = new Zend_Date($value, $format);
$value = $date->toString(Zend_Date::ISO_8601) . 'Z';
}
}
} elseif (in_array($backendType, $this->_textFieldTypes)) {
$field .= $languageSuffix;
}
if ($attribute->usesSource()) {
$attribute->setStoreId(Mage::app()->getStore()->getId());
}
return array($field => $value);
}
示例11: mapDirectiveSalePriceEffectiveDate
protected function mapDirectiveSalePriceEffectiveDate($params = array())
{
$map = $params['map'];
$product = $this->getProduct();
/* @var $product Mage_Catalog_Model_Product */
$cell = "";
if (!$this->hasSpecialPrice()) {
return $cell;
}
$cDate = Mage::app()->getLocale()->date(null, null, Mage::app()->getLocale()->getDefaultLocale());
$timezone = Mage::app()->getStore($this->getStoreId())->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE);
$fromDate = new Zend_Date(null, null, Mage::app()->getLocale()->getDefaultLocale());
if ($timezone) {
$fromDate->setTimezone($timezone);
}
$fromDate->setDate(substr($product->getSpecialFromDate(), 0, 10), 'yyyy-MM-dd');
$fromDate->setTime(substr($product->getSpecialFromDate(), 11, 8), 'HH:mm:ss');
$toDate = new Zend_Date(null, null, Mage::app()->getLocale()->getDefaultLocale());
if (!is_empty_date($product->getSpecialToDate())) {
if ($timezone) {
$toDate->setTimezone($timezone);
}
$toDate->setDate(substr($product->getSpecialToDate(), 0, 10), 'yyyy-MM-dd');
$toDate->setTime('23:59:59', 'HH:mm:ss');
} else {
if ($timezone) {
$toDate->setTimezone($timezone);
}
$toDate->setDate($cDate->toString('yyyy-MM-dd'), 'yyyy-MM-dd');
$toDate->setTime('23:59:59', 'HH:mm:ss');
$toDate->add(7, Zend_Date::DAY);
}
$cell = $fromDate->toString(Zend_Date::ISO_8601) . "/" . $toDate->toString(Zend_Date::ISO_8601);
return $cell;
}
示例12: export
//.........这里部分代码省略.........
foreach ($this->_entities as $id => $p) {
$csvRow = array();
$value = null;
foreach ($this->_fields as $k => $f) {
$attr = $f['field'];
$inputType = $this->_attr($attr, 'frontend_input');
// retrieve correct value for current row and field
if ($v = $this->_attr($attr, 'force_value')) {
$value = $v;
} elseif (!empty($this->_fieldAttributes[$attr])) {
$a = $this->_fieldAttributes[$attr];
$value = isset($p[$storeId][$a]) ? $p[$storeId][$a] : (isset($p[0][$a]) ? $p[0][$a] : null);
} else {
$value = isset($p[$storeId][$attr]) ? $p[$storeId][$attr] : (isset($p[0][$attr]) ? $p[0][$attr] : null);
}
// replace raw numeric values with source option labels
if (($inputType == 'select' || $inputType == 'multiselect') && ($options = $this->_attr($attr, 'options'))) {
if (!is_array($value)) {
$value = explode(',', $value);
}
foreach ($value as &$v) {
if ($v === '') {
continue;
}
if (!isset($options[$v])) {
$profile->addValue('num_warnings');
$logger->warning($this->__("Unknown option '%s' for category '%s' attribute '%s'", $v, $p[0]['url_path'], $attr));
continue;
}
$v = $options[$v];
}
unset($v);
}
// combine multiselect values
if (is_array($value)) {
$value = join(!empty($f['separator']) ? $f['separator'] : $defaultSeparator, $value);
}
// process special cases of loaded attributes
switch ($attr) {
// product url
case 'url_path':
if (!empty($f['format']) && $f['format'] == 'url') {
$value = $baseUrl . $value;
}
break;
case 'const.value':
$value = isset($f['default']) ? $f['default'] : '';
break;
}
switch ($this->_attr($attr, 'backend_type')) {
case 'decimal':
if (!is_null($value) && !empty($f['format'])) {
$value = sprintf($f['format'], $value);
}
break;
case 'datetime':
if (!is_empty_date($value)) {
$value = date(!empty($f['format']) ? $f['format'] : 'Y-m-d H:i:s', strtotime($value));
}
break;
}
switch ($this->_attr($attr, 'frontend_input')) {
case 'media_image':
if ($value == 'no_selection') {
$value = '';
}
if (!empty($f['format']) && $f['format'] == 'url' && !empty($value)) {
try {
$path = $imgModel->setBaseFile($value)->getBaseFile();
$path = str_replace($mediaDir . DS, "", $path);
$value = $mediaUrl . str_replace(DS, '/', $path);
} catch (Exception $e) {
$value = '';
}
}
break;
}
if ((is_null($value) || $value === '') && !empty($f['default'])) {
$value = $f['default'];
}
$csvRow[] = $value;
}
$csvRow = $this->_convertEncoding($csvRow);
$profile->ioWrite($csvRow);
$profile->addValue('rows_processed')->addValue('rows_success');
}
// foreach ($this->_entities as $id=>&$p)
$profile->setMemoryUsage(memory_get_usage(true))->setMemoryPeakUsage(memory_get_peak_usage(true))->setSnapshotAt(now())->sync();
$this->_checkLock();
// stop repeating if this is the last page
if (sizeof($this->_entities) < $this->_pageRowCount) {
break;
}
if ($this->_pageSleepDelay) {
sleep($this->_pageSleepDelay);
}
}
// while (true)
$profile->ioClose();
}
示例13: hasSpecialPrice
/**
* @param $product
* @param $special_price
* @param $rules
* @return bool
*/
public function hasSpecialPrice($product, $special_price, $rules = true)
{
if ($rules && $this->hasPriceByCatalogRules($product)) {
return true;
}
if ($special_price <= 0) {
return false;
}
$cDate = Mage::app()->getLocale()->date(null, null, Mage::app()->getLocale()->getDefaultLocale());
$timezone = Mage::app()->getStore($this->getStoreId())->getConfig(Mage_Core_Model_Locale::XML_PATH_DEFAULT_TIMEZONE);
// From Date
$fromDate = new Zend_Date(null, null, Mage::app()->getLocale()->getDefaultLocale());
if ($timezone) {
$fromDate->setTimezone($timezone);
}
$special_from_date = $product->getSpecialFromDate();
if (is_empty_date($special_from_date)) {
$special_from_date = $cDate->toString('yyyy-MM-dd HH:mm:ss');
}
$fromDate->setDate(substr($special_from_date, 0, 10), 'yyyy-MM-dd');
$fromDate->setTime(substr($special_from_date, 11, 8), 'HH:mm:ss');
// To Date
$toDate = new Zend_Date(null, null, Mage::app()->getLocale()->getDefaultLocale());
if ($timezone) {
$toDate->setTimezone($timezone);
}
$special_to_date = $product->getSpecialToDate();
if (is_empty_date($special_to_date)) {
$special_to_date = $cDate->toString('yyyy-MM-dd HH:mm:ss');
}
if (is_empty_date($special_to_date)) {
$toDate->add(365, Zend_Date::DAY);
}
$toDate->setDate(substr($special_to_date, 0, 10), 'yyyy-MM-dd');
$toDate->setTime(substr($special_to_date, 11, 8), 'HH:mm:ss');
if (($fromDate->compare($cDate) == -1 || $fromDate->compare($cDate) == 0) && ($toDate->compare($cDate) == 1 || $toDate->compare($cDate) == 0)) {
return true;
}
return false;
}
示例14: render
public function render(Varien_Object $row)
{
$data = $row->getData($this->getColumn()->getIndex());
return is_empty_date($data) ? '' : parent::render($row);
}
示例15: export
//.........这里部分代码省略.........
$logger->setColumn($f['column_num'])->warning($this->__("Unknown option '%s' for product '%s' attribute '%s'", $v, $p[0]['sku'], $attr));
if (!$exportInvalidValues) {
unset($value[$k]);
}
continue;
}
$v = $options[$v];
}
unset($v);
}
// combine multiselect values
if (is_array($value)) {
$value = join(!empty($f['separator']) ? $f['separator'] : $defaultSeparator, $value);
}
// process special cases of loaded attributes
switch ($attr) {
// product url
case 'url_path':
if (!empty($f['format']) && $f['format'] == 'url') {
$value = $baseUrl . $value;
}
break;
case 'const.value':
$value = isset($c['default']) ? $c['default'] : '';
break;
case 'const.function':
$value = '';
if (!empty($c['default'])) {
try {
list($class, $func) = explode('::', $c['default']);
if (strpos($class, '/') !== false) {
$model = Mage::getSingleton($class);
} else {
$model = $class;
}
$value = call_user_func(array($model, $func), $p, $c, $storeId);
} catch (Exception $e) {
$logger->setColumn($f['column_num'])->warning($this->__("Exception for product '%s' attribute '%s': %s", $p[0]['sku'], $attr, $e->getMessage()));
}
}
break;
}
switch ($this->_attr($attr, 'backend_type')) {
case 'decimal':
if (!is_null($value) && !empty($f['format'])) {
$value = sprintf($f['format'], $value);
}
break;
case 'datetime':
if (!is_empty_date($value)) {
$value = date(!empty($f['format']) ? $f['format'] : 'Y-m-d H:i:s', strtotime($value));
}
break;
}
switch ($this->_attr($attr, 'frontend_input')) {
case 'media_image':
if ($value == 'no_selection') {
$value = '';
}
if ($value !== '' && $exportImageFiles) {
$logger->setColumn($f['column_num']);
$this->_copyImageFile($imagesFromDir, $imagesToDir, $value);
}
if (!empty($f['format']) && $f['format'] == 'url' && !empty($value)) {
try {
$path = $imgModel->setBaseFile($value)->getBaseFile();
$path = str_replace($mediaDir . DS, "", $path);
$value = $mediaUrl . str_replace(DS, '/', $path);
} catch (Exception $e) {
$value = '';
}
}
break;
}
$csvRow[] = $value;
}
$csvRow = $this->_convertEncoding($csvRow);
#$profile->ioWrite($csvRow);
$this->_csvRows[] = $csvRow;
$profile->addValue('rows_processed');
}
// foreach ($this->_products as $id=>&$p)
Mage::dispatchEvent('urapidflow_catalog_product_export_before_output', array('vars' => array('profile' => $this->_profile, 'products' => &$this->_products, 'fields' => &$this->_fields, 'rows' => &$this->_csvRows)));
foreach ($this->_csvRows as $row) {
$profile->ioWrite($row);
$profile->addValue('rows_success');
}
$profile->setMemoryUsage(memory_get_usage(true))->setMemoryPeakUsage(memory_get_peak_usage(true))->setSnapshotAt(now())->sync();
$this->_checkLock();
// stop repeating if this is the last page
if (sizeof($this->_products) < $this->_pageRowCount) {
break;
}
if ($this->_pageSleepDelay) {
sleep($this->_pageSleepDelay);
}
}
// while (true)
$profile->ioClose();
}