// Improve multishop code
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10982 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
+4
-4
@@ -1502,12 +1502,12 @@ class ToolsCore
|
|||||||
$domains = array();
|
$domains = array();
|
||||||
foreach (ShopUrl::getShopUrls() as $shop_url)
|
foreach (ShopUrl::getShopUrls() as $shop_url)
|
||||||
{
|
{
|
||||||
if (!isset($domains[$shop_url['domain']]))
|
if (!isset($domains[$shop_url->domain]))
|
||||||
$domains[$shop_url['domain']] = array();
|
$domains[$shop_url['domain']] = array();
|
||||||
|
|
||||||
$domains[$shop_url['domain']][] = array(
|
$domains[$shop_url->domain][] = array(
|
||||||
'physical' => $shop_url['physical_uri'],
|
'physical' => $shop_url->physical_uri,
|
||||||
'virtual' => $shop_url['virtual_uri'],
|
'virtual' => $shop_url->virtual_uri,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,11 +77,11 @@ class GroupShopCore extends ObjectModel
|
|||||||
|
|
||||||
public static function getGroupShops($active = true)
|
public static function getGroupShops($active = true)
|
||||||
{
|
{
|
||||||
return Db::getInstance()->executeS('
|
$groups = new Collection('GroupShop');
|
||||||
SELECT *
|
$groups->where('deleted = 0');
|
||||||
FROM '._DB_PREFIX_.'group_shop
|
if ($active)
|
||||||
WHERE `deleted`= 0 AND `active`='.(int)$active
|
$groups->where('active = 1');
|
||||||
);
|
return $groups;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete()
|
public function delete()
|
||||||
|
|||||||
@@ -80,13 +80,18 @@ class ShopUrlCore extends ObjectModel
|
|||||||
return $url.$this->physical_uri.$this->virtual_uri;
|
return $url.$this->physical_uri.$this->virtual_uri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get list of shop urls
|
||||||
|
*
|
||||||
|
* @param bool $id_shop
|
||||||
|
* @return Collection
|
||||||
|
*/
|
||||||
public static function getShopUrls($id_shop = false)
|
public static function getShopUrls($id_shop = false)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT *
|
$urls = new Collection('ShopUrl');
|
||||||
FROM '._DB_PREFIX_.'shop_url
|
if ($id_shop)
|
||||||
WHERE 1
|
$urls->where('id_shop = '.(int)$id_shop);
|
||||||
'.($id_shop ? ' AND id_shop = '.(int)$id_shop : '');
|
return $urls;
|
||||||
return Db::getInstance()->executeS($sql);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setMain()
|
public function setMain()
|
||||||
|
|||||||
@@ -194,16 +194,25 @@ class AdminShopControllerCore extends AdminController
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
$options = array();
|
||||||
|
foreach (GroupShop::getGroupShops() as $group)
|
||||||
|
$options[] = array(
|
||||||
|
'id_group_shop' => $group->id,
|
||||||
|
'name' => $group->name,
|
||||||
|
);
|
||||||
|
|
||||||
$this->fields_form['input'][] = array(
|
$this->fields_form['input'][] = array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'label' => $this->l('Group Shop:'),
|
'label' => $this->l('Group Shop:'),
|
||||||
'name' => 'id_group_shop',
|
'name' => 'id_group_shop',
|
||||||
'options' => array(
|
'options' => array(
|
||||||
'query' => GroupShop::getGroupShops(),
|
'query' => $options,
|
||||||
'id' => 'id_group_shop',
|
'id' => 'id_group_shop',
|
||||||
'name' => 'name'
|
'name' => 'name'
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$categories = Category::getCategories($this->context->language->id, false, false);
|
$categories = Category::getCategories($this->context->language->id, false, false);
|
||||||
$this->fields_form['input'][] = array(
|
$this->fields_form['input'][] = array(
|
||||||
|
|||||||
Reference in New Issue
Block a user