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
6204d4ad
Commit
6204d4ad
authored
Aug 23, 2017
by
Nahla Shiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fiche Produit pb nommage
parent
fb420d39
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
69 additions
and
41 deletions
+69
-41
nap.js
wp-content/themes/nap/assets/js/nap.js
+50
-22
functions.php
wp-content/themes/nap/functions.php
+10
-1
archive-product.php
wp-content/themes/nap/woocommerce/archive-product.php
+6
-15
variable.php
...s/nap/woocommerce/single-product/add-to-cart/variable.php
+3
-3
No files found.
wp-content/themes/nap/assets/js/nap.js
View file @
6204d4ad
...
...
@@ -18,7 +18,7 @@ jQuery(document).ready(function() {
jQuery
(
'li.format-list:first-child input'
).
attr
(
'checked'
,
true
);
jQuery
(
document
).
on
(
'change'
,
'.color-list input,.format-list input '
,
function
()
{
var
varID
=
jQuery
(
'input[name="variation_id"]'
).
val
();
...
...
@@ -31,32 +31,65 @@ jQuery(document).ready(function() {
var
name
=
jQuery
(
this
).
attr
(
'name'
);
if
(
jQuery
(
this
).
is
(
':checked'
)
&&
name
==
'attribute_pa_couleur'
)
{
jQuery
(
'li.format-list:first-child input'
).
attr
(
'checked'
,
true
);
jQuery
(
'.info-color'
).
text
(
jQuery
(
this
).
attr
(
'value'
));
}
if
(
jQuery
(
this
).
is
(
':checked'
)
&&
name
==
'attribute_pa_format'
)
{
jQuery
(
'.info-format'
).
text
(
jQuery
(
this
).
attr
(
'value'
));
jQuery
(
'.info-format-txt'
).
text
(
jQuery
(
this
).
attr
(
'value'
));
var
format
=
jQuery
(
'.format-list.selected .format-desc'
).
text
();
jQuery
(
'.info-format'
).
text
(
format
);
jQuery
(
'.info-format-txt'
).
text
(
format
);
}
});
jQuery
(
"#search-btn"
).
on
(
'click'
,
function
()
{
jQuery
(
'article'
).
show
();
jQuery
(
'.list-animation section'
).
show
();
jQuery
(
'article'
).
removeClass
(
'in_search'
);
jQuery
(
'article'
).
removeClass
(
'selected'
);
jQuery
(
'article'
).
removeClass
(
'hidden'
);
//filtre couleur
var
tabcolor
=
[];
var
tabcolor
=
[];
i
=
0
;
jQuery
(
"
.list-color-filte
r .selected"
).
each
(
function
()
{
jQuery
(
"
#pa_couleu
r .selected"
).
each
(
function
()
{
tabcolor
[
i
++
]
=
jQuery
(
this
).
attr
(
'data-color'
);
});
//console.log(tabcolor);
var
tabformat
=
[];
i
=
0
;
jQuery
(
"#pa_format .selected"
).
each
(
function
()
{
tabformat
[
i
++
]
=
jQuery
(
this
).
text
();
});
var
tabmatiere
=
[];
i
=
0
;
jQuery
(
"#pa_matiere .selected"
).
each
(
function
()
{
tabmatiere
[
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
};
window
.
location
.
href
=
"?"
+
jQuery
.
param
(
params
);
/*history.pushState({}, null, "?" + jQuery.param(params));
jQuery.ajax({
type: 'GET',
url: '',
data: {"pa_couleur": selected_colors,"pa_format":selected_formats},
success: function(data) {
},
error: function() {
}
});
jQuery(".product-list article li").each(function() {
var product_color = jQuery(this).attr('data-color');
if
(
jQuery
.
inArray
(
product_color
,
tabcolor
)
>=
0
)
{
var product_format = jQuery(this).attr('data-format');
if (jQuery.inArray(product_color, tabcolor) >= 0
|| jQuery.inArray(product_format, tabformat) >= 0
) {
jQuery(this).closest('article').addClass('in_search');
...
...
@@ -64,21 +97,16 @@ jQuery(document).ready(function() {
});
*/
});
if
(
tabcolor
.
length
>
0
)
{
jQuery
(
'article:not(.in_search)'
).
hide
();
jQuery
(
'.list-animation section'
).
each
(
function
()
{
if
(
jQuery
(
this
).
find
(
'article.in_search'
).
length
==
0
)
{
/*jQuery('.list-animation section').each(function() {
if (jQuery(this).find('article.selected').length == 0) {
jQuery(this).hide();
}
});
}
});
});*/
});
\ No newline at end of file
wp-content/themes/nap/functions.php
View file @
6204d4ad
...
...
@@ -681,4 +681,13 @@ function nap_attribute_by_category($categorie, $attr){
}
add_image_size
(
'wordpress-thumbnail'
,
200
,
200
,
FALSE
);
\ No newline at end of file
add_image_size
(
'wordpress-thumbnail'
,
200
,
200
,
FALSE
);
function
nap_selected_filter
(
$search
,
$attribute
){
if
(
isset
(
$search
)
&&
stristr
(
$search
,
$attribute
))
:
$filter_class
=
'selected'
;
else
:
$filter_class
=
''
;
endif
;
return
$filter_class
;
}
\ No newline at end of file
wp-content/themes/nap/woocommerce/archive-product.php
View file @
6204d4ad
...
...
@@ -64,9 +64,8 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
if
(
$value
==
'pa_couleur'
)
$terms
=
get_terms
(
$value
);
else
$terms
=
nap_attribute_by_category
(
$cateID
,
$value
);
$terms
=
nap_attribute_by_category
(
$cateID
,
$value
);
if
(
!
empty
(
$terms
)
&&
!
is_wp_error
(
$terms
))
:
?>
<div
class=
"bloc-content"
>
...
...
@@ -76,25 +75,17 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
if
(
$value
==
'pa_couleur'
)
:
$color
=
get_field
(
'couleurs'
,
'pa_couleur_'
.
$term
->
term_id
);
if
(
isset
(
$color
)
&&
strlen
(
$color
)
>
0
)
:
if
(
isset
(
$_GET
[
'pa_couleur'
])
&&
stristr
(
$_GET
[
'pa_couleur'
],
$color
))
:
$filter_class
=
'selected'
;
else
:
$filter_class
=
''
;
endif
;
$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
);
?>
<?php
if
(
isset
(
$_GET
[
'pa_format'
])
&&
stristr
(
$_GET
[
'pa_format'
],
$term
))
:
$filter_class
=
'selected'
;
else
:
$filter_class
=
''
;
endif
;
?>
<li
class=
"
<?php
echo
$filter_class
?>
"
>
<?php
echo
$term
;
?>
</li>
<li
class=
"
<?php
echo
$filter_format
.
' '
.
$filter_matiere
;
?>
"
>
<?php
echo
$term
;
?>
</li>
<?php
endif
;
endforeach
;
...
...
wp-content/themes/nap/woocommerce/single-product/add-to-cart/variable.php
View file @
6204d4ad
...
...
@@ -254,11 +254,11 @@ do_action('woocommerce_before_add_to_cart_form');
</form>
<div
class=
"product-info row center left border-l"
>
<div
class=
"info-content"
>
<?php
$format
=
str_replace
(
'-'
,
' '
,
$_GET
[
'attribute_format'
]);
?>
<h2
class =
"crete font-small"
>
<?php
echo
$sub_cat
[
0
]
->
name
;
?>
</h2>
<h3
class =
"crete font-small info-attr"
><span
class=
"info-format"
>
<?php
echo
$
_GET
[
'attribute_format'
]
?>
</span>
<span
class=
"info-color"
>
<?php
echo
$_GET
[
'attribute_couleur'
]
?>
</span></h3>
<h3
class =
"crete font-small info-attr"
><span
class=
"info-format"
>
<?php
echo
$
format
;
?>
</span>
<span
class=
"info-color"
>
<?php
echo
$_GET
[
'attribute_couleur'
]
?>
</span></h3>
<div
class=
"details font-small"
>
<p
class=
"info-format-txt"
>
<?php
echo
$
_GET
[
'attribute_format'
]
?>
</p>
<p
class=
"info-format-txt"
>
<?php
echo
$
format
;
?>
</p>
<p
class=
"pq"
>
<?php
echo
nap_variable_meta
(
$current_variationID
,
'variation_description'
);
?>
</p>
</div>
<div
class=
"price"
>
...
...
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