Commit 541d6dc9 authored by rMalie's avatar rMalie

// Fix some bug on multishop + improve display of shop pages

parent cf072a67
......@@ -64,8 +64,8 @@ class FrontControllerCore extends Controller
}
/**
* checkAccess
*
* checkAccess
*
* @return void
*/
public function checkAccess()
......@@ -128,7 +128,7 @@ class FrontControllerCore extends Controller
if ($id_cart = (int)$this->recoverCart())
$this->context->cookie->id_cart = (int)$id_cart;
if ($this->auth AND !$this->context->customer->isLogged($this->guestAllowed))
Tools::redirect('index.php?controller=authentication'.($this->authRedirection ? '&back='.$this->authRedirection : ''));
......@@ -147,7 +147,7 @@ class FrontControllerCore extends Controller
// Login information have changed, so we check if the cart rules still apply
CartRule::autoRemoveFromCart();
Tools::redirect(isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : NULL);
}
elseif (isset($_GET['mylogout']))
......@@ -219,7 +219,7 @@ class FrontControllerCore extends Controller
$cart->id_address_invoice = 0;
}
}
$locale = strtolower(Configuration::get('PS_LOCALE_LANGUAGE')).'_'.strtoupper(Configuration::get('PS_LOCALE_COUNTRY').'.UTF-8');
setlocale(LC_COLLATE, $locale);
setlocale(LC_CTYPE, $locale);
......@@ -744,7 +744,7 @@ class FrontControllerCore extends Controller
return parent::addJS($js_uri);
}
protected function recoverCart()
{
if (($id_cart = (int)Tools::getValue('recover_cart')) && Tools::getValue('token_cart') == md5(_COOKIE_KEY_.'recover_cart_'.$id_cart))
......
......@@ -507,9 +507,9 @@ class ShopCore extends ObjectModel
if ((!$active || $shop_data['active']) && (!$id_group_shop || $id_group_shop == $group_id))
{
if ($get_as_list_id)
$results[] = $id;
$results[$id] = $id;
else
$results[] = $shop_data;
$results[$id] = $shop_data;
}
return $results;
}
......@@ -869,7 +869,7 @@ class ShopCore extends ObjectModel
{
return (int)Db::getInstance()->getValue(sprintf('SELECT COUNT(*) FROM`'._DB_PREFIX_.'group_shop` WHERE `id_group_shop` = %d', (int)$id));
}
public static function getShopWithoutUrls($id_shop = false)
{
$without = array();
......
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
......@@ -31,7 +31,7 @@ class AdminContactControllerCore extends AdminController
{
$this->className = 'Configuration';
$this->table = 'configuration';
parent::__construct();
$temporyArrayFields = $this->_getDefaultFieldsContent();
......@@ -40,7 +40,7 @@ class AdminContactControllerCore extends AdminController
private function _getDefaultFieldsContent()
{
$this->context = Context::getContext();
$this->context = Context::getContext();
$countryList = array();
$countryList[] = array('id' => '0', 'name' => $this->l('Choose your country'));
foreach (Country::getCountries($this->context->language->id) AS $country)
......@@ -49,7 +49,7 @@ class AdminContactControllerCore extends AdminController
$stateList[] = array('id' => '0', 'name' => $this->l('Choose your state (if applicable)'));
foreach (State::getStates($this->context->language->id) AS $state)
$stateList[] = array('id' => $state['id_state'], 'name' => $state['name']);
$formFields = array(
'PS_SHOP_NAME' => array('title' => $this->l('Shop name:'), 'desc' => $this->l('Displayed in e-mails and page titles'), 'validation' => 'isGenericName', 'required' => true, 'size' => 30, 'type' => 'text'),
'PS_SHOP_EMAIL' => array('title' => $this->l('Shop e-mail:'), 'desc' => $this->l('Displayed in e-mails sent to customers'), 'validation' => 'isEmail', 'required' => true, 'size' => 30, 'type' => 'text'),
......@@ -77,10 +77,10 @@ class AdminContactControllerCore extends AdminController
'PS_SHOP_CODE' => 'postcode',
'PS_SHOP_COUNTRY_ID' => 'Country:name',
'PS_SHOP_PHONE' => 'phone');
$fields = array();
$orderedFields = AddressFormat::getOrderedAddressFields(Configuration::get('PS_SHOP_COUNTRY_ID'), false, true);
foreach($orderedFields as $lineFields)
if (($patterns = explode(' ', $lineFields)))
foreach($patterns as $pattern)
......@@ -89,7 +89,7 @@ class AdminContactControllerCore extends AdminController
foreach($formFields as $key => $value)
if (!isset($fields[$key]))
$fields[$key] = $formFields[$key];
$this->options = array(
'general' => array(
'title' => $this->l('Contact details'),
......
......@@ -42,9 +42,25 @@ class AdminGroupShopControllerCore extends AdminController
$this->deleted = false;
$this->fieldsDisplay = array(
'id_group_shop' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'name' => array('title' => $this->l('County'), 'width' => 130, 'filter_key' => 'b!name'),
'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false, 'filter_key' => 'active'),
'id_group_shop' => array(
'title' => $this->l('ID'),
'align' => 'center',
'width' => 25,
),
'name' => array(
'title' => $this->l('Group shop'),
'width' => 'auto',
'filter_key' => 'b!name',
),
'active' => array(
'title' => $this->l('Enabled'),
'align' => 'center',
'active' => 'status',
'type' => 'bool',
'orderby' => false,
'filter_key' => 'active',
'width' => 50,
),
);
parent::__construct();
......@@ -155,7 +171,7 @@ class AdminGroupShopControllerCore extends AdminController
'tax_rules_group' => $this->l('Tax rules groups'),
'zone' => $this->l('Zones'),
);
if (!$this->object->id)
$this->fields_import_form = array(
'legend' => array(
......
......@@ -42,16 +42,16 @@ class AdminShopControllerCore extends AdminController
),
'name' => array(
'title' => $this->l('Shop'),
'width' => 130,
'width' => 'auto',
'filter_key' => 'b!name'
),
'group_shop_name' => array(
'title' => $this->l('Group Shop'),
'width' => 70
'width' => 150
),
'category_name' => array(
'title' => $this->l('Category Root'),
'width' => 70
'width' => 150
),
'active' => array(
'title' => $this->l('Enabled'),
......@@ -59,7 +59,8 @@ class AdminShopControllerCore extends AdminController
'active' => 'status',
'type' => 'bool',
'orderby' => false,
'filter_key' => 'active'
'filter_key' => 'active',
'width' => 50,
)
);
......@@ -82,10 +83,10 @@ class AdminShopControllerCore extends AdminController
);
parent::__construct();
}
public function initContent()
{
$id_shop = ($this->context->shop->getContextType() == Shop::CONTEXT_SHOP ? $this->context->shop->id : false);
$shops = Shop::getShopWithoutUrls($id_shop);
$shops = Shop::getShopWithoutUrls();
if (count($shops))
{
$shop_url_configuration = '';
......@@ -93,9 +94,9 @@ class AdminShopControllerCore extends AdminController
$shop_url_configuration .= sprintf($this->l('No url is configured for shop: %s'), '<b>'.$shop['name'].'</b>').' <a href="'.$this->context->link->getAdminLink('AdminShopUrl').'&addshop_url&id_shop='.$shop['id_shop'].'">'.$this->l('click here').'</a><br />';
$this->content .= '<div class="warn">'.$shop_url_configuration.'</div>';
}
parent::initContent();
parent::initContent();
}
public function initList()
{
$this->addRowAction('edit');
......
......@@ -40,13 +40,48 @@ class AdminShopUrlControllerCore extends AdminController
$this->deleted = false;
$this->fieldsDisplay = array(
'id_shop_url' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25),
'domain' => array('title' => $this->l('Domain'), 'width' => 130, 'filter_key' => 'domain'),
'domain_ssl' => array('title' => $this->l('Domain SSL'), 'width' => 130, 'filter_key' => 'domain'),
'uri' => array('title' => $this->l('Uri'), 'width' => 130, 'filter_key' => 'uri'),
'shop_name' => array('title' => $this->l('Shop name'), 'width' => 70),
'main' => array('title' => $this->l('Main URL'), 'align' => 'center', 'activeVisu' => 'main', 'type' => 'bool', 'orderby' => false, 'filter_key' => 'main'),
'active' => array('title' => $this->l('Enabled'), 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false, 'filter_key' => 'active'),
'id_shop_url' => array(
'title' => $this->l('ID'),
'align' => 'center',
'width' => 25
),
'domain' => array(
'title' => $this->l('Domain'),
'width' => 'auto',
'filter_key' => 'domain'
),
'domain_ssl' => array(
'title' => $this->l('Domain SSL'),
'width' => 130,
'filter_key' => 'domain'
),
'uri' => array(
'title' => $this->l('Uri'),
'width' => 200,
'filter_key' => 'uri'
),
'shop_name' => array(
'title' => $this->l('Shop name'),
'width' => 70
),
'main' => array(
'title' => $this->l('Main URL'),
'align' => 'center',
'activeVisu' => 'main',
'type' => 'bool',
'orderby' => false,
'filter_key' => 'main',
'width' => 50,
),
'active' => array(
'title' => $this->l('Enabled'),
'align' => 'center',
'active' => 'status',
'type' => 'bool',
'orderby' => false,
'filter_key' => 'active',
'width' => 50,
),
);
parent::__construct();
......@@ -87,14 +122,14 @@ class AdminShopUrlControllerCore extends AdminController
'type' => 'text',
'label' => $this->l('Physical URI:'),
'name' => 'physical_uri',
'desc' => $this->l('Physical folder of your store on your server. Leave this field empty if your store is installed on root path.')
'desc' => $this->l('Physical folder of your store on your server. Leave this field empty if your store is installed on root path. E.g. if your store is available from www.my-prestashop.com/my-store/, you have to set my-store/ in this field.')
),
array(
'type' => 'text',
'label' => $this->l('Virtual URI:'),
'name' => 'virtual_uri',
'desc' => array(
$this->l('This virtual folder must not exist on your server and is used to associate an URI to a shop.'),
$this->l('You can use this option if you want to create a store with an URI that doesn\'t exist on your server. E.g. if you want your store to be available with url www.my-prestashop.com/my-store/shoes/, you have to set shoes/ in this field (we considere that my-store/ is your physical URI).'),
'<strong>'.$this->l('URL rewriting must be activated on your server to use this feature.').'</strong>'
)
),
......
......@@ -901,12 +901,12 @@ $(document).ready(function()
{
var key = $(v).attr('name');
var len = key.length;
checkMultishopDefaultValue(v, key.substr(17, len - 18));
checkMultishopDefaultValue(v, key.substr(18, len - 20));
});
});
function checkMultishopDefaultValue(obj, key)
{
{console.log(key)
if ($(obj).attr('checked') || $('#'+key).hasClass('isInvisible'))
{
$('#conf_id_'+key+' input, #conf_id_'+key+' textarea, #conf_id_'+key+' select').attr('disabled', true);
......
......@@ -554,9 +554,15 @@ $_LANGADM['AdminCmsef61fb324d729c341ea8ab9901e23566'] = 'Créer';
$_LANGADM['AdminCms5ece607071fe59ddc4c88dc6abfe2310'] = 'Pas de page trouvée';
$_LANGADM['AdminCms084af17ae8dce6465e3acd94a3d995c1'] = 'Votre page de CMS sera enregistrée comme brouillon';
$_LANGADM['AdminGroupShopb718adec73e04ce3ec720dd11a06a308'] = 'ID';
$_LANGADM['AdminGroupShop0f86285516456595b59620181e9c689c'] = 'Groupe de boutique';
$_LANGADM['AdminGroupShop00d23a76e43b46dae9ec7aa9dcbebb32'] = 'Activé';
$_LANGADM['AdminGroupShop791a9f4aec774fbe5591d239f3cf0113'] = 'Groupe de boutique';
$_LANGADM['AdminGroupShopd8f3f16f4a7007d6219a34664e36d68b'] = 'Nom du groupe de boutique :';
$_LANGADM['AdminGroupShop18e5ed18a875ebffce61b7abe7b5dc1e'] = 'Partager les clients :';
$_LANGADM['AdminGroupShopb9f5c797ebbf55adccdd8539a65a0241'] = 'Désactivé';
$_LANGADM['AdminGroupShop934514d7bd6af6a23fca1b985ec2d640'] = 'Partager les comptes clients entre les différentes boutiques de ce groupe';
$_LANGADM['AdminGroupShope9f83d2cd2cd8ce6d8a58d3fc454d5cf'] = 'Partager les commandes :';
$_LANGADM['AdminGroupShop6cbbf7ff5d60b20ff3b8dcb3484eafdb'] = 'Partager les commandes et les paniers entre les différentes boutiques de ce groupe (vous ne pouvez partager les commandes que si vous partagez les clients et le stock)';
$_LANGADM['AdminGroupShop24a23d787190f2c4812ff9ab11847a72'] = 'Statut :';
$_LANGADM['AdminGroupShop37c0e2b9736bc4cc2005f7be3fd66fe5'] = 'Activer ou désactiver une boutique';
$_LANGADM['AdminGroupShop38fb7d24e0d60a048f540ecb18e13376'] = 'Enregistrer';
......@@ -659,12 +665,16 @@ $_LANGADM['AdminShopUrl809ba9a802624b3958a53090a72d9c7a'] = 'URL de la boutique'
$_LANGADM['AdminShopUrlbd5f9f37b54fe8f66369f74784576e6c'] = 'Domaine:';
$_LANGADM['AdminShopUrl873646ada13763eda1a5393d99973204'] = 'Domaine SSL:';
$_LANGADM['AdminShopUrl9c8417aa5dbcccb5b4c48b4176ae1e8a'] = 'URI physique:';
$_LANGADM['AdminShopUrldd22844f47ebedcec07f9c920af00fb3'] = 'Virtual URI:';
$_LANGADM['AdminShopUrlbab012bba0a9b421dfab4038f9a90c43'] = 'Dossier physique de votre magasin sur le serveur. Laissez ce champ vide si votre magasin est installé à la racine. Par exemple si votre magasin est accessible via l’adresse www.mon-prestashop.com/mon-magasin/, vous devez entrer mon-magasin/ dans ce champ.';
$_LANGADM['AdminShopUrldd22844f47ebedcec07f9c920af00fb3'] = 'URI virtuelle :';
$_LANGADM['AdminShopUrl5e4965fdcbc5392c414608dde75290b1'] = 'Vous pouvez utiliser cette option si vous souhaitez créer un magasin avec une URI qui n\'existe pas réellement sur votre serveur. Par exemple si vous voulez que votre magasin soit accessible via l\'adresse www.mon-prestashop.com/mon-magasin/chaussures/, vous devez entrer chaussures/ dans ce champ (en considérant que mon-magasin/ est votre URI physique).';
$_LANGADM['AdminShopUrlf6e7829277b67d5a8805d6728a810362'] = 'La réécriture d\'URL doit être activé sur votre serveur pour utiliser cette fonctionnalité.';
$_LANGADM['AdminShopUrl32401234f706ad260cc990d83fe5d7ec'] = 'Votre URL finale sera :';
$_LANGADM['AdminShopUrlb91c371eeb88143fd0260f990bcf8d75'] = 'Boutique :';
$_LANGADM['AdminShopUrl9efaaad2d5b51cd643529cd6872e169a'] = 'URL principale :';
$_LANGADM['AdminShopUrlb9f5c797ebbf55adccdd8539a65a0241'] = 'Désactivé';
$_LANGADM['AdminShopUrl134a0349fbc36ef37c862a7321e5e142'] = 'Comme le magasin choisi n\'a pas d\'URL principale, l\'URL que vous êtes en train de créer doit être mise en tant qu\'URL principale.';
$_LANGADM['AdminShopUrl681a2f774a1323b8c265610dc0a0d5cb'] = 'Le magasin choisi a déjà une URL principale, si vous choisissez l\'URL actuelle comme étant son URL principale, son ancienne URL redeviendra normale (et non plus principale).';
$_LANGADM['AdminShopUrl24a23d787190f2c4812ff9ab11847a72'] = 'Statut :';
$_LANGADM['AdminShopUrld42225935a374f1249f2a45ebed00772'] = 'Activée ou désactivée';
$_LANGADM['AdminShopUrl38fb7d24e0d60a048f540ecb18e13376'] = 'Enregistrer';
......@@ -1386,12 +1396,14 @@ $_LANGADM['AdminShopd3b206d196cd6be3a2764c1fb90b200f'] = 'Supprimer la sélectio
$_LANGADM['AdminShope25f0ecd41211b01c83e5fec41df4fe7'] = 'Supprimer les éléments sélectionnés ?';
$_LANGADM['AdminShop61f0fa926f97eafb392975ed79cebb4a'] = 'Nom de la boutique :';
$_LANGADM['AdminShop580cb0ed4cf533163f82c70c7833bb9d'] = 'Groupe de boutique :';
$_LANGADM['AdminShopfedca77235d8e28be78f54c7f960c5a0'] = 'Catégorie principale :';
$_LANGADM['AdminShop24a23d787190f2c4812ff9ab11847a72'] = 'Statut:';
$_LANGADM['AdminShopb9f5c797ebbf55adccdd8539a65a0241'] = 'Désactivé';
$_LANGADM['AdminShop37c0e2b9736bc4cc2005f7be3fd66fe5'] = 'Activer ou désactiver la boutique';
$_LANGADM['AdminShopa9e4402481bd9b8e36752bf731f67eb6'] = 'Thème :';
$_LANGADM['AdminShop38fb7d24e0d60a048f540ecb18e13376'] = 'Enregistrer';
$_LANGADM['AdminShop1d6af794b2599c1407a83029a09d1ecf'] = 'Transporteurs';
$_LANGADM['AdminShop45f739d1a4b022ab097c583c38eb388f'] = 'Traductions des transporteurs';
$_LANGADM['AdminShopb8ddfef634372f5719de857ea26c99be'] = 'Langues des catégories';
$_LANGADM['AdminShop622f3c75de9f3481ffc58c1f292c1c2b'] = 'Page CMS';
$_LANGADM['AdminShopbbaff12800505b22a853e8b7f4eb6a22'] = 'Contact';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment