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
Hide 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
@
ini_set
(
'upload_max_size'
,
'64M'
);
@
ini_set
(
'post_max_size'
,
'64M'
);
@
ini_set
(
'max_execution_time'
,
'300'
);
@
ini_set
(
'upload_max_size'
,
'64M'
);
@
ini_set
(
'post_max_size'
,
'64M'
);
@
ini_set
(
'max_execution_time'
,
'300'
);
//Get Zones
function
get_zones
(
$post_ID
=
157
){
function
get_zones
(
$post_ID
=
157
)
{
if
(
get_field
(
'zones_commerciaux'
,
$post_ID
))
:
$i
=
0
;
while
(
has_sub_field
(
'zones_commerciaux'
,
$post_ID
))
:
if
(
get_sub_field
(
'list_zones'
,
$post_ID
))
:
$list_zone
=
array
();
while
(
has_sub_field
(
'list_zones'
,
$post_ID
))
:
$list_zone
[]
=
get_sub_field
(
'num_zone'
);
$list_zone
[]
=
get_sub_field
(
'num_zone'
);
endwhile
;
endif
;
$allZones
[
'zone'
.
$i
]
=
$list_zone
;
endif
;
$allZones
[
'zone'
.
$i
]
=
$list_zone
;
$i
++
;
endwhile
;
endwhile
;
endif
;
return
json_encode
(
$allZones
);
}
//Dequeue CSS
function
nap_dequeue_unnecessary_css
()
{
wp_dequeue_style
(
'additional-parent-style'
);
...
...
@@ -42,12 +44,12 @@ function nap_dequeue_unnecessary_scripts() {
wp_deregister_script
(
'twentyseventeen-navigation'
);
//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
));
wp_localize_script
(
'getZones'
,
'zonesL'
,
$listZones
);
wp_localize_script
(
'getZones'
,
'zonesL'
,
$listZones
);
// wp_localize_script( 'listZones', 'object_name', $listZones );
wp_enqueue_script
(
'getZones'
);
wp_enqueue_script
(
'getZones'
);
//END MS : 2017-07-17
}
...
...
@@ -116,20 +118,20 @@ function nap_create_post_type() {
'labels'
=>
array
(
'name'
=>
__
(
'Fiches Techniques'
),
'singular_name'
=>
__
(
'Fiche Technique'
)
),
),
'public'
=>
true
)
)
);
}
function
nap_post_type_listing
(
$post_type
)
{
$select
=
array
();
$posts
=
get_posts
(
array
(
'post_type'
=>
$post_type
,
'numberposts'
=>
-
1
array
(
'post_type'
=>
$post_type
,
'numberposts'
=>
-
1
)
);
);
if
(
!
$posts
)
return
;
...
...
@@ -148,59 +150,59 @@ function nap_variation_settings_fields($loop, $variation_data, $variation) {
// code variation
woocommerce_wp_text_input
(
array
(
'id'
=>
'var_code_'
.
$variation
->
ID
,
'label'
=>
__
(
'Code article'
,
'woocommerce'
),
array
(
'id'
=>
'var_code_'
.
$variation
->
ID
,
'label'
=>
__
(
'Code article'
,
'woocommerce'
),
/* 'desc_tip' => 'true',
'description' => __( 'Ajouter le code article.', 'woocommerce' ), */
'description' => __( 'Ajouter le code article.', 'woocommerce' ), */
'value'
=>
get_post_meta
(
$variation
->
ID
,
'_var_code'
,
true
),
'custom_attributes'
=>
array
(
'step'
=>
'any'
,
'min'
=>
'0'
)
)
);
)
);
// Gencode
woocommerce_wp_text_input
(
array
(
'id'
=>
'var_gencod_'
.
$variation
->
ID
,
'label'
=>
__
(
'Gencod(EAN13)'
,
'woocommerce'
),
array
(
'id'
=>
'var_gencod_'
.
$variation
->
ID
,
'label'
=>
__
(
'Gencod(EAN13)'
,
'woocommerce'
),
/* 'desc_tip' => 'true',
'description' => __( 'Ajouter le Gencod', 'woocommerce' ), */
'description' => __( 'Ajouter le Gencod', 'woocommerce' ), */
'value'
=>
get_post_meta
(
$variation
->
ID
,
'_var_gencod'
,
true
),
'custom_attributes'
=>
array
(
'step'
=>
'any'
,
'min'
=>
'0'
)
)
);
)
);
// ITF 14
woocommerce_wp_text_input
(
array
(
'id'
=>
'var_itf14_'
.
$variation
->
ID
,
'label'
=>
__
(
'ITF 14'
,
'woocommerce'
),
array
(
'id'
=>
'var_itf14_'
.
$variation
->
ID
,
'label'
=>
__
(
'ITF 14'
,
'woocommerce'
),
/* 'desc_tip' => 'true',
'description' => __( 'Ajouter le Gencod', 'woocommerce' ), */
'description' => __( 'Ajouter le Gencod', 'woocommerce' ), */
'value'
=>
get_post_meta
(
$variation
->
ID
,
'_var_itf14'
,
true
),
'custom_attributes'
=>
array
(
'step'
=>
'any'
,
'min'
=>
'0'
)
)
);
)
);
// Select fiches techniques
$option
=
nap_post_type_listing
(
'fiche_technique'
);
woocommerce_wp_select
(
array
(
'id'
=>
'var_fiche_'
.
$variation
->
ID
,
'label'
=>
__
(
'Fiche technique '
,
'woocommerce'
),
'value'
=>
get_post_meta
(
$variation
->
ID
,
'_var_fiche'
,
true
),
'options'
=>
$option
array
(
'id'
=>
'var_fiche_'
.
$variation
->
ID
,
'label'
=>
__
(
'Fiche technique '
,
'woocommerce'
),
'value'
=>
get_post_meta
(
$variation
->
ID
,
'_var_fiche'
,
true
),
'options'
=>
$option
)
);
);
}
// Save Variation Settings
...
...
@@ -245,7 +247,7 @@ function nap_load_variation_settings_fields($variations_id) {
function
nap_category_image
(
$catID
)
{
$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
];
}
...
...
@@ -255,37 +257,7 @@ function nap_attachment_image($pageID) {
return
$url
;
}
/* add_action( 'woocommerce_after_shop_loop_item', 'nap_variations_loop' );
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
()
{
function
nap_menu
()
{
$menu
=
""
;
$taxonomy
=
'product_cat'
;
...
...
@@ -304,12 +276,12 @@ function nap_attachment_image($pageID) {
'hierarchical'
=>
$hierarchical
,
'title_li'
=>
$title
,
'hide_empty'
=>
$empty
);
);
$all_categories
=
get_categories
(
$args
);
foreach
(
$all_categories
as
$cat
)
{
if
(
$cat
->
category_parent
==
0
)
{
$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
(
'taxonomy'
=>
$taxonomy
,
...
...
@@ -321,18 +293,18 @@ function nap_attachment_image($pageID) {
'hierarchical'
=>
$hierarchical
,
'title_li'
=>
$title
,
'hide_empty'
=>
1
);
);
$sub_cats
=
get_categories
(
$args2
);
$menu
.=
' <ul class = "subcat" data-page = "'
.
$category_id
.
'">'
;
$menu
.=
' <ul class = "subcat" data-page = "'
.
$category_id
.
'">'
;
if
(
$sub_cats
)
{
$class
=
''
;
foreach
(
$sub_cats
as
$key
=>
$sub_category
)
{
$subcat_name
=
explode
(
' '
,
$sub_category
->
name
);
$subcat_name
=
explode
(
' '
,
$sub_category
->
name
);
if
(
$key
==
0
)
$calss
=
'active'
;
else
$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) {
$couleur
=
$variable_product
->
get_attribute
(
'couleur'
);
$format
=
$variable_product
->
get_attribute
(
'format'
);
$url
=
'?attribute_couleur='
.
trim
(
$couleur
)
.
'&attribute_format='
.
trim
(
$format
);
return
preg_replace
(
'/\s+/'
,
''
,
$url
);
$url
=
'?attribute_couleur='
.
$couleur
.
'&attribute_format='
.
$format
.
'&variation_id='
.
$variationID
;
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
)
{
...
...
@@ -378,19 +372,16 @@ function nap_get_item($post_ID, $args = null, $current_page = '', $options = nul
$nap_article
.=
'<img class="transition" src="'
.
$image
.
'" alt="" title="">'
;
if
(
$current_page
==
'catalogue'
)
:
$nap_article
.=
'<ul class = "clearfix">'
;
$variations
=
get_posts
(
$args
);
$temp_colors
=
array
();
foreach
(
$variations
as
$key
=>
$value
)
{
$variable_product
=
wc_get_product
(
$value
->
ID
);
$term
=
get_term_by
(
'name'
,
$variable_product
->
get_attribute
(
'couleur'
),
'pa_couleur'
);
$termID
=
$term
->
term_id
;
$color
=
get_field
(
'couleurs'
,
'pa_couleur_'
.
$termID
);
if
(
!
in_array
(
$color
,
$temp_colors
)){
$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
,
'small'
)
.
'" data-color = "'
.
$color
.
'"></li> '
;
$variations
=
get_posts
(
$args
);
$temp_colors
=
array
();
foreach
(
$variations
as
$key
=>
$value
)
{
$color
=
nap_variation_color
(
$value
->
ID
);
if
(
!
in_array
(
$color
,
$temp_colors
))
{
$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
,
'thumbnail'
)
.
'" data-color = "'
.
$color
.
'"></li> '
;
}
}
}
$nap_article
.=
'</ul>'
;
$nap_article
.=
'</ul>'
;
endif
;
$nap_article
.=
'</figure>
<h3 class = "font-small" >'
.
get_the_title
(
$post_ID
)
.
'</h3>
...
...
@@ -398,3 +389,5 @@ function nap_get_item($post_ID, $args = null, $current_page = '', $options = nul
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' =
$args
=
array
(
'post_type'
=>
'product'
,
'stock'
=>
1
,
'posts_per_page'
=>
-
1
,
'product_cat'
=>
$value
->
name
);
$naps_posts
=
new
WP_Query
(
$args
);
$options
=
array
();
$options
[
'size'
]
=
'small'
;
while
(
$naps_posts
->
have_posts
())
:
$naps_posts
->
the_post
();
$id
=
get_the_ID
();
$options
[
'size'
]
=
(
get_field
(
'produit_affichage'
,
$id
))
?
get_field
(
'produit_affichage'
,
$id
)
:
'small'
;
$args
=
array
(
'post_type'
=>
'product_variation'
,
'post_status'
=>
array
(
'private'
,
'publish'
),
...
...
wp-content/themes/nap/woocommerce/single-product.php
View file @
8b1c16df
<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 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
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. ?>
<
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 -->
<?php
endwhile
;
// end of the loop. ?>
wp-content/themes/nap/woocommerce/single-product/add-to-cart/variable.php
View file @
8b1c16df
...
...
@@ -23,7 +23,220 @@ global $product;
$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
)
)
?>
"
>
<?php
do_action
(
'woocommerce_before_variations_form'
);
?>
...
...
@@ -69,18 +282,23 @@ do_action( 'woocommerce_before_add_to_cart_form' ); ?>
/**
* woocommerce_after_single_variation Hook.
*/
do_action
(
'woocommerce_after_single_variation'
);
//
do_action( 'woocommerce_after_single_variation' );
?>
</div>
<?php
do_action
(
'woocommerce_after_add_to_cart_button'
);
?>
<?php
//
do_action( 'woocommerce_after_add_to_cart_button' ); ?>
<?
php
endif
;
?>
<?php
do_action
(
'woocommerce_after_variations_form'
);
?>
<?php
//
do_action( 'woocommerce_after_variations_form' ); ?>
</
form
>
<
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>
<?
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