Commit 349939a3 authored by imac's avatar imac

[Merge]

parent 1bc53557
......@@ -23,8 +23,8 @@ function get_zones($post_ID = 157) {
}
function nap_enqueue_scripts() {
// Enqueue jQuery UI and autocomplete
wp_enqueue_script( 'jquery-ui-core' );
// Enqueue jQuery UI and autocomplete
wp_enqueue_script( 'jquery-ui-core' );
wp_enqueue_script( 'jquery-ui-autocomplete' );
}
add_action( 'wp_enqueue_scripts', 'nap_enqueue_scripts' );
......@@ -194,9 +194,9 @@ function nap_variation_settings_fields($loop, $variation_data, $variation) {
)
);?>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery(document).ready(function(){
var posts = <?php echo json_encode( $option ); ?>;
var posts = <?php echo json_encode( $option ); ?>;
var data = [];
jQuery.each(posts, function( index, value ) {
......@@ -205,18 +205,18 @@ function nap_variation_settings_fields($loop, $variation_data, $variation) {
jQuery('input[name="fiche_var_auto_<?php echo $variation->ID?>"]').click(function() {
jQuery(this).val('');
});
jQuery( 'input[name="fiche_var_auto_<?php echo $variation->ID?>"]' ).autocomplete({
jQuery( 'input[name="fiche_var_auto_<?php echo $variation->ID?>"]' ).autocomplete({
source: data,
minLength: 1,
select: function(event, ui) {
source: data,
minLength: 1,
select: function(event, ui) {
event.preventDefault();
jQuery(this).val(ui.item.label);
jQuery(this).val(ui.item.label);
jQuery("#_var_fiche_<?php echo $variation->ID?>").val(ui.item.value);
}
});
});
</script>
}
});
});
</script>
<?php
woocommerce_wp_hidden_input(
......@@ -290,7 +290,7 @@ function nap_menu() {
$menu = "";
$taxonomy = 'product_cat';
$orderby = 'title';
$orderby = 'id';
$show_count = 0;
$pad_counts = 0;
$hierarchical = 1;
......@@ -316,7 +316,7 @@ function nap_menu() {
'taxonomy' => $taxonomy,
'child_of' => 0,
'parent' => $category_id,
'orderby' => $orderby,
'orderby' => 'title',
'show_count' => $show_count,
'pad_counts' => $pad_counts,
'hierarchical' => $hierarchical,
......@@ -537,9 +537,9 @@ function nap_general_product_data_custom_field($post_id) {
)
);?>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery(document).ready(function(){
var posts = <?php echo json_encode( $option ); ?>;
var posts = <?php echo json_encode( $option ); ?>;
var data = [];
jQuery.each(posts, function( index, value ) {
......@@ -548,18 +548,18 @@ function nap_general_product_data_custom_field($post_id) {
jQuery('input[name="fiche_simple_auto"]').click(function() {
jQuery(this).val('');
});
jQuery( 'input[name="fiche_simple_auto"]' ).autocomplete({
jQuery( 'input[name="fiche_simple_auto"]' ).autocomplete({
source: data,
minLength: 1,
select: function(event, ui) {
source: data,
minLength: 1,
select: function(event, ui) {
event.preventDefault();
jQuery(this).val(ui.item.label);
jQuery(this).val(ui.item.label);
jQuery("#_fiche_simple").val(ui.item.value);
}
});
});
</script>
}
});
});
</script>
<?php
woocommerce_wp_hidden_input(
......@@ -597,5 +597,41 @@ function nap_save_general_proddata_custom_field( $post_id ) {
update_post_meta( $post_id, '_itf14_simple', esc_attr( $text_itf14 ) );
}
}
//MS 2017-08-02 : Get referrer
function externe_referrer( ) {
$url = $_SERVER['HTTP_REFERER'];
$postid = url_to_postid( $url );
$ref = false;
$uri = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$pageWasRefreshed = isset($_SERVER['HTTP_CACHE_CONTROL']) && $_SERVER['HTTP_CACHE_CONTROL'] === 'max-age=0';
if($pageWasRefreshed ) {
$postid = -1;
} else{
$postid = 0;
}
if ($postid < 0){
$ref = true;
}
echo $postid;
if($pageWasRefreshed ) {
$postid = -1;
}
global $post;
$terms = get_the_terms( $post->ID, 'product_cat' );
foreach ( $terms as $term ) {
$product_cat_id = $term->term_id;
echo 'prod_eeeeee === '. $product_cat_id;
break;
return $ref ;
}
}
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