Browse Source

DIGITEC-414 Применение нового дизайна к шаблонной системе opencart

Доработка imex-скрипта ImageUpdate - обновление и удаление фото. Корректировки при использованиие ProductModel::prepateItem
master
Alexander Demidov 10 years ago
parent
commit
079c025525
  1. 24
      File.class.php

24
File.class.php

@ -110,6 +110,30 @@ abstract class File
return (bool) $this->size;
}
public function delete()
{
/**
* @var $image Image
*/
if ($this->getIsNoEmpty()) {
unlink($this->getRealPath());
}
if (get_parent_class($this) == 'Image') {
$image = $this;
foreach ($image->variants as $size) {
$image_variant = $image->getVariant($size);
if ($image_variant->getIsNoEmpty()) {
unlink($image->getRealPath());
}
}
}
}
public function getRealPath()
{
return PATH_WEB_ROOT . '/' . $this->path . '/' . $this->filename;
}
/**
* @return string
*/

Loading…
Cancel
Save