[-] BO: Fix root category should anyway be imported in shop creation #PSCFV-5885

This commit is contained in:
Rémi Gaillard
2012-12-11 12:01:04 +01:00
parent a8096c2800
commit e8718ec42f
3 changed files with 19 additions and 8 deletions
@@ -119,10 +119,16 @@
{/foreach}
$(document).ready(function() {
$('input[name=useImportData]').click(function() {
if ($(this).attr('id') == 'useImportData_on')
$('#shop_list, #data_list').slideDown('slow');
else
$('#shop_list, #data_list').slideUp('slow');
if ($(this).attr('id') == 'useImportData_on')
{
$('input[name^="importData["]').prop('checked', true);
$('#shop_list, #data_list').slideDown('slow');
}
else
{
$('input[name^="importData["]').prop('checked', false);
$('#shop_list, #data_list').slideUp('slow');
}
});
$('#id_category, #importFromShop').change(function(){
shop_id = $('#importFromShop').val();
+5 -1
View File
@@ -179,7 +179,7 @@ class ShopCore extends ObjectModel
'supplier' => array('type' => 'shop'),
);
foreach($asso_tables as $table_name => $table_details)
foreach ($asso_tables as $table_name => $table_details)
Shop::addTableAssociation($table_name, $table_details);
Shop::$initialized = true;
@@ -975,6 +975,10 @@ class ShopCore extends ObjectModel
{
// If we duplicate some specific data, automatically duplicate other data linked to the first
// E.g. if carriers are duplicated for the shop, duplicate carriers langs too
if (!$old_id)
$old_id = Configuration::get('PS_SHOP_DEFAULT');
if (isset($tables_import['carrier']))
{
$tables_import['carrier_tax_rules_group_shop'] = true;
+4 -3
View File
@@ -265,9 +265,10 @@ class AdminShopControllerCore extends AdminController
protected function afterAdd($new_shop)
{
$import_data = Tools::getValue('importData');
if (Tools::getValue('useImportData') && is_array($import_data))
$new_shop->copyShopData((int)Tools::getValue('importFromShop'), $import_data);
$import_data = Tools::getValue('importData', array());
// The root category should be at least imported
$new_shop->copyShopData((int)Tools::getValue('importFromShop'), $import_data);
// copy default data
if (!Tools::getValue('useImportData') || (is_array($import_data) && !isset($import_data['group'])))