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
8e352074
Commit
8e352074
authored
Aug 25, 2017
by
Nahla Shiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
produits associes
parent
322aa004
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
88 additions
and
62 deletions
+88
-62
nap.js
wp-content/themes/nap/assets/js/nap.js
+19
-17
functions.php
wp-content/themes/nap/functions.php
+37
-0
archive-product.php
wp-content/themes/nap/woocommerce/archive-product.php
+12
-2
simple.php
...mes/nap/woocommerce/single-product/add-to-cart/simple.php
+10
-20
variable.php
...s/nap/woocommerce/single-product/add-to-cart/variable.php
+8
-22
up-sells.php
...ontent/themes/nap/woocommerce/single-product/up-sells.php
+2
-1
No files found.
wp-content/themes/nap/assets/js/nap.js
View file @
8e352074
...
...
@@ -85,7 +85,7 @@ jQuery(document).ready(function() {
var
selected_formats
=
tabformat
.
join
(
','
);
var
selected_matiere
=
tabmatiere
.
join
(
','
);
var
selected_univers
=
tabunivers
.
join
(
','
);
var
params
=
{
pa_couleur
:
selected_colors
,
pa_format
:
selected_formats
,
pa_matiere
:
selected_matiere
,
pa_univers
:
selected_univers
};
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));
...
...
@@ -116,7 +116,7 @@ jQuery(document).ready(function() {
});
jQuery
(
window
).
on
(
'load'
,
function
()
{
jQuery
(
'.filter-bloc '
).
each
(
function
()
{
if
(
jQuery
(
this
).
find
(
'.bloc-content'
).
length
==
0
)
{
...
...
@@ -125,17 +125,19 @@ jQuery(document).ready(function() {
}
});
jQuery
(
'.list-animation section'
).
each
(
function
()
{
if
(
jQuery
(
this
).
find
(
"article"
).
length
)
{
console
.
log
(
'article found'
);
//
console.log('article found');
}
else
{
jQuery
(
this
).
hide
();
}
})
});
});
...
...
wp-content/themes/nap/functions.php
View file @
8e352074
...
...
@@ -754,3 +754,40 @@ function nap_change_filter_post() {
}
}
}
function
nap_show_associated_products
()
{
$associated_products
=
''
;
global
$product
;
$upsells
=
wc_products_array_orderby
(
array_filter
(
array_map
(
'wc_get_product'
,
$product
->
get_upsell_ids
()
),
'wc_products_array_filter_visible'
),
'rand'
,
'desc'
);
$associated_products
.=
'<div class="suggest-header">
<h2>Produits associés</h2>
<span class="close-btn"></span>
</div>
<div class="product-list-content">'
;
foreach
(
$upsells
as
$upsell
)
:
$img
=
''
;
if
(
has_post_thumbnail
(
$upsell
->
get_id
()))
$img
=
get_the_post_thumbnail
(
$upsell
->
get_id
(),
'medium'
);
else
{
$product
=
new
WC_Product_Variable
(
$upsell
->
get_id
()
);
$variations
=
$product
->
get_available_variations
();
if
(
isset
(
$variations
[
0
]))
$img
=
get_the_post_thumbnail
(
$variations
[
0
][
'variation_id'
],
'medium'
);
}
$associated_products
.=
'<article class = "row full-width">
<a href="#"></a>
<figure>
'
.
$img
.
'
</figure>
<h3 class = "font-small" >'
.
$upsell
->
name
.
'</h3>
</article>'
;
endforeach
;
$associated_products
.=
'</div>'
;
return
$associated_products
;
}
\ No newline at end of file
wp-content/themes/nap/woocommerce/archive-product.php
View file @
8e352074
...
...
@@ -72,7 +72,9 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
<ul
<?php
if
(
$value
==
'pa_couleur'
)
echo
'class = "list-color-filter clearfix"'
;
?>
id=
"
<?php
echo
$value
;
?>
"
>
<?php
$colors
=
array
();
foreach
(
$terms
as
$term
)
:
foreach
(
$terms
as
$term
)
:
if
(
$value
==
'pa_couleur'
)
:
$colors
[
$term
->
name
]
=
get_field
(
'couleurs'
,
'pa_couleur_'
.
$term
->
term_id
);
...
...
@@ -80,6 +82,13 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
$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
);
if
(
$value
==
'pa_univers'
)
{
$unv
=
get_term_by
(
'name'
,
$term
,
'pa_univers'
);
$termID
=
$term
->
term_id
;
$date_deb
=
get_field
(
'uv_date_debut'
,
'pa_univers_'
.
$unv
->
term_id
);
$date_fin
=
get_field
(
'uv_date_fin'
,
'pa_univers_'
.
$unv
->
term_id
);
}
?>
<li
class=
"
<?php
echo
$filter_format
.
' '
.
$filter_matiere
.
' '
.
$filter_univers
;
?>
"
>
<?php
echo
$term
;
?>
</li>
...
...
@@ -188,6 +197,7 @@ $child_category = get_terms('product_cat', array('parent' => $cateID, 'child_of'
$list_att
[
'pa_univers'
]
=
$value
->
name
;
}
}
nap_filter_attribute
(
$id
,
$args
,
$options
,
$list_att
,
$_GET
);
}
else
{
echo
nap_get_item
(
$id
,
$args
,
$current_page
,
$options
);
...
...
wp-content/themes/nap/woocommerce/single-product/add-to-cart/simple.php
View file @
8e352074
...
...
@@ -157,30 +157,20 @@ do_action('woocommerce_before_add_to_cart_form');
<a
class=
"btn pink-btn rounded download-btn download_file"
>
Télécharger la fiche technique
</a>
<a
href=
"
<?php
echo
get_permalink
(
43
);
?>
?product_id=
<?php
echo
$product
->
get_id
()
?>
&"
class=
"hidden download_file_link"
id=
"
<?php
echo
$current_variationID
?>
"
></a>
</div>
<?php
if
(
count
(
$product
->
get_upsell_ids
()))
:
?>
<div
class=
"font-small circle-btn add-icon show-product"
><span
class=
"abs-center"
>
Produits associées
</span></div>
<?php
endif
;
?>
</div>
</div>
<div
class=
"product-list transition border-l fixed"
>
<div
class=
"suggest-header"
>
<h2>
Produits associés
</h2>
<span
class=
"close-btn"
></span>
</div>
<div
class=
"product-list-content"
>
<article
class =
"row full-width"
>
<a
href=
"#"
></a>
<figure>
<img
src=
"http://nap.mano.fr/wp-content/uploads/2017/07/505714-papier-toilette-jumbo-500x375.jpg"
alt=
""
title=
""
>
</figure>
<h3
class =
"font-small"
>
Bobines papier toilette
</h3>
</article>
<article
class =
"row full-width"
>
<a
href=
"#"
></a>
<figure>
<img
src=
"http://nap.mano.fr/wp-content/uploads/2017/07/450108-flexibles-noirs-21cm-315x500.jpg"
alt=
""
title=
""
>
</figure>
<h3
class =
"font-small"
>
Pailles
</h3>
</article>
</div>
<?php
echo
nap_show_associated_products
();
?>
</div>
<div
class=
"display--only-mobile"
><span
class =
"chevron bottom blue-bg down-btn show-product-mobile"
></span></div>
</div>
wp-content/themes/nap/woocommerce/single-product/add-to-cart/variable.php
View file @
8e352074
...
...
@@ -289,32 +289,18 @@ do_action('woocommerce_before_add_to_cart_form');
<a
class=
"btn pink-btn rounded download-btn download_file"
>
Télécharger la fiche technique
</a>
<a
href=
"
<?php
echo
get_permalink
(
43
);
?>
?product_id=
<?php
echo
$product
->
get_id
()
?>
&"
class=
"hidden download_file_link"
id=
"
<?php
echo
$current_variationID
?>
"
></a>
</div>
<?php
if
(
count
(
$product
->
get_upsell_ids
()))
:
?>
<div
class=
"font-small circle-btn add-icon show-product"
><span
class=
"abs-center"
>
Produits associées
</span></div>
</div>
<?php
endif
;
?>
</div>
<div
class=
"product-list transition border-l fixed"
>
<div
class=
"suggest-header"
>
<h2>
Produits associés
</h2>
<span
class=
"close-btn"
></span>
</div>
<div
class=
"product-list-content"
>
<article
class =
"row full-width"
>
<a
href=
"#"
></a>
<figure>
<img
src=
"http://nap.mano.fr/wp-content/uploads/2017/07/505714-papier-toilette-jumbo-500x375.jpg"
alt=
""
title=
""
>
</figure>
<h3
class =
"font-small"
>
Bobines papier toilette
</h3>
</article>
<article
class =
"row full-width"
>
<a
href=
"#"
></a>
<figure>
<img
src=
"http://nap.mano.fr/wp-content/uploads/2017/07/450108-flexibles-noirs-21cm-315x500.jpg"
alt=
""
title=
""
>
</figure>
<h3
class =
"font-small"
>
Pailles
</h3>
</article>
</div>
<?php
echo
nap_show_associated_products
();
?>
</div>
<div
class=
"display--only-mobile"
><span
class =
"chevron bottom blue-bg down-btn show-product-mobile"
></span></div>
</div>
wp-content/themes/nap/woocommerce/single-product/up-sells.php
View file @
8e352074
...
...
@@ -19,7 +19,7 @@
if
(
!
defined
(
'ABSPATH'
)
)
{
exit
;
}
/*
if ( $upsells ) : ?>
<section class="up-sells upsells products">
...
...
@@ -46,3 +46,4 @@ if ( $upsells ) : ?>
<?php endif;
wp_reset_postdata();
*/
\ 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