Merge branch 'ticket-9260' into develop
This commit is contained in:
commit
411a95e56b
@ -7,7 +7,25 @@ class ProductController extends ProductControllerCore {
|
||||
$id_category = $this->product->id_category_default;
|
||||
$sale = Sale::getSaleFromCategory($id_category);
|
||||
|
||||
if (file_exists(_PS_ROOT_DIR_.'/img/c/'.(int)$id_category.'_thumb_vp.jpg') && $id_category != $sale->id_category) {
|
||||
/* Find out the good 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'))
|
||||
{
|
||||
if (isset($regs[2]) AND is_numeric($regs[2]))
|
||||
{
|
||||
if (Product::idIsOnCategoryId((int)($this->product->id), array('0' => array('id_category' => (int)($regs[2])))))
|
||||
$found_category = (int)$regs[2];
|
||||
}
|
||||
elseif (isset($regs[5]) AND is_numeric($regs[5]))
|
||||
{
|
||||
if (Product::idIsOnCategoryId((int)($this->product->id), array('0' => array('id_category' => (int)($regs[5])))))
|
||||
$found_category = (int)$regs[5];
|
||||
}
|
||||
}
|
||||
|
||||
if ($found_category && file_exists(_PS_ROOT_DIR_.'/img/c/'.(int)$found_category.'_thumb_vp.jpg') && $found_category != $sale->id_category) {
|
||||
$id_category_thumb = $found_category;
|
||||
} elseif (file_exists(_PS_ROOT_DIR_.'/img/c/'.(int)$id_category.'_thumb_vp.jpg') && $id_category != $sale->id_category) {
|
||||
$id_category_thumb = $id_category;
|
||||
} else {
|
||||
$id_category_thumb = $sale->id_category;
|
||||
|
Loading…
Reference in New Issue
Block a user