Commit e8622eb2 authored by imac's avatar imac

[Bugfix]Page product : Check refresh page

parent 30e4f7b6
...@@ -1818,12 +1818,13 @@ label.chevron.bottom::first-letter { ...@@ -1818,12 +1818,13 @@ label.chevron.bottom::first-letter {
.filter-list{ .filter-list{
background: #fff; background: #fff;
color: inherit; color: inherit;
padding: 98px 31px 15px 30px; padding: 98px 31px 30px 30px;
width: 245px; width: 245px;
left: 0; left: 0;
opacity: 0; opacity: 0;
visibility: hidden; visibility: hidden;
margin-left: -4px; margin-left: -4px;
overflow: auto;
} }
.filter-list .top-header{ .filter-list .top-header{
margin-bottom: 25px; margin-bottom: 25px;
......
...@@ -113,7 +113,7 @@ $('.footer-home-content').on('click','.home-down:not(.scrolled)',function(e){ ...@@ -113,7 +113,7 @@ $('.footer-home-content').on('click','.home-down:not(.scrolled)',function(e){
}) })
//END get file name //END get file name
//END load content page on left Panel //END load content page on left Panel
$(document).on('click','.close-panel:not(.ext-link)',function(e){ $(document).on('click','.int-link',function(e){
e.preventDefault(); e.preventDefault();
$('.load-page').parent().removeClass('active'); $('.load-page').parent().removeClass('active');
history.pushState(null, null, $(this).find('a').attr('href')); history.pushState(null, null, $(this).find('a').attr('href'));
...@@ -124,6 +124,7 @@ $('.footer-home-content').on('click','.home-down:not(.scrolled)',function(e){ ...@@ -124,6 +124,7 @@ $('.footer-home-content').on('click','.home-down:not(.scrolled)',function(e){
$(document).on('click','.acces li .login',function(e){ $(document).on('click','.acces li .login',function(e){
e.stopImmediatePropagation(); e.stopImmediatePropagation();
$('.popup-container').fadeIn(); $('.popup-container').fadeIn();
$( ".c-hamburger" ).trigger( "click" );
// $('#user_login').attr('placeholder', 'Identifiant'); // $('#user_login').attr('placeholder', 'Identifiant');
// $('#user_pass').attr('placeholder', 'Mot de passe'); // $('#user_pass').attr('placeholder', 'Mot de passe');
$('.popup-first').removeClass('fadeOutDown ').addClass('animated visible-elem pulse'); $('.popup-first').removeClass('fadeOutDown ').addClass('animated visible-elem pulse');
......
...@@ -20,6 +20,7 @@ function loadProductContent() { ...@@ -20,6 +20,7 @@ function loadProductContent() {
$('.pa_couleur li').selectColor(); $('.pa_couleur li').selectColor();
$('.pa_format li').selectFormat(); $('.pa_format li').selectFormat();
$('.color-list.selected').selectSlide($('#slides')); $('.color-list.selected').selectSlide($('#slides'));
//$('.btn-wrapper.close-panel').addClass('int-link');
},100) },100)
$('.download-btn:not(.download_file)').click(function(e){ $('.download-btn:not(.download_file)').click(function(e){
e.stopPropagation(); e.stopPropagation();
...@@ -175,10 +176,13 @@ $(function(){ ...@@ -175,10 +176,13 @@ $(function(){
tlProduct.fromTo('.product-info',0.4,{autoAlpha:0, marginLeft:"-10%"},{autoAlpha:1, marginLeft:"0"},0.5); tlProduct.fromTo('.product-info',0.4,{autoAlpha:0, marginLeft:"-10%"},{autoAlpha:1, marginLeft:"0"},0.5);
} }
$('.product-list article img, .product-list article ul li').on('click', function() { $('.product-list article img, .product-list article ul li').on('click', function() {
//localStorage['from-site'] = true;
$('head').append($('.header-shop')); $('head').append($('.header-shop'));
var toLink = $(this).data('link'); var toLink = $(this).data('link');
history.pushState(null, null, toLink); history.pushState(null, null, toLink);
// $.post(toLink, { fromSite: true});
//$.cookie("formSite", 1);
sessionStorage.setItem("formSite","yes");
$('.load-page').parent().addClass('active'); $('.load-page').parent().addClass('active');
$('.load-page').load(toLink,function(){ $('.load-page').load(toLink,function(){
loadProductContent(); loadProductContent();
......
...@@ -652,16 +652,27 @@ function nap_save_general_proddata_custom_field($post_id) { ...@@ -652,16 +652,27 @@ function nap_save_general_proddata_custom_field($post_id) {
} }
} }
session_start();
$ref = false;
//MS 2017-08-02 : Get referrer //MS 2017-08-02 : Get referrer
function externe_referrer() { function externe_referrer() {
session_start();
$url = $_SERVER['HTTP_REFERER']; $url = $_SERVER['HTTP_REFERER'];
$postid = url_to_postid($url); $postid = url_to_postid($url);
$ref = false; $notRefreshed = true;
$uri = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']; $uri = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$pageWasRefreshed = isset($_SERVER['HTTP_CACHE_CONTROL']) && $_SERVER['HTTP_CACHE_CONTROL'] === 'max-age=0'; $pageWasRefreshed = isset($_SERVER['HTTP_CACHE_CONTROL']) &&($_SERVER['HTTP_CACHE_CONTROL'] === 'max-age=0' || $_SERVER['HTTP_CACHE_CONTROL'] == 'no-cache');
if ($pageWasRefreshed || empty($url)) { //The second parameter on print_r returns the result to a variable rather than displaying it
$RequestSignature = md5($_SERVER['REQUEST_URI'].$_SERVER['QUERY_STRING'].print_r($_POST, true));
if (($pageWasRefreshed || empty($url) )) // && (from-site) //$_SESSION['LastRequest'] == $RequestSignature
{
$ref = true; $ref = true;
} }
else
{
$ref = false;
$_SESSION['LastRequest'] = $RequestSignature;
}
return $ref; return $ref;
} }
......
...@@ -12,12 +12,9 @@ $parent_cat = wp_get_post_terms($product->get_id(), 'product_cat', array('parent ...@@ -12,12 +12,9 @@ $parent_cat = wp_get_post_terms($product->get_id(), 'product_cat', array('parent
$sub_cat = wp_get_post_terms($product->get_id(), 'product_cat', array('parent' => $parent_cat[0], 'fields' => 'all')); $sub_cat = wp_get_post_terms($product->get_id(), 'product_cat', array('parent' => $parent_cat[0], 'fields' => 'all'));
$ext_ref = externe_referrer(); $ext_ref = externe_referrer();
$class_back = ""; $category_link = get_category_link($parent_cat[0]);
if ($ext_ref) { if(!$ext_ref) {
$category_link = get_category_link($parent_cat[0]); $class_back = "int-link";
$class_back = "ext-link";
} else {
$category_link = "#";
} }
do_action('woocommerce_before_add_to_cart_form'); do_action('woocommerce_before_add_to_cart_form');
?> ?>
......
...@@ -28,10 +28,9 @@ $parent_cat = wp_get_post_terms($product->get_id(), 'product_cat', array( 'paren ...@@ -28,10 +28,9 @@ $parent_cat = wp_get_post_terms($product->get_id(), 'product_cat', array( 'paren
$sub_cat = wp_get_post_terms($product->get_id(), 'product_cat', array( 'parent' =>$parent_cat[0],'fields' => 'all' )); $sub_cat = wp_get_post_terms($product->get_id(), 'product_cat', array( 'parent' =>$parent_cat[0],'fields' => 'all' ));
$current_variationID = $_GET['variation_id']; $current_variationID = $_GET['variation_id'];
$ext_ref = externe_referrer(); $ext_ref = externe_referrer();
$class_back = "";
$category_link = get_category_link($parent_cat[0]); $category_link = get_category_link($parent_cat[0]);
if($ext_ref) { if(!$ext_ref) {
$class_back = "ext-link"; $class_back = "int-link";
} }
if (!function_exists('print_attribute_radio')) { if (!function_exists('print_attribute_radio')) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment