Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development
This commit is contained in:
commit
da15136c67
4 files changed
+49
-24
No files matched your search
@@ -2217,6 +2217,7 @@ exit;
|
|||||||
if (!is_array($args) || !count($args))
|
if (!is_array($args) || !count($args))
|
||||||
return;
|
return;
|
||||||
$_GET = array_merge($args, $_GET);
|
$_GET = array_merge($args, $_GET);
|
||||||
|
$_SERVER['QUERY_STRING'] = $argv[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -513,6 +513,7 @@ class AdminControllerCore extends Controller
|
|||||||
*/
|
*/
|
||||||
public function postProcess()
|
public function postProcess()
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
if ($this->ajax)
|
if ($this->ajax)
|
||||||
{
|
{
|
||||||
// from ajax-tab.php
|
// from ajax-tab.php
|
||||||
@@ -544,6 +545,10 @@ class AdminControllerCore extends Controller
|
|||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (PrestaShopException $e) {
|
||||||
|
$this->errors[] = $e->getMessage();
|
||||||
|
};
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -583,16 +588,27 @@ class AdminControllerCore extends Controller
|
|||||||
$headers = array();
|
$headers = array();
|
||||||
foreach ($this->fields_list as $datas)
|
foreach ($this->fields_list as $datas)
|
||||||
$headers[] = Tools::htmlentitiesDecodeUTF8($datas['title']);
|
$headers[] = Tools::htmlentitiesDecodeUTF8($datas['title']);
|
||||||
|
|
||||||
$content = array();
|
$content = array();
|
||||||
foreach ($this->_list as $i => $row)
|
foreach ($this->_list as $i => $row)
|
||||||
{
|
{
|
||||||
$content[$i] = array();
|
$content[$i] = array();
|
||||||
foreach ($this->fields_list as $key => $value)
|
$path_to_image = false;
|
||||||
if (isset($row[$key]))
|
foreach ($this->fields_list as $key => $params)
|
||||||
$content[$i][] = Tools::htmlentitiesDecodeUTF8($row[$key]);
|
{
|
||||||
|
$field_value = isset($row[$key]) ? Tools::htmlentitiesDecodeUTF8($row[$key]) : '';
|
||||||
|
if ($key == 'image')
|
||||||
|
{
|
||||||
|
if ($params['image'] != 'p' || Configuration::get('PS_LEGACY_IMAGES'))
|
||||||
|
$path_to_image = Tools::getShopDomain(true)._PS_IMG_.$params['image'].'/'.$row['id_'.$this->table].(isset($row['id_image']) ? '-'.(int)$row['id_image'] : '').'.'.$this->imageType;
|
||||||
|
else
|
||||||
|
$path_to_image = Tools::getShopDomain(true)._PS_IMG_.$params['image'].'/'.Image::getImgFolderStatic($row['id_image']).(int)$row['id_image'].'.'.$this->imageType;
|
||||||
|
if ($path_to_image)
|
||||||
|
$field_value = $path_to_image;
|
||||||
}
|
}
|
||||||
|
$content[$i][] = $field_value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
'export_precontent' => "\xEF\xBB\xBF",
|
'export_precontent' => "\xEF\xBB\xBF",
|
||||||
'export_headers' => $headers,
|
'export_headers' => $headers,
|
||||||
@@ -1161,6 +1177,7 @@ class AdminControllerCore extends Controller
|
|||||||
header('Location: '.$this->redirect_after);
|
header('Location: '.$this->redirect_after);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function display()
|
public function display()
|
||||||
{
|
{
|
||||||
$this->context->smarty->assign(array(
|
$this->context->smarty->assign(array(
|
||||||
|
|||||||
+13
-2
@@ -352,13 +352,24 @@ class ShopCore extends ObjectModel
|
|||||||
if ((!$id_shop && defined('_PS_ADMIN_DIR_')) || Tools::isPHPCLI())
|
if ((!$id_shop && defined('_PS_ADMIN_DIR_')) || Tools::isPHPCLI())
|
||||||
{
|
{
|
||||||
// If in admin, we can access to the shop without right URL
|
// If in admin, we can access to the shop without right URL
|
||||||
|
if ((!$id_shop && Tools::isPHPCLI()) || defined('_PS_ADMIN_DIR_'))
|
||||||
|
$id_shop = (int)Configuration::get('PS_SHOP_DEFAULT');
|
||||||
|
|
||||||
|
$shop = new Shop((int)$id_shop);
|
||||||
|
if (!Validate::isLoadedObject($shop))
|
||||||
$shop = new Shop((int)Configuration::get('PS_SHOP_DEFAULT'));
|
$shop = new Shop((int)Configuration::get('PS_SHOP_DEFAULT'));
|
||||||
|
|
||||||
$shop->physical_uri = preg_replace('#/+#', '/', str_replace('\\', '/', dirname(dirname($_SERVER['SCRIPT_NAME']))).'/');
|
$shop->physical_uri = preg_replace('#/+#', '/', str_replace('\\', '/', dirname(dirname($_SERVER['SCRIPT_NAME']))).'/');
|
||||||
$shop->virtual_uri = '';
|
$shop->virtual_uri = '';
|
||||||
|
|
||||||
// Define HTTP_HOST if PHP is launched with php-cli
|
// Define some $_SERVER variables like HTTP_HOST if PHP is launched with php-cli
|
||||||
if (Tools::isPHPCLI() && !isset($_SERVER['HTTP_HOST']) || empty($_SERVER['HTTP_HOST']))
|
if (Tools::isPHPCLI())
|
||||||
|
{
|
||||||
|
if(!isset($_SERVER['HTTP_HOST']) || empty($_SERVER['HTTP_HOST']))
|
||||||
$_SERVER['HTTP_HOST'] = $shop->domain;
|
$_SERVER['HTTP_HOST'] = $shop->domain;
|
||||||
|
if(!isset($_SERVER['SERVER_NAME']) || empty($_SERVER['SERVER_NAME']))
|
||||||
|
$_SERVER['SERVER_NAME'] = $shop->domain;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -312,36 +312,32 @@ class AdminGroupsControllerCore extends AdminController
|
|||||||
return parent::renderForm();
|
return parent::renderForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function formatCategoryDiscountList($id)
|
protected function formatCategoryDiscountList($id_group)
|
||||||
{
|
{
|
||||||
$category = GroupReduction::getGroupReductions((int)$id, $this->context->language->id);
|
$group_reductions = GroupReduction::getGroupReductions((int)$id_group, $this->context->language->id);
|
||||||
$category_reductions = array();
|
$category_reductions = array();
|
||||||
$category_reduction = Tools::getValue('category_reduction');
|
$category_reduction = Tools::getValue('category_reduction');
|
||||||
|
|
||||||
foreach ($category as $category)
|
foreach ($group_reductions as $category)
|
||||||
{
|
{
|
||||||
if (is_array($category_reduction) && array_key_exists($category['id_category'], $category_reduction))
|
if (is_array($category_reduction) && array_key_exists($category['id_category'], $category_reduction))
|
||||||
$category['reduction'] = $category_reduction[$category['id_category']];
|
$category['reduction'] = $category_reduction[$category['id_category']];
|
||||||
|
|
||||||
$tmp = array();
|
$category_reductions[(int)$category['id_category']] = array(
|
||||||
$tmp['path'] = getPath(self::$currentIndex.'?tab=AdminCategories', (int)$category['id_category']);
|
'path' => getPath(self::$currentIndex.'?tab=AdminCategories', (int)$category['id_category']),
|
||||||
$tmp['reduction'] = (float)$category['reduction'] * 100;
|
'reduction' => (float)$category['reduction'] * 100,
|
||||||
$tmp['id_category'] = (int)$category['id_category'];
|
'id_category' => (int)$category['id_category']
|
||||||
$category_reductions[(int)$category['id_category']] = $tmp;
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($category_reduction))
|
if (is_array($category_reduction))
|
||||||
foreach ($category_reduction as $key => $val)
|
foreach ($category_reduction as $key => $val)
|
||||||
{
|
|
||||||
if (!array_key_exists($key, $category_reductions))
|
if (!array_key_exists($key, $category_reductions))
|
||||||
{
|
$category_reductions[(int)$key] = array(
|
||||||
$tmp = array();
|
'path' => getPath(self::$currentIndex.'?tab=AdminCategories', $key),
|
||||||
$tmp['path'] = getPath(self::$currentIndex.'?tab=AdminCategories', $key);
|
'reduction' => (float)$val * 100,
|
||||||
$tmp['reduction'] = (float)$val * 100;
|
'id_category' => (int)$key
|
||||||
$tmp['id_category'] = (int)$key;
|
);
|
||||||
$category_reductions[(int)$category['id_category']] = $tmp;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $category_reductions;
|
return $category_reductions;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user