diff --git a/modules/watermark/watermark.php b/modules/watermark/watermark.php index 1e42013e9..2e0c96395 100644 --- a/modules/watermark/watermark.php +++ b/modules/watermark/watermark.php @@ -44,7 +44,7 @@ class Watermark extends Module { $this->name = 'watermark'; $this->tab = 'administration'; - $this->version = 0.1; + $this->version = '0.2'; $this->author = 'PrestaShop'; parent::__construct(); @@ -120,13 +120,18 @@ class Watermark extends Module return !sizeof($this->_postErrors) ? true : false; } - private function _postProcess(){ + private function _postProcess() + { Configuration::updateValue('WATERMARK_TYPES', implode(',', Tools::getValue('image_types'))); Configuration::updateValue('WATERMARK_Y_ALIGN', Tools::getValue('yalign')); Configuration::updateValue('WATERMARK_X_ALIGN', Tools::getValue('xalign')); Configuration::updateValue('WATERMARK_TRANSPARENCY', Tools::getValue('transparency')); - + + if (Context::getContext()->shop->getContextType() == Shop::CONTEXT_SHOP) + $str_shop = '-'.(int)$this->context->shop->id; + else + $str_shop = ''; //submited watermark if (isset($_FILES['PS_WATERMARK']) AND !empty($_FILES['PS_WATERMARK']['tmp_name'])) { @@ -134,7 +139,7 @@ class Watermark extends Module if ($error = checkImage($_FILES['PS_WATERMARK'])) $this->_errors[] = $error; /* Copy new watermark */ - elseif(!copy($_FILES['PS_WATERMARK']['tmp_name'], dirname(__FILE__).'/watermark.gif')) + elseif(!copy($_FILES['PS_WATERMARK']['tmp_name'], dirname(__FILE__).'/watermark'.$str_shop.'.gif')) $this->_errors[] = Tools::displayError('an error occurred while uploading watermark: '.$_FILES['PS_WATERMARK']['tmp_name'].' to '.$dest); } @@ -148,6 +153,10 @@ class Watermark extends Module private function _displayForm() { $imageTypes = ImageType::getImagesTypes('products'); + $str_shop = '-'.(int)$this->context->shop->id; + if (Context::getContext()->shop->getContextType() != Shop::CONTEXT_SHOP || !Tools::file_exists_cache(dirname(__FILE__).'/watermark'.$str_shop.'.gif')) + $str_shop = ''; + $this->_html .= '