Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
N
NAP-wordpress
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Marwa Sfari
NAP-wordpress
Commits
7cb2e887
Commit
7cb2e887
authored
Aug 25, 2017
by
Nahla Shiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
function.php
parent
344636f1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
61 deletions
+76
-61
nap.js
wp-content/themes/nap/assets/js/nap.js
+9
-2
functions.php
wp-content/themes/nap/functions.php
+17
-0
archive-product.php
wp-content/themes/nap/woocommerce/archive-product.php
+50
-59
No files found.
wp-content/themes/nap/assets/js/nap.js
View file @
7cb2e887
...
...
@@ -57,7 +57,6 @@ jQuery(document).ready(function() {
jQuery
(
'article'
).
removeClass
(
'hidden'
);
//filtre couleur
var
tabcolor
=
[];
i
=
0
;
jQuery
(
"#pa_couleur .selected"
).
each
(
function
()
{
...
...
@@ -75,10 +74,18 @@ jQuery(document).ready(function() {
jQuery
(
"#pa_matiere .selected"
).
each
(
function
()
{
tabmatiere
[
i
++
]
=
jQuery
(
this
).
text
();
});
var
tabunivers
=
[];
i
=
0
;
jQuery
(
"#pa_univers .selected"
).
each
(
function
()
{
tabunivers
[
i
++
]
=
jQuery
(
this
).
text
();
});
var
selected_colors
=
tabcolor
.
join
(
','
);
var
selected_formats
=
tabformat
.
join
(
','
);
var
selected_matiere
=
tabmatiere
.
join
(
','
);
var
params
=
{
pa_couleur
:
selected_colors
,
pa_format
:
selected_formats
,
pa_matiere
:
selected_matiere
};
var
selected_univers
=
tabunivers
.
join
(
','
);
var
params
=
{
pa_couleur
:
selected_colors
,
pa_format
:
selected_formats
,
pa_matiere
:
selected_matiere
,
pa_univers
:
selected_univers
};
window
.
location
.
href
=
"?"
+
jQuery
.
param
(
params
);
/*history.pushState({}, null, "?" + jQuery.param(params));
...
...
wp-content/themes/nap/functions.php
View file @
7cb2e887
...
...
@@ -726,3 +726,20 @@ function nap_trash_fiche_technique($post_id) {
$wpdb
->
delete
(
$table
,
array
(
'meta_key'
=>
'fiche_simple_auto'
,
'meta_value'
=>
$post
->
post_title
));
$wpdb
->
delete
(
$table
,
array
(
'meta_key'
=>
'fiche_var_auto'
,
'meta_value'
=>
$post
->
post_title
));
}
add_action
(
'pre_get_posts'
,
'nap_change_filter_post'
);
function
nap_change_filter_post
()
{
global
$wp_query
;
if
(
is_admin
())
{
if
(
!
empty
(
$wp_query
->
query_vars
[
'product_cat'
]))
{
setcookie
(
"product_cat"
,
$wp_query
->
query_vars
[
'product_cat'
]);
}
if
(
!
isset
(
$_GET
[
'product_cat'
])
&&
(
$_GET
[
'post_type'
]
==
'product'
))
{
$wp_query
->
query_vars
[
'product_cat'
]
=
$_COOKIE
[
'product_cat'
];
}
elseif
(
isset
(
$_GET
[
'product_cat'
])
&&
empty
(
$_GET
[
'product_cat'
]))
{
setcookie
(
"product_cat"
,
$wp_query
->
query_vars
[
'product_cat'
]);
}
}
}
wp-content/themes/nap/woocommerce/archive-product.php
View file @
7cb2e887
...
...
@@ -76,18 +76,13 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
if
(
$value
==
'pa_couleur'
)
:
$colors
[
$term
->
name
]
=
get_field
(
'couleurs'
,
'pa_couleur_'
.
$term
->
term_id
);
/* if (isset($color) && strlen($color) > 0):
$filter_class = nap_selected_filter($_GET['pa_couleur'],$color);
?>
<li data-color = "<?php echo $color; ?>" class="<?php echo $term->name.' '.$filter_class; ?>"></li>
<?php
endif; */
else
:
$filter_format
=
nap_selected_filter
(
$_GET
[
'pa_format'
],
$term
);
$filter_matiere
=
nap_selected_filter
(
$_GET
[
'pa_matiere'
],
$term
);
$filter_univers
=
nap_selected_filter
(
$_GET
[
'pa_univers'
],
$term
);
?>
<li
class=
"
<?php
echo
$filter_format
.
' '
.
$filter_matiere
;
?>
"
>
<?php
echo
$term
;
?>
</li>
<li
class=
"
<?php
echo
$filter_format
.
' '
.
$filter_matiere
.
' '
.
$filter_univers
;
?>
"
>
<?php
echo
$term
;
?>
</li>
<?php
endif
;
endforeach
;
...
...
@@ -120,7 +115,7 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
</div>
</div>
</div>
<?php
endif
;
?>
<?php
endif
;
?>
<?php
foreach
(
$child_category
as
$key
=>
$value
)
:
?>
...
...
@@ -130,12 +125,12 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
</div>
</div>
<?php
endforeach
;
?>
endforeach
;
?>
</div>
<div
class=
"right-panel right"
>
<div
class=
"panel panel-content list-animation"
>
<?php
if
(
$_GET
[
'pa_couleur'
]
!=
''
||
$_GET
[
'pa_format'
]
!=
''
||
$_GET
[
'pa_matiere'
]
!=
''
)
:
?>
<?php
if
(
$_GET
[
'pa_couleur'
]
!=
''
||
$_GET
[
'pa_format'
]
!=
''
||
$_GET
[
'pa_matiere'
]
!=
''
)
:
?>
<span
class=
"search_result"
>
Résultat de votre recherche :
</span>
<?php
endif
;
?>
...
...
@@ -167,10 +162,6 @@ endforeach;
'order'
=>
'asc'
,
'post_parent'
=>
$id
);
?>
<?php
/* * ************* */
$attribute_value
[
'pa_couleur'
]
=
get_the_terms
(
$id
,
'pa_couleur'
);
$attribute_value
[
'pa_format'
]
=
get_the_terms
(
$id
,
'pa_format'
);
$attribute_value
[
'pa_matiere'
]
=
get_the_terms
(
$id
,
'pa_matiere'
);
...
...
@@ -211,4 +202,4 @@ endforeach;
</div>
</div>
</div>
<?php
get_footer
();
?>
\ No newline at end of file
<?php
get_footer
();
?>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment