fix mobile back from product

This commit is contained in:
Marion Muszynski 2017-07-07 11:03:51 +02:00
parent 04ceecce9f
commit d775d69d33
2 changed files with 25 additions and 6 deletions

View File

@ -99,8 +99,30 @@ class ProductController extends ProductControllerCore {
$this->product->description_comment = str_replace('http://www.bebeboutik.','//www.bebeboutik.',$this->product->description_comment);
}
$back_category = false;
$link_back = false;
if (isset($_SERVER['HTTP_REFERER'])) {
$referer = explode('?', $_SERVER['HTTP_REFERER']);
if(is_array($referer) && count($referer)>1) {
$link_back = $referer[0];
} else {
$url = explode('/', $_SERVER['HTTP_REFERER']);
if (count($url) > 3 && count($url) < 5) {
$url = explode('-', end($url));
$back_category = (int)$url[0];
}
}
}
if($back_category==0){
$link = new Link();
$link_back = $link->getCategoryLink($sale->id_category, $sale->alias[$cookie->id_lang]);
}
self::$smarty->assign(array(
'bestSaleCart' => $bestSaleCart,
'back_category' => $back_category,
'link_back' => $link_back,
'product' => $this->product,
'is_random' => $is_random,
'coverImage' => Product::getCover($this->product->id),

View File

@ -100,14 +100,11 @@ var oneQuantityAvailableSentence = '{l s='Warning: 1 item in stock!' js=1}';
<div class="product_title">
<h1 class="title sale_title">
<span class="gradient">
<a href="javascript:history.back()" class="button_small back" title="{l s='Back'}">{l s='Back'}</a>
</span>
{* {if isset($smarty.server.HTTP_REFERER) && preg_replace('#^https?://[^/]+/#', '/', $smarty.server.HTTP_REFERER) != $request_uri}
{if isset($smarty.server.HTTP_REFERER) && preg_replace('#^https?://[^/]+/#', '/', $smarty.server.HTTP_REFERER) != $request_uri}
<span class="gradient">
<a href="{$smarty.server.HTTP_REFERER|escape:'htmlall':'UTF-8'|secureReferrer}" class="button_small back" title="{l s='Back'}">{l s='Back'}</a>
<a href="{if $back_category>0}javascript:history.back(){else}{$link_back|escape:'htmlall':'UTF-8'}{/if}" class="button_small back" title="{l s='Back'}">{l s='Back'}</a>
</span>
{/if} *}
{/if}
<span>{$product->name|truncate:30:'...':true:false}</span>
</h1>
</div>