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 {
.filter-list{
background: #fff;
color: inherit;
padding: 98px 31px 15px 30px;
padding: 98px 31px 30px 30px;
width: 245px;
left: 0;
opacity: 0;
visibility: hidden;
margin-left: -4px;
overflow: auto;
}
.filter-list .top-header{
margin-bottom: 25px;
......
......@@ -113,7 +113,7 @@ $('.footer-home-content').on('click','.home-down:not(.scrolled)',function(e){
})
//END get file name
//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();
$('.load-page').parent().removeClass('active');
history.pushState(null, null, $(this).find('a').attr('href'));
......@@ -124,6 +124,7 @@ $('.footer-home-content').on('click','.home-down:not(.scrolled)',function(e){
$(document).on('click','.acces li .login',function(e){
e.stopImmediatePropagation();
$('.popup-container').fadeIn();
$( ".c-hamburger" ).trigger( "click" );
// $('#user_login').attr('placeholder', 'Identifiant');
// $('#user_pass').attr('placeholder', 'Mot de passe');
$('.popup-first').removeClass('fadeOutDown ').addClass('animated visible-elem pulse');
......
......@@ -20,6 +20,7 @@ function loadProductContent() {
$('.pa_couleur li').selectColor();
$('.pa_format li').selectFormat();
$('.color-list.selected').selectSlide($('#slides'));
//$('.btn-wrapper.close-panel').addClass('int-link');
},100)
$('.download-btn:not(.download_file)').click(function(e){
e.stopPropagation();
......@@ -175,10 +176,13 @@ $(function(){
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() {
//localStorage['from-site'] = true;
$('head').append($('.header-shop'));
var toLink = $(this).data('link');
history.pushState(null, null, toLink);
// $.post(toLink, { fromSite: true});
//$.cookie("formSite", 1);
sessionStorage.setItem("formSite","yes");
$('.load-page').parent().addClass('active');
$('.load-page').load(toLink,function(){
loadProductContent();
......
......@@ -652,16 +652,27 @@ function nap_save_general_proddata_custom_field($post_id) {
}
}
session_start();
$ref = false;
//MS 2017-08-02 : Get referrer
function externe_referrer() {
session_start();
$url = $_SERVER['HTTP_REFERER'];
$postid = url_to_postid($url);
$ref = false;
$notRefreshed = true;
$uri = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$pageWasRefreshed = isset($_SERVER['HTTP_CACHE_CONTROL']) && $_SERVER['HTTP_CACHE_CONTROL'] === 'max-age=0';
if ($pageWasRefreshed || empty($url)) {
$pageWasRefreshed = isset($_SERVER['HTTP_CACHE_CONTROL']) &&($_SERVER['HTTP_CACHE_CONTROL'] === 'max-age=0' || $_SERVER['HTTP_CACHE_CONTROL'] == 'no-cache');
//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;
}
}
else
{
$ref = false;
$_SESSION['LastRequest'] = $RequestSignature;
}
return $ref;
}
......
......@@ -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'));
$ext_ref = externe_referrer();
$class_back = "";
if ($ext_ref) {
$category_link = get_category_link($parent_cat[0]);
$class_back = "ext-link";
} else {
$category_link = "#";
$category_link = get_category_link($parent_cat[0]);
if(!$ext_ref) {
$class_back = "int-link";
}
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
$sub_cat = wp_get_post_terms($product->get_id(), 'product_cat', array( 'parent' =>$parent_cat[0],'fields' => 'all' ));
$current_variationID = $_GET['variation_id'];
$ext_ref = externe_referrer();
$class_back = "";
$category_link = get_category_link($parent_cat[0]);
if($ext_ref) {
$class_back = "ext-link";
if(!$ext_ref) {
$class_back = "int-link";
}
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