diff --git a/admin-dev/tabs/AdminShop.php b/admin-dev/tabs/AdminShop.php index 67bc8675d..cbf80a1d7 100755 --- a/admin-dev/tabs/AdminShop.php +++ b/admin-dev/tabs/AdminShop.php @@ -66,6 +66,12 @@ class AdminShop extends AdminTab if (Tools::getValue('useImportData') && ($importData = Tools::getValue('importData')) && is_array($importData)) $newShop->copyShopData((int)Tools::getValue('importFromShop'), $importData); } + + public function afterUpdate($newShop) + { + if (Tools::getValue('useImportData') && ($importData = Tools::getValue('importData')) && is_array($importData)) + $newShop->copyShopData((int)Tools::getValue('importFromShop'), $importData); + } public function postProcess() { @@ -170,58 +176,57 @@ class AdminShop extends AdminTab
* '.$this->l('Required field').'


'; - if (Tools::getValue('addshop') !== false) - { - $importData = array( - 'carrier' => $this->l('Carriers'), - 'category_lang' => $this->l('Category lang'), - 'cms' => $this->l('CMS page'), - 'contact' => $this->l('Contact'), - 'country' => $this->l('Countries'), - 'currency' => $this->l('Currencies'), - 'discount' => $this->l('Discounts'), - 'image' => $this->l('Images'), - 'lang' => $this->l('Langs'), - 'manufacturer' => $this->l('Manufacturers'), - 'module' => $this->l('Modules'), - 'hook_module' => $this->l('Modules hook'), - 'hook_module_exceptions' => $this->l('Modules hook exceptions'), - 'meta_lang' => $this->l('Meta'), - 'module_country' => $this->l('Payment module country restrictions'), - 'module_group' => $this->l('Payment module customer group restrictions'), - 'module_currency' => $this->l('Payment module currency restrictions'), - 'product' => $this->l('Products'), - 'product_lang' => $this->l('Products lang'), - 'scene' => $this->l('Scenes'), - 'stock' => $this->l('Stock'), - 'store' => $this->l('Stores'), - 'zone' => $this->l('Zones'), - ); + $importData = array( + 'carrier' => $this->l('Carriers'), + 'carrier_lang' => $this->l('Carriers lang'), + 'category_lang' => $this->l('Category lang'), + 'cms' => $this->l('CMS page'), + 'contact' => $this->l('Contact'), + 'country' => $this->l('Countries'), + 'currency' => $this->l('Currencies'), + 'discount' => $this->l('Discounts'), + 'image' => $this->l('Images'), + 'lang' => $this->l('Langs'), + 'manufacturer' => $this->l('Manufacturers'), + 'module' => $this->l('Modules'), + 'hook_module' => $this->l('Modules hook'), + 'hook_module_exceptions' => $this->l('Modules hook exceptions'), + 'meta_lang' => $this->l('Meta'), + 'module_country' => $this->l('Payment module country restrictions'), + 'module_group' => $this->l('Payment module customer group restrictions'), + 'module_currency' => $this->l('Payment module currency restrictions'), + 'product' => $this->l('Products'), + 'product_lang' => $this->l('Products lang'), + 'scene' => $this->l('Scenes'), + 'stock' => $this->l('Stock'), + 'store' => $this->l('Stores'), + 'zone' => $this->l('Zones'), + ); - echo '
'.$this->l('Import data from another shop').''; - echo ''; - echo '
'; - echo ' '; - echo $this->l('Duplicate data from shop'); - echo ' '; - echo '
    '; - foreach ($importData as $table => $lang) - echo '
  • '; - echo '
'; - echo '

'.$this->l('Use this option to associate data (products, modules, etc.) the same way as the selected shop').'

'; - echo '
- -
'; - echo '
'; - } + $checked = (Tools::getValue('addshop') !== false) ? true : false; + echo '
'.$this->l('Import data from another shop').''; + echo ''; + echo '
'; + echo ' '; + echo $this->l('Duplicate data from shop'); + echo ' '; + echo '
    '; + foreach ($importData as $table => $lang) + echo '
  • '; + echo '
'; + echo '

'.$this->l('Use this option to associate data (products, modules, etc.) the same way as the selected shop').'

'; + echo '
+ +
'; + echo '
'; echo ''; } diff --git a/classes/Shop.php b/classes/Shop.php index 346bd4ee0..c12d3b6e6 100644 --- a/classes/Shop.php +++ b/classes/Shop.php @@ -737,7 +737,7 @@ class ShopCore extends ObjectModel unset($res[$row['primary']]); $keys = implode(', ', array_keys($res)); - $sql = 'INSERT INTO `'._DB_PREFIX_.$table_name.'` ('.$keys.', '.$id.') + $sql = 'INSERT IGNORE INTO `'._DB_PREFIX_.$table_name.'` ('.$keys.', '.$id.') (SELECT '.$keys.', '.(int)$this->id.' FROM '._DB_PREFIX_.$table_name.' WHERE `'.$id.'` = '.(int)$old_id.')'; Db::getInstance()->Execute($sql);