[-] FO: Fix: many fixes - domain for cookies with different url for ssl / add to cart button for minimal quantities with product attributes
This commit is contained in:
@@ -608,7 +608,7 @@ class CategoryCore extends ObjectModel
|
||||
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
||||
}
|
||||
|
||||
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, product_attribute_shop.`id_product_attribute`, pl.`description`, pl.`description_short`, pl.`available_now`,
|
||||
$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, product_attribute_shop.`id_product_attribute`, product_attribute_shop.minimal_quantity AS product_attribute_minimal_quantity, pl.`description`, pl.`description_short`, pl.`available_now`,
|
||||
pl.`available_later`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, image_shop.`id_image`,
|
||||
il.`legend`, m.`name` AS manufacturer_name, cl.`name` AS category_default,
|
||||
DATEDIFF(product_shop.`date_add`, DATE_SUB(NOW(),
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ class CookieCore
|
||||
return false;
|
||||
if (!strstr(Tools::getHttpHost(false, false), '.'))
|
||||
return false;
|
||||
|
||||
|
||||
$domain = false;
|
||||
if ($shared_urls !== null)
|
||||
{
|
||||
|
||||
+11
-1
@@ -385,6 +385,15 @@ class DispatcherCore
|
||||
{
|
||||
$context = Context::getContext();
|
||||
|
||||
// Load custom routes from modules
|
||||
$modules_routes = Hook::exec('moduleRoutes', array(), null, true, false);
|
||||
if (is_array($modules_routes) && count($modules_routes))
|
||||
foreach($modules_routes as $module_route)
|
||||
foreach($module_route as $route => $route_details)
|
||||
if (array_key_exists('controller', $route_details) && array_key_exists('rule', $route_details)
|
||||
&& array_key_exists('keywords', $route_details) && array_key_exists('params', $route_details))
|
||||
$this->addRoute($route, $route_details['rule'], $route_details['controller'], null, $route_details['keywords'], $route_details['params']);
|
||||
|
||||
// Set default routes
|
||||
foreach (Language::getLanguages() as $lang)
|
||||
foreach ($this->default_routes as $id => $route)
|
||||
@@ -579,7 +588,8 @@ class DispatcherCore
|
||||
|
||||
if (!array_key_exists($key, $params))
|
||||
die('Dispatcher::createUrl() miss required parameter "'.$key.'" for route "'.$route_id.'"');
|
||||
$query_params[$this->default_routes[$route_id]['keywords'][$key]['param']] = $params[$key];
|
||||
if (isset($this->default_routes[$route_id]))
|
||||
$query_params[$this->default_routes[$route_id]['keywords'][$key]['param']] = $params[$key];
|
||||
}
|
||||
|
||||
// Build an url which match a route
|
||||
|
||||
+17
-11
@@ -358,7 +358,7 @@ class HookCore extends ObjectModel
|
||||
* @param int $id_module Execute hook for this module only
|
||||
* @return string modules output
|
||||
*/
|
||||
public static function exec($hook_name, $hook_args = array(), $id_module = null)
|
||||
public static function exec($hook_name, $hook_args = array(), $id_module = null, $array_return = false, $check_exceptions = true)
|
||||
{
|
||||
// Check arguments validity
|
||||
if (($id_module && !is_numeric($id_module)) || !Validate::isHookName($hook_name))
|
||||
@@ -397,11 +397,14 @@ class HookCore extends ObjectModel
|
||||
continue;
|
||||
|
||||
// Check permissions
|
||||
$exceptions = $moduleInstance->getExceptions($array['id_hook']);
|
||||
if (in_array(Dispatcher::getInstance()->getController(), $exceptions))
|
||||
continue;
|
||||
if (Validate::isLoadedObject($context->employee) && !$moduleInstance->getPermission('view', $context->employee))
|
||||
continue;
|
||||
if ($check_exceptions)
|
||||
{
|
||||
$exceptions = $moduleInstance->getExceptions($array['id_hook']);
|
||||
if (in_array(Dispatcher::getInstance()->getController(), $exceptions))
|
||||
continue;
|
||||
if (Validate::isLoadedObject($context->employee) && !$moduleInstance->getPermission('view', $context->employee))
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check which / if method is callable
|
||||
$hook_callable = is_callable(array($moduleInstance, 'hook'.$hook_name));
|
||||
@@ -416,19 +419,22 @@ class HookCore extends ObjectModel
|
||||
else if ($hook_retro_callable)
|
||||
$display = $moduleInstance->{'hook'.$retro_hook_name}($hook_args);
|
||||
// Live edit
|
||||
if ($array['live_edit'] && Tools::isSubmit('live_edit') && Tools::getValue('ad') && Tools::getValue('liveToken') == Tools::getAdminToken('AdminModulesPositions'.(int)Tab::getIdFromClassName('AdminModulesPositions').(int)Tools::getValue('id_employee')))
|
||||
if ($array_return && $array['live_edit'] && Tools::isSubmit('live_edit') && Tools::getValue('ad') && Tools::getValue('liveToken') == Tools::getAdminToken('AdminModulesPositions'.(int)Tab::getIdFromClassName('AdminModulesPositions').(int)Tools::getValue('id_employee')))
|
||||
{
|
||||
$live_edit = true;
|
||||
$output .= self::wrapLiveEdit($display, $moduleInstance, $array['id_hook']);
|
||||
}
|
||||
else if ($array_return)
|
||||
$output[] = $display;
|
||||
else
|
||||
$output .= $display;
|
||||
}
|
||||
}
|
||||
|
||||
// Return html string
|
||||
return ($live_edit ? '<script type="text/javascript">hooks_list.push(\''.$hook_name.'\'); </script>
|
||||
<div id="'.$hook_name.'" class="dndHook" style="min-height:50px">' : '').$output.($live_edit ? '</div>' : '');
|
||||
if ($array_return)
|
||||
return $output;
|
||||
else
|
||||
return ($live_edit ? '<script type="text/javascript">hooks_list.push(\''.$hook_name.'\'); </script>
|
||||
<div id="'.$hook_name.'" class="dndHook" style="min-height:50px">' : '').$output.($live_edit ? '</div>' : '');// Return html string
|
||||
}
|
||||
|
||||
public static function wrapLiveEdit($display, $moduleInstance, $id_hook)
|
||||
|
||||
@@ -322,10 +322,7 @@ class LinkCore
|
||||
|
||||
// If the module has its own route ... just use it !
|
||||
if (Dispatcher::getInstance()->hasRoute('module-'.$module.'-'.$controller, $id_lang))
|
||||
{
|
||||
unset($params['module']);
|
||||
return $this->getPageLink('module-'.$module.'-'.$controller, $ssl, $id_lang, $params);
|
||||
}
|
||||
else
|
||||
return $url.Dispatcher::getInstance()->createUrl('module', $id_lang, $params, $this->allow);
|
||||
}
|
||||
@@ -413,7 +410,6 @@ class LinkCore
|
||||
$request = urlencode($request);
|
||||
parse_str($request, $request);
|
||||
}
|
||||
unset($request['controller']);
|
||||
|
||||
$uri_path = Dispatcher::getInstance()->createUrl($controller, $id_lang, $request);
|
||||
$url = ($ssl && $this->ssl_enable) ? Tools::getShopDomainSsl(true) : Tools::getShopDomain(true);
|
||||
|
||||
+1
-1
@@ -325,7 +325,7 @@ class MediaCore
|
||||
$ui_tmp[] = Media::getJqueryUIPath($dependency, $theme, false);
|
||||
if (self::$jquery_ui_dependencies[$dependency]['theme'])
|
||||
$dep_css = Media::getCSSPath($folder.'themes/'.$theme.'/jquery.'.$dependency.'.css');
|
||||
if (!empty($dep_css) || $dep_css)
|
||||
if (isset($dep_css) && (!empty($dep_css) || $dep_css))
|
||||
$ui_path['css'] = array_merge($ui_path['css'], $dep_css);
|
||||
}
|
||||
}
|
||||
|
||||
+4
-2
@@ -3191,7 +3191,8 @@ class ProductCore extends ObjectModel
|
||||
{
|
||||
if (!array_key_exists($row['id_product'].'-'.$id_lang, self::$_frontFeaturesCache))
|
||||
self::$_frontFeaturesCache[$row['id_product'].'-'.$id_lang] = array();
|
||||
self::$_frontFeaturesCache[$row['id_product'].'-'.$id_lang][] = $row;
|
||||
if (!isset(self::$_frontFeaturesCache[$row['id_product'].'-'.$id_lang][$row['id_product']]))
|
||||
self::$_frontFeaturesCache[$row['id_product'].'-'.$id_lang][$row['id_product']] = $row;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3588,8 +3589,9 @@ class ProductCore extends ObjectModel
|
||||
$cache_key = $row['id_product'].'-'.$row['id_product_attribute'].'-'.$id_lang.'-'.(int)$usetax;
|
||||
if (isset($row['id_product_pack']))
|
||||
$cache_key .= '-pack'.$row['id_product_pack'];
|
||||
|
||||
if (isset(self::$producPropertiesCache[$cache_key]))
|
||||
return self::$producPropertiesCache[$cache_key];
|
||||
return array_merge($row, self::$producPropertiesCache[$cache_key]);
|
||||
|
||||
// Datas
|
||||
$row['category'] = Category::getLinkRewrite((int)$row['id_category_default'], (int)$id_lang);
|
||||
|
||||
@@ -240,7 +240,7 @@ class SupplierCore extends ObjectModel
|
||||
$order_by = pSQL($order_by[0]).'.`'.pSQL($order_by[1]).'`';
|
||||
}
|
||||
$alias = '';
|
||||
if ($order_by == 'price')
|
||||
if (in_array($order_by, array('price', 'date_add', 'date_upd')))
|
||||
$alias = 'product_shop.';
|
||||
elseif ($order_by == 'id_product')
|
||||
$alias = 'p.';
|
||||
|
||||
Reference in New Issue
Block a user