Merge branch 'ticket-9260' into develop
This commit is contained in:
commit
6f357a68ab
@ -42,8 +42,12 @@ class CategoryImg extends Module {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (file_exists(_PS_ROOT_DIR_.'/img/c/'.(int)$params['id_category'].'_thumb_vp.jpg') && $params['id_category'] != $category->id) {
|
||||
if ($category && file_exists(_PS_ROOT_DIR_.'/img/c/'.(int)$params['id_category'].'_thumb_vp.jpg') && $params['id_category'] != $category->id) {
|
||||
$id_category_thumb = $params['id_category'];
|
||||
} elseif ($category && $id_parent && file_exists(_PS_ROOT_DIR_.'/img/c/'.$id_parent.'_thumb_vp.jpg') && $id_parent!= $category->id) {
|
||||
$id_category_thumb = $id_parent;
|
||||
} elseif ($category && $parent_bis && file_exists(_PS_ROOT_DIR_.'/img/c/'.$parent_bis.'_thumb_vp.jpg') && $parent_bis!= $category->id) {
|
||||
$id_category_thumb = $parent_bis;
|
||||
} else {
|
||||
$id_category_thumb = $category->id;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ class ProductController extends ProductControllerCore {
|
||||
$id_category = $this->product->id_category_default;
|
||||
$sale = Sale::getSaleFromCategory($id_category);
|
||||
|
||||
/* Find out the good Category for thumb*/
|
||||
/* Finding out the right Category for thumb*/
|
||||
$found_category = false;
|
||||
if (isset($_SERVER['HTTP_REFERER']) AND preg_match('!^(.*)\/([0-9]+)\-(.*[^\.])|(.*)id_category=([0-9]+)(.*)$!', $_SERVER['HTTP_REFERER'], $regs) AND !strstr($_SERVER['HTTP_REFERER'], '.html'))
|
||||
{
|
||||
@ -23,11 +23,19 @@ class ProductController extends ProductControllerCore {
|
||||
}
|
||||
}
|
||||
|
||||
$parent_category = ($found_category)?Category::getIdParent((int)$found_category):Category::getIdParent((int)$id_category);
|
||||
|
||||
if ($found_category && file_exists(_PS_ROOT_DIR_.'/img/c/'.(int)$found_category.'_thumb_vp.jpg') && $found_category != $sale->id_category) {
|
||||
// cat thumb
|
||||
$id_category_thumb = $found_category;
|
||||
} elseif ($parent_category && file_exists(_PS_ROOT_DIR_.'/img/c/'.(int)$parent_category.'_thumb_vp.jpg') && $parent_category != $sale->id_category) {
|
||||
// parent cat thumb
|
||||
$id_category_thumb = $parent_category;
|
||||
} elseif (file_exists(_PS_ROOT_DIR_.'/img/c/'.(int)$id_category.'_thumb_vp.jpg') && $id_category != $sale->id_category) {
|
||||
// default cat thumb
|
||||
$id_category_thumb = $id_category;
|
||||
} else {
|
||||
// sale cat thumb
|
||||
$id_category_thumb = $sale->id_category;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user