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
8b1c16df
Commit
8b1c16df
authored
Jul 19, 2017
by
Nahla Shiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
page variable
parent
bdeda2b7
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
315 additions
and
325 deletions
+315
-325
functions.php
wp-content/themes/nap/functions.php
+86
-93
archive-product.php
wp-content/themes/nap/woocommerce/archive-product.php
+3
-1
single-product.php
wp-content/themes/nap/woocommerce/single-product.php
+3
-226
variable.php
...s/nap/woocommerce/single-product/add-to-cart/variable.php
+223
-5
No files found.
wp-content/themes/nap/functions.php
View file @
8b1c16df
<?php
<?php
@
ini_set
(
'upload_max_size'
,
'64M'
);
@
ini_set
(
'post_max_size'
,
'64M'
);
@
ini_set
(
'upload_max_size'
,
'64M'
);
@
ini_set
(
'max_execution_time'
,
'300'
);
@
ini_set
(
'post_max_size'
,
'64M'
);
@
ini_set
(
'max_execution_time'
,
'300'
);
//Get Zones
//Get Zones
function
get_zones
(
$post_ID
=
157
){
function
get_zones
(
$post_ID
=
157
)
{
if
(
get_field
(
'zones_commerciaux'
,
$post_ID
))
:
if
(
get_field
(
'zones_commerciaux'
,
$post_ID
))
:
$i
=
0
;
$i
=
0
;
while
(
has_sub_field
(
'zones_commerciaux'
,
$post_ID
))
:
while
(
has_sub_field
(
'zones_commerciaux'
,
$post_ID
))
:
if
(
get_sub_field
(
'list_zones'
,
$post_ID
))
:
if
(
get_sub_field
(
'list_zones'
,
$post_ID
))
:
$list_zone
=
array
();
$list_zone
=
array
();
while
(
has_sub_field
(
'list_zones'
,
$post_ID
))
:
while
(
has_sub_field
(
'list_zones'
,
$post_ID
))
:
$list_zone
[]
=
get_sub_field
(
'num_zone'
);
$list_zone
[]
=
get_sub_field
(
'num_zone'
);
endwhile
;
endwhile
;
endif
;
endif
;
$allZones
[
'zone'
.
$i
]
=
$list_zone
;
$allZones
[
'zone'
.
$i
]
=
$list_zone
;
$i
++
;
$i
++
;
endwhile
;
endwhile
;
endif
;
endif
;
return
json_encode
(
$allZones
);
return
json_encode
(
$allZones
);
}
}
//Dequeue CSS
//Dequeue CSS
function
nap_dequeue_unnecessary_css
()
{
function
nap_dequeue_unnecessary_css
()
{
wp_dequeue_style
(
'additional-parent-style'
);
wp_dequeue_style
(
'additional-parent-style'
);
...
@@ -42,12 +44,12 @@ function nap_dequeue_unnecessary_scripts() {
...
@@ -42,12 +44,12 @@ function nap_dequeue_unnecessary_scripts() {
wp_deregister_script
(
'twentyseventeen-navigation'
);
wp_deregister_script
(
'twentyseventeen-navigation'
);
//MS : 2017-07-17
//MS : 2017-07-17
wp_register_script
(
'getZones'
,
home_url
(
'wp-content/themes/nap/assets'
)
.
'/js/map.js'
);
wp_register_script
(
'getZones'
,
home_url
(
'wp-content/themes/nap/assets'
)
.
'/js/map.js'
);
$listZones
=
array
(
'listZones'
=>
get_zones
(
157
));
$listZones
=
array
(
'listZones'
=>
get_zones
(
157
));
wp_localize_script
(
'getZones'
,
'zonesL'
,
$listZones
);
wp_localize_script
(
'getZones'
,
'zonesL'
,
$listZones
);
// wp_localize_script( 'listZones', 'object_name', $listZones );
// wp_localize_script( 'listZones', 'object_name', $listZones );
wp_enqueue_script
(
'getZones'
);
wp_enqueue_script
(
'getZones'
);
//END MS : 2017-07-17
//END MS : 2017-07-17
}
}
...
@@ -245,7 +247,7 @@ function nap_load_variation_settings_fields($variations_id) {
...
@@ -245,7 +247,7 @@ function nap_load_variation_settings_fields($variations_id) {
function
nap_category_image
(
$catID
)
{
function
nap_category_image
(
$catID
)
{
$thumbnail_id
=
get_woocommerce_term_meta
(
$catID
,
'thumbnail_id'
,
true
);
$thumbnail_id
=
get_woocommerce_term_meta
(
$catID
,
'thumbnail_id'
,
true
);
$image
=
wp_get_attachment_image_src
(
$thumbnail_id
,
'large'
);
$image
=
wp_get_attachment_image_src
(
$thumbnail_id
,
'large'
);
return
$image
[
0
];
return
$image
[
0
];
}
}
...
@@ -255,37 +257,7 @@ function nap_attachment_image($pageID) {
...
@@ -255,37 +257,7 @@ function nap_attachment_image($pageID) {
return
$url
;
return
$url
;
}
}
/* add_action( 'woocommerce_after_shop_loop_item', 'nap_variations_loop' );
function
nap_menu
()
{
function nap_variations_loop(){
global $product;
$attributes = $product->get_attributes();
if ( ! $attributes ) {
echo "No attributes";
}
foreach ( $attributes as $attribute ) {
print_r($attribute);
echo $attribute['name'] . ": ";
$product_attributes = array();
$product_attributes = explode('|',$attribute['value']);
$attributes_dropdown = '<select>';
foreach ( $product_attributes as $pa ) {
$attributes_dropdown .= '<option value="' . $pa . '">' . $pa . '</option>';
}
$attributes_dropdown .= '</select>';
echo $attributes_dropdown;
}
}
*/
function
nap_menu
()
{
$menu
=
""
;
$menu
=
""
;
$taxonomy
=
'product_cat'
;
$taxonomy
=
'product_cat'
;
...
@@ -309,7 +281,7 @@ function nap_attachment_image($pageID) {
...
@@ -309,7 +281,7 @@ function nap_attachment_image($pageID) {
foreach
(
$all_categories
as
$cat
)
{
foreach
(
$all_categories
as
$cat
)
{
if
(
$cat
->
category_parent
==
0
)
{
if
(
$cat
->
category_parent
==
0
)
{
$category_id
=
$cat
->
term_id
;
$category_id
=
$cat
->
term_id
;
$menu
.=
'<li data-page = "'
.
$category_id
.
'" data-img = "'
.
nap_category_image
(
$category_id
)
.
'"><a href="'
.
get_term_link
(
$cat
->
slug
,
'product_cat'
)
.
'">'
.
$cat
->
name
.
'</a>'
;
$menu
.=
'<li data-page = "'
.
$category_id
.
'" data-img = "'
.
nap_category_image
(
$category_id
)
.
'"><a href="'
.
get_term_link
(
$cat
->
slug
,
'product_cat'
)
.
'">'
.
$cat
->
name
.
'</a>'
;
$args2
=
array
(
$args2
=
array
(
'taxonomy'
=>
$taxonomy
,
'taxonomy'
=>
$taxonomy
,
...
@@ -323,16 +295,16 @@ function nap_attachment_image($pageID) {
...
@@ -323,16 +295,16 @@ function nap_attachment_image($pageID) {
'hide_empty'
=>
1
'hide_empty'
=>
1
);
);
$sub_cats
=
get_categories
(
$args2
);
$sub_cats
=
get_categories
(
$args2
);
$menu
.=
' <ul class = "subcat" data-page = "'
.
$category_id
.
'">'
;
$menu
.=
' <ul class = "subcat" data-page = "'
.
$category_id
.
'">'
;
if
(
$sub_cats
)
{
if
(
$sub_cats
)
{
$class
=
''
;
$class
=
''
;
foreach
(
$sub_cats
as
$key
=>
$sub_category
)
{
foreach
(
$sub_cats
as
$key
=>
$sub_category
)
{
$subcat_name
=
explode
(
' '
,
$sub_category
->
name
);
$subcat_name
=
explode
(
' '
,
$sub_category
->
name
);
if
(
$key
==
0
)
if
(
$key
==
0
)
$calss
=
'active'
;
$calss
=
'active'
;
else
else
$calss
=
''
;
$calss
=
''
;
$menu
.=
'<li data-cover = "'
.
nap_category_image
(
$sub_category
->
term_id
)
.
'"><a class="'
.
$calss
.
'" href="#cat'
.
$sub_category
->
term_id
.
'">'
.
$subcat_name
[
1
]
.
'</a></li>'
;
$menu
.=
'<li data-cover = "'
.
nap_category_image
(
$sub_category
->
term_id
)
.
'"><a class="'
.
$calss
.
'" href="#cat'
.
$sub_category
->
term_id
.
'">'
.
$subcat_name
[
1
]
.
'</a></li>'
;
}
}
}
}
...
@@ -349,8 +321,30 @@ function nap_variation_url($variationID) {
...
@@ -349,8 +321,30 @@ function nap_variation_url($variationID) {
$couleur
=
$variable_product
->
get_attribute
(
'couleur'
);
$couleur
=
$variable_product
->
get_attribute
(
'couleur'
);
$format
=
$variable_product
->
get_attribute
(
'format'
);
$format
=
$variable_product
->
get_attribute
(
'format'
);
$url
=
'?attribute_couleur='
.
trim
(
$couleur
)
.
'&attribute_format='
.
trim
(
$format
);
$url
=
'?attribute_couleur='
.
$couleur
.
'&attribute_format='
.
$format
.
'&variation_id='
.
$variationID
;
return
preg_replace
(
'/\s+/'
,
''
,
$url
);
return
preg_replace
(
'/\s+/'
,
''
,
$url
);
}
function
nap_variation_color
(
$variationID
)
{
$variable_product
=
wc_get_product
(
$variationID
);
$term
=
get_term_by
(
'name'
,
$variable_product
->
get_attribute
(
'couleur'
),
'pa_couleur'
);
$termID
=
$term
->
term_id
;
$color
=
get_field
(
'couleurs'
,
'pa_couleur_'
.
$termID
);
return
$color
;
}
function
nap_distinct_color_variations
(
$variations
)
{
$var_colors
=
array
();
foreach
(
$variations
as
$variation
)
:
$variation_ID
=
$variation
[
'variation_id'
];
$color
=
nap_variation_color
(
$variation_ID
);
if
(
!
in_array
(
$color
,
$var_colors
))
:
$var_colors
[
$variation_ID
]
=
$color
;
endif
;
endforeach
;
return
$var_colors
;
}
}
function
nap_get_item
(
$post_ID
,
$args
=
null
,
$current_page
=
''
,
$options
=
null
)
{
function
nap_get_item
(
$post_ID
,
$args
=
null
,
$current_page
=
''
,
$options
=
null
)
{
...
@@ -381,13 +375,10 @@ function nap_get_item($post_ID, $args = null, $current_page = '', $options = nul
...
@@ -381,13 +375,10 @@ function nap_get_item($post_ID, $args = null, $current_page = '', $options = nul
$variations
=
get_posts
(
$args
);
$variations
=
get_posts
(
$args
);
$temp_colors
=
array
();
$temp_colors
=
array
();
foreach
(
$variations
as
$key
=>
$value
)
{
foreach
(
$variations
as
$key
=>
$value
)
{
$variable_product
=
wc_get_product
(
$value
->
ID
);
$color
=
nap_variation_color
(
$value
->
ID
);
$term
=
get_term_by
(
'name'
,
$variable_product
->
get_attribute
(
'couleur'
),
'pa_couleur'
);
if
(
!
in_array
(
$color
,
$temp_colors
))
{
$termID
=
$term
->
term_id
;
$color
=
get_field
(
'couleurs'
,
'pa_couleur_'
.
$termID
);
if
(
!
in_array
(
$color
,
$temp_colors
)){
$temp_colors
[]
=
$color
;
$temp_colors
[]
=
$color
;
$nap_article
.=
'<li data-link = "'
.
get_permalink
(
$post_ID
)
.
nap_variation_url
(
$value
->
ID
)
.
'" data-image = "'
.
get_the_post_thumbnail_url
(
$value
->
ID
,
'smal
l'
)
.
'" data-color = "'
.
$color
.
'"></li> '
;
$nap_article
.=
'<li data-link = "'
.
get_permalink
(
$post_ID
)
.
nap_variation_url
(
$value
->
ID
)
.
'" data-image = "'
.
get_the_post_thumbnail_url
(
$value
->
ID
,
'thumbnai
l'
)
.
'" data-color = "'
.
$color
.
'"></li> '
;
}
}
}
}
$nap_article
.=
'</ul>'
;
$nap_article
.=
'</ul>'
;
...
@@ -398,3 +389,5 @@ function nap_get_item($post_ID, $args = null, $current_page = '', $options = nul
...
@@ -398,3 +389,5 @@ function nap_get_item($post_ID, $args = null, $current_page = '', $options = nul
return
$nap_article
;
return
$nap_article
;
}
}
remove_action
(
'woocommerce_after_single_product_summary'
,
'woocommerce_output_related_products'
,
20
);
wp-content/themes/nap/woocommerce/archive-product.php
View file @
8b1c16df
...
@@ -132,9 +132,11 @@ $child_category = get_terms('product_cat', array('parent'=>$cateID, 'child_of' =
...
@@ -132,9 +132,11 @@ $child_category = get_terms('product_cat', array('parent'=>$cateID, 'child_of' =
$args
=
array
(
'post_type'
=>
'product'
,
'stock'
=>
1
,
'posts_per_page'
=>
-
1
,
'product_cat'
=>
$value
->
name
);
$args
=
array
(
'post_type'
=>
'product'
,
'stock'
=>
1
,
'posts_per_page'
=>
-
1
,
'product_cat'
=>
$value
->
name
);
$naps_posts
=
new
WP_Query
(
$args
);
$naps_posts
=
new
WP_Query
(
$args
);
$options
=
array
();
$options
=
array
();
$options
[
'size'
]
=
'small'
;
while
(
$naps_posts
->
have_posts
())
:
$naps_posts
->
the_post
();
while
(
$naps_posts
->
have_posts
())
:
$naps_posts
->
the_post
();
$id
=
get_the_ID
();
$id
=
get_the_ID
();
$options
[
'size'
]
=
(
get_field
(
'produit_affichage'
,
$id
))
?
get_field
(
'produit_affichage'
,
$id
)
:
'small'
;
$args
=
array
(
$args
=
array
(
'post_type'
=>
'product_variation'
,
'post_type'
=>
'product_variation'
,
'post_status'
=>
array
(
'private'
,
'publish'
),
'post_status'
=>
array
(
'private'
,
'publish'
),
...
...
wp-content/themes/nap/woocommerce/single-product.php
View file @
8b1c16df
<div
id=
"product"
class=
"clearfix"
>
<?php
while
(
have_posts
())
:
the_post
();
?>
<div
class=
"product-images row animated"
>
<div
class =
"btn-wrapper abs close-panel"
>
<div
class=
"pink-btn circle-btn"
><a
href=
"#"
><span
class =
"abs-center backlink"
>
Retour
</span></a></div>
</div>
<div
class=
"product-slides"
>
<div
class=
"product-header"
>
<h2
class=
"crete -italic font-small"
>
Serviettes Céli-ouate
</h2>
<h3
class=
"crete"
>
Gamme Pastel
</h3>
</div>
<div
class=
"nav-slider transition"
>
<ul>
<li
id =
"mozaique"
><span
class=
"icon mozaique row"
></span><span
class=
"desc"
>
Mozaïque
</span></li>
<li
id =
"zoom"
data-active=
"false"
><span
class=
"icon zoom"
></span><span
class=
"desc"
>
Zoom
</span></li>
<li><span
class=
"icon download"
></span><span
class=
"desc"
>
Télécharger
</span></li>
</ul>
</div>
<div
class=
"slides-wrapper"
>
<div
id=
"slides"
>
<div
class=
"image element-slider easyzoom easyzoom--overlay easyzoom--with-toggle"
data-color =
"#EDA880"
data-slick-index =
"1"
>
<a
href=
"img/slide1_zoom.jpg"
>
<img
src=
"img/pdt1.jpg"
alt=
""
/>
</a>
</div>
<div
class=
"image element-slider easyzoom easyzoom--overlay easyzoom--with-toggle"
data-color =
"#99B87D"
data-slick-index =
"2"
>
<a
href=
"img/slide2_zoom.jpg"
>
<img
src=
"img/slide2.jpg"
alt=
""
title=
""
>
</a>
</div>
<div
class=
"image element-slider easyzoom easyzoom--overlay easyzoom--with-toggle"
data-color =
"#D7C380"
data-slick-index =
"3"
>
<a
href=
"img/slide3_zoom.jpg"
>
<img
src=
"img/slide3.jpg"
alt=
""
/>
</a>
</div>
<div
class=
"image element-slider easyzoom easyzoom--with-toggle"
data-color =
"green"
data-slick-index =
"4"
>
<img
src=
"img/slide1.jpg"
alt=
""
title=
""
>
</div>
<div
class=
"image element-slider easyzoom easyzoom--with-toggle"
data-color =
"yellow"
data-slick-index =
"5"
>
<img
src=
"img/slide2.jpg"
alt=
""
title=
""
>
</div>
</div>
<div
class=
"gallery clearfix"
>
<div
class=
"gallery-content clearfix"
>
<span
class=
"close-btn"
></span>
<article
class =
"row"
data-color =
"red"
>
<a
class =
"download-btn"
href=
"#"
></a>
<figure>
<img
src=
"img/gal1.jpg"
alt=
""
title=
""
>
</figure>
</article>
<article
class =
"row"
data-color =
"#FFF"
>
<a
href=
"#"
></a>
<figure>
<img
src=
"img/gal2.jpg"
alt=
""
title=
""
>
</figure>
</article>
<article
class =
"row"
data-color =
"#D7C380"
>
<a
href=
"#"
></a>
<figure>
<img
src=
"img/gal3.jpg"
alt=
""
title=
""
>
</figure>
</article>
<article
class =
"row"
data-color =
"#99B87D"
>
<a
href=
"#"
></a>
<figure>
<img
src=
"img/gal4.jpg"
alt=
""
title=
""
>
</figure>
</article>
<article
class =
"row"
data-color =
"#EDA880"
>
<a
href=
"#"
></a>
<figure>
<img
src=
"img/gal5.jpg"
alt=
""
title=
""
>
</figure>
</article>
<article
class =
"row"
data-color =
"#FFF"
>
<a
href=
"#"
></a>
<figure>
<img
src=
"img/gal6.jpg"
alt=
""
title=
""
>
</figure>
</article>
<article
class =
"row"
data-color =
"#FFF"
>
<a
href=
"#"
></a>
<figure>
<img
src=
"img/gal7.jpg"
alt=
""
title=
""
>
</figure>
</article>
<article
class =
"row"
data-color =
"#FFF"
>
<a
href=
"#"
></a>
<figure>
<img
src=
"img/gal6.jpg"
alt=
""
title=
""
>
</figure>
</article>
<article
class =
"row"
data-color =
"#FFF"
>
<a
href=
"#"
></a>
<figure>
<img
src=
"img/gal7.jpg"
alt=
""
title=
""
>
</figure>
</article>
</div>
</div>
</div>
</div>
</div>
<?php
while
(
have_posts
()
)
:
the_post
();
?>
<?php
wc_get_template_part
(
'content'
,
'single-product'
);
?>
<?php
wc_get_template_part
(
'content'
,
'single-product'
);
?>
<?php
endwhile
;
// end of the loop. ?>
<?php
endwhile
;
// end of the loop. ?>
<
div
class
="
product
-
details
full
-
height
row
right
clearfix
transition
">
<div class="
list
row
list
-
color
left
border
-
l
">
<div class="
product
-
header
center
font
-
small
">
<span class = "
chevron
bottom
">Choix de la couleur</span>
</div>
<ul>
<li class = "
selected
"><span data-color="
#EDA880"></span></li>
<
li
><
span
data
-
color
=
"#99B87D"
></
span
></
li
>
<
li
><
span
data
-
color
=
"#D8C798"
></
span
></
li
>
<
li
><
span
data
-
color
=
"#D7C380"
></
span
></
li
>
<
li
><
span
data
-
color
=
"#8A8A8A"
></
span
></
li
>
</
ul
>
</
div
>
<
div
class
="
list
row
list
-
format
left
border
-
l
">
<div class="
product
-
header
center
font
-
small
">
<span class = "
chevron
bottom
">Choix du format</span>
</div>
<ul>
<li class ="
disabled
">
<span class= "
format
-
img
" data-width = "
16
" data-height = "
22
" ></span>
<div class="
format
-
desc
">16x22 cm pliage en Z</div>
</li>
<li>
<span class= "
format
-
img
" data-width = "
20
" data-height = "
20
" ></span>
<div class="
format
-
desc
">20x20 cm <br> 2 feuilles</div>
</li>
<li>
<span class= "
format
-
img
" data-width = "
30
" data-height = "
30
" ></span>
<div class="
format
-
desc
">30x30 cm <br> 2 feuilles</div>
</li>
<li>
<span class= "
format
-
img
" data-width = "
30
" data-height = "
39
" ></span>
<div class="
format
-
desc
">30x39 cm <br> 2 feuilles</div>
</li>
<li>
<span class= "
format
-
img
" data-width = "
33
" data-height = "
33
" ></span>
<div class="
format
-
desc
">33x33 cm <br> 2 feuilles</div>
</li>
<li>
<span class= "
format
-
img
" data-width = "
39
" data-height = "
39
" ></span>
<div class="
format
-
desc
">39x39 cm <br> 2 feuilles</div>
</li>
</ul>
</div>
<div class="
product
-
info
row
center
left
border
-
l
">
<div class="
info
-
content
">
<h2 class = "
crete
-
italic
font
-
small
" >Serviettes Céli-ouate</h2>
<h3 class = "
crete
-
italic
font
-
small
" >39x39 abricot</h3>
<div class="
details
font
-
small
">
<p>39 x 39 cm - 2 feuilles</p>
<p>18 paquets de 100</p>
</div>
<div class="
price
">
<span class="
crete
">45 € ht</span>
<div class="
notice
">( prix public conseillé )</div>
<div class="
font
-
small
">785226</div>
</div>
</div>
<div class = "
btn
-
list
">
<div class="
btn
pink
-
btn
rounded
">Nous contacter</div>
<div class="
btn
pink
-
btn
rounded
download
-
btn
">Télécharger la fiche technique</div>
</div>
<div class="
font
-
small
circle
-
btn
add
-
icon
show
-
product
"><span class= "
abs
-
center
">Produits associées</span></div>
</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
=
"img/assoc1.jpg"
alt
=
""
title
=
""
>
</
figure
>
<
h3
class
=
"
font
-
small
" >Distributeur pour <br>serviettes</h3>
</article>
<article class = "
row
full
-
width
">
<a href="
#"></a>
<
figure
>
<
img
src
=
"img/assoc2.jpg"
alt
=
""
title
=
""
>
</
figure
>
<
h3
class
=
"
font
-
small
" >Distributeur pour <br> serviettes pliage décalè</h3>
</article>
<article class = "
row
full
-
width
">
<a href="
#"></a>
<
figure
>
<
img
src
=
"img/assoc1.jpg"
alt
=
""
title
=
""
>
</
figure
>
<
h3
class
=
"
font
-
small
" >Distributeur pour <br>serviettes</h3>
</article>
<article class = "
row
full
-
width
">
<a href="
#"></a>
<
figure
>
<
img
src
=
"img/assoc2.jpg"
alt
=
""
title
=
""
>
</
figure
>
<
h3
class
=
"
font
-
small
" >Distributeur pour <br> serviettes pliage décalè</h3>
</article>
<article class = "
row
full
-
width
">
<a href="
#"></a>
<
figure
>
<
img
src
=
"img/assoc1.jpg"
alt
=
""
title
=
""
>
</
figure
>
<
h3
class
=
"
font
-
small
" >Distributeur pour <br>serviettes</h3>
</article>
<article class = "
row
full
-
width
">
<a href="
#"></a>
<
figure
>
<
img
src
=
"img/assoc2.jpg"
alt
=
""
title
=
""
>
</
figure
>
<
h3
class
=
"
font
-
small
" >Distributeur pour <br> serviettes pliage décalè</h3>
</article>
</div>
</div>
</div>
</div><!--END product -->
wp-content/themes/nap/woocommerce/single-product/add-to-cart/variable.php
View file @
8b1c16df
...
@@ -23,7 +23,220 @@ global $product;
...
@@ -23,7 +23,220 @@ global $product;
$attribute_keys
=
array_keys
(
$attributes
);
$attribute_keys
=
array_keys
(
$attributes
);
do_action
(
'woocommerce_before_add_to_cart_form'
);
?>
$product_cats
=
array_reverse
(
wp_get_post_terms
(
$product
->
get_id
(),
'product_cat'
));
$subcat_iD
=
$product_cats
[
1
]
->
term_id
;
//do_action( 'woocommerce_before_add_to_cart_form' ); ?>
<
div
id
=
"product"
class
="
clearfix
">
<div class="
product
-
images
row
animated
">
<div class = "
btn
-
wrapper
abs
close
-
panel
">
<div class="
pink
-
btn
circle
-
btn
"><a href="
#"><span class = "abs-center backlink">Retour</span></a></div>
</
div
>
<
div
class
="
product
-
slides
">
<div class="
product
-
header
">
<h2 class="
crete
-
italic
font
-
small
">Serviettes Céli-ouate</h2>
<h3 class="
crete
">Gamme <?php the_title();?></h3>
</div>
<div class="
nav
-
slider
transition
">
<ul>
<li id = "
mozaique
"><span class="
icon
mozaique
row
"></span><span class="
desc
">Mozaïque</span></li>
<li id = "
zoom
" data-active="
false
" ><span class="
icon
zoom
"></span><span class="
desc
">Zoom</span></li>
<li><span class="
icon
download
"></span><span class="
desc
">Télécharger</span></li>
</ul>
</div>
<div class="
slides
-
wrapper
">
<div id="
slides
">
<?php
$variations
=
$product->get_available_variations
();
$var_colors
= nap_distinct_color_variations(
$variations
);
foreach (
$var_colors
as
$key
=>
$value
) : ?>
<div class="
image
element
-
slider
easyzoom
easyzoom
--
overlay
easyzoom
--
with
-
toggle
" data-color = "
<?
php
echo
$value
?>
" data-slick-index = "1">
<a
href=
"
<?php
echo
get_the_post_thumbnail_url
(
$key
,
'full'
)
?>
"
>
<img
src=
"
<?php
echo
get_the_post_thumbnail_url
(
$key
,
'medium'
)
?>
"
alt=
""
/>
</a>
</div>
<?php
endforeach
;
?>
<?php
if
(
get_field
(
'images_ambiance'
,
'product_cat_'
.
$subcat_iD
)
)
:
$ambiance
=
array
();
while
(
has_sub_field
(
'images_ambiance'
,
'product_cat_'
.
$subcat_iD
)
)
:
$image_amb
=
get_sub_field
(
'img_ab'
);
$ambiance
[]
=
$image_amb
;
$attachment
=
wp_get_attachment_image_src
(
$image_amb
,
'medium'
);
$hd
=
wp_get_attachment_image_src
(
$image_amb
,
'full'
);
?>
<div
class=
"image element-slider easyzoom easyzoom--overlay easyzoom--with-toggle"
data-color =
"
<?php
echo
$color
?>
"
data-slick-index =
"1"
>
<a
href=
"
<?php
echo
$hd
[
0
];
?>
"
>
<img
src=
"
<?php
echo
$attachment
[
0
]
;
?>
"
alt=
""
/>
</a>
</div>
<?php
endwhile
;
endif
;
?>
</div>
<div
class=
"gallery clearfix"
>
<div
class=
"gallery-content clearfix"
>
<span
class=
"close-btn"
></span>
<?php
foreach
(
$var_colors
as
$key
=>
$value
)
:
?>
<article
class =
"row"
data-color =
"
<?php
echo
$value
;
?>
"
>
<a
href=
"
<?php
echo
get_the_post_thumbnail_url
(
$key
,
'full'
)
?>
"
></a>
<figure>
<img
src=
"
<?php
echo
get_the_post_thumbnail_url
(
$key
,
'medium'
)
?>
"
alt=
""
title=
""
>
</figure>
</article>
<?php
endforeach
;
foreach
(
$ambiance
as
$key
=>
$value
)
:
$attachment
=
wp_get_attachment_image_src
(
$value
,
'medium'
);
$hd
=
wp_get_attachment_image_src
(
$value
,
'full'
);
?>
<article
class =
"row"
data-color =
"red"
>
<a
class =
"download-btn"
href=
"
<?php
echo
$hd
[
0
];
?>
"
download
></a>
<figure>
<img
src=
"
<?php
echo
$attachment
[
0
]
;
?>
"
alt=
""
title=
""
>
</figure>
</article>
<?php
endforeach
;
?>
</div>
</div>
</div>
</div>
</div>
<div
class=
"product-details full-height row right clearfix transition"
>
<div
class=
"list row list-color left border-l"
>
<div
class=
"product-header center font-small"
>
<span
class =
"chevron bottom"
>
Choix de la couleur
</span>
</div>
<ul>
<?php
foreach
(
$var_colors
as
$key
=>
$value
)
:
?>
<li
class =
""
><span
data-color=
"
<?php
echo
$value
;
?>
"
></span></li>
<?php
endforeach
;
?>
</ul>
</div>
<div
class=
"list row list-format left border-l"
>
<div
class=
"product-header center font-small"
>
<span
class =
"chevron bottom"
>
Choix du format
</span>
</div>
<ul>
<li
class =
"disabled"
>
<span
class=
"format-img"
data-width =
"16"
data-height =
"22"
></span>
<div
class=
"format-desc"
>
16x22 cm pliage en Z
</div>
</li>
<li>
<span
class=
"format-img"
data-width =
"20"
data-height =
"20"
></span>
<div
class=
"format-desc"
>
20x20 cm
<br>
2 feuilles
</div>
</li>
<li>
<span
class=
"format-img"
data-width =
"30"
data-height =
"30"
></span>
<div
class=
"format-desc"
>
30x30 cm
<br>
2 feuilles
</div>
</li>
<li>
<span
class=
"format-img"
data-width =
"30"
data-height =
"39"
></span>
<div
class=
"format-desc"
>
30x39 cm
<br>
2 feuilles
</div>
</li>
<li>
<span
class=
"format-img"
data-width =
"33"
data-height =
"33"
></span>
<div
class=
"format-desc"
>
33x33 cm
<br>
2 feuilles
</div>
</li>
<li>
<span
class=
"format-img"
data-width =
"39"
data-height =
"39"
></span>
<div
class=
"format-desc"
>
39x39 cm
<br>
2 feuilles
</div>
</li>
</ul>
</div>
<div
class=
"product-info row center left border-l"
>
<div
class=
"info-content"
>
<h2
class =
"crete -italic font-small"
>
<?php
echo
$product_cats
[
1
]
->
name
?>
</h2>
<h3
class =
"crete -italic font-small"
>
39x39 abricot
</h3>
<div
class=
"details font-small"
>
<p>
39 x 39 cm - 2 feuilles
</p>
<p>
18 paquets de 100
</p>
</div>
<div
class=
"price"
>
<span
class=
"crete"
>
45 € ht
</span>
<div
class=
"notice"
>
( prix public conseillé )
</div>
<div
class=
"font-small"
>
785226
</div>
</div>
</div>
<div
class =
"btn-list"
>
<div
class=
"btn pink-btn rounded"
>
Nous contacter
</div>
<div
class=
"btn pink-btn rounded download-btn"
>
Télécharger la fiche technique
</div>
</div>
<div
class=
"font-small circle-btn add-icon show-product"
><span
class=
"abs-center"
>
Produits associées
</span></div>
</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=
"img/assoc1.jpg"
alt=
""
title=
""
>
</figure>
<h3
class =
"font-small"
>
Distributeur pour
<br>
serviettes
</h3>
</article>
<article
class =
"row full-width"
>
<a
href=
"#"
></a>
<figure>
<img
src=
"img/assoc2.jpg"
alt=
""
title=
""
>
</figure>
<h3
class =
"font-small"
>
Distributeur pour
<br>
serviettes pliage décalè
</h3>
</article>
<article
class =
"row full-width"
>
<a
href=
"#"
></a>
<figure>
<img
src=
"img/assoc1.jpg"
alt=
""
title=
""
>
</figure>
<h3
class =
"font-small"
>
Distributeur pour
<br>
serviettes
</h3>
</article>
<article
class =
"row full-width"
>
<a
href=
"#"
></a>
<figure>
<img
src=
"img/assoc2.jpg"
alt=
""
title=
""
>
</figure>
<h3
class =
"font-small"
>
Distributeur pour
<br>
serviettes pliage décalè
</h3>
</article>
<article
class =
"row full-width"
>
<a
href=
"#"
></a>
<figure>
<img
src=
"img/assoc1.jpg"
alt=
""
title=
""
>
</figure>
<h3
class =
"font-small"
>
Distributeur pour
<br>
serviettes
</h3>
</article>
<article
class =
"row full-width"
>
<a
href=
"#"
></a>
<figure>
<img
src=
"img/assoc2.jpg"
alt=
""
title=
""
>
</figure>
<h3
class =
"font-small"
>
Distributeur pour
<br>
serviettes pliage décalè
</h3>
</article>
</div>
</div>
</div>
</div>
<form
class=
"variations_form cart"
method=
"post"
enctype=
'multipart/form-data'
data-product_id=
"
<?php
echo
absint
(
$product
->
get_id
()
);
?>
"
data-product_variations=
"
<?php
echo
htmlspecialchars
(
wp_json_encode
(
$available_variations
)
)
?>
"
>
<form
class=
"variations_form cart"
method=
"post"
enctype=
'multipart/form-data'
data-product_id=
"
<?php
echo
absint
(
$product
->
get_id
()
);
?>
"
data-product_variations=
"
<?php
echo
htmlspecialchars
(
wp_json_encode
(
$available_variations
)
)
?>
"
>
<?php
do_action
(
'woocommerce_before_variations_form'
);
?>
<?php
do_action
(
'woocommerce_before_variations_form'
);
?>
...
@@ -69,18 +282,23 @@ do_action( 'woocommerce_before_add_to_cart_form' ); ?>
...
@@ -69,18 +282,23 @@ do_action( 'woocommerce_before_add_to_cart_form' ); ?>
/**
/**
* woocommerce_after_single_variation Hook.
* woocommerce_after_single_variation Hook.
*/
*/
do_action
(
'woocommerce_after_single_variation'
);
//
do_action( 'woocommerce_after_single_variation' );
?>
?>
</div>
</div>
<?php
do_action
(
'woocommerce_after_add_to_cart_button'
);
?>
<?php
//
do_action( 'woocommerce_after_add_to_cart_button' ); ?>
<?
php
endif
;
?>
<?
php
endif
;
?>
<?php
do_action
(
'woocommerce_after_variations_form'
);
?>
<?php
//
do_action( 'woocommerce_after_variations_form' ); ?>
</
form
>
</
form
>
<
a
href
=
"<?php echo get_permalink(43);?>"
class
="
hidden
download_file_link
"></a>
<
a
href
=
"<?php echo get_permalink(43);?>"
class
="
hidden
download_file_link
"></a>
<a href="
#" class="download_file">Télécharger la fiche technique </a>
<a href="
#" class="download_file">Télécharger la fiche technique </a>
<?
php
<?
php
do_action
(
'woocommerce_after_add_to_cart_form'
);
//do_action( 'woocommerce_after_add_to_cart_form' );
?>
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