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
e3cd3f6d
Commit
e3cd3f6d
authored
Aug 29, 2017
by
Nahla Shiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
format par defaut
parent
e9f0f08a
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
11 deletions
+61
-11
default_active.svg
wp-content/themes/nap/assets/css/img/default_active.svg
+24
-0
default_inactive.svg
wp-content/themes/nap/assets/css/img/default_inactive.svg
+12
-0
functions.php
wp-content/themes/nap/functions.php
+10
-4
variable.php
...s/nap/woocommerce/single-product/add-to-cart/variable.php
+15
-7
No files found.
wp-content/themes/nap/assets/css/img/default_active.svg
0 → 100644
View file @
e3cd3f6d
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg
version=
"1.1"
id=
"Calque_1"
xmlns=
"http://www.w3.org/2000/svg"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
x=
"0px"
y=
"0px"
width=
"115px"
height=
"117px"
viewBox=
"369.445 239.14 115 117"
enable-background=
"new 369.445 239.14 115 117"
xml:space=
"preserve"
>
<title>
nappeset_128_droits
</title>
<g
id=
"actif"
>
<g
opacity=
"0.2"
>
<ellipse
fill=
"#313D7A"
stroke=
"#000000"
stroke-width=
"2"
stroke-miterlimit=
"10"
cx=
"428.742"
cy=
"298.04"
rx=
"50"
ry=
"50.55"
/>
</g>
</g>
<g
id=
"tick"
>
<polyline
fill=
"none"
stroke=
"#313D7A"
stroke-width=
"3"
stroke-linecap=
"round"
stroke-linejoin=
"round"
points=
"399.741,294.501
419.621,315.726 453.742,284.853 "
/>
</g>
<g
id=
"Calque_1_1_"
>
<path
fill=
"#313D7A"
stroke=
"#313D7A"
stroke-width=
"2"
stroke-miterlimit=
"10"
d=
"M426.41,347.639
c-27.65,0.269-50.2-21.879-50.468-49.529s21.879-50.2,49.529-50.469c27.65-0.269,50.2,21.879,50.469,49.529
c0,0.134,0,0.268,0,0.403C476.074,325.09,453.927,347.505,426.41,347.639z M426.41,248.984
c-26.845-0.269-48.857,21.342-49.126,48.187c-0.269,26.845,21.342,48.858,48.187,49.126c26.846,0.269,48.858-21.342,49.127-48.187
c0-0.134,0-0.269,0-0.537C474.731,270.863,453.121,249.118,426.41,248.984z"
/>
</g>
</svg>
wp-content/themes/nap/assets/css/img/default_inactive.svg
0 → 100644
View file @
e3cd3f6d
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg
version=
"1.1"
id=
"Calque_1"
xmlns=
"http://www.w3.org/2000/svg"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
x=
"0px"
y=
"0px"
width=
"115px"
height=
"116px"
viewBox=
"0 0 115 116"
enable-background=
"new 0 0 115 116"
xml:space=
"preserve"
>
<title>
nappeset_128_droits
</title>
<path
fill=
"#313D7A"
stroke=
"#313D7A"
stroke-width=
"2"
stroke-miterlimit=
"10"
d=
"M57.971,107.998
c-27.65,0.268-50.2-21.879-50.469-49.529C7.233,30.819,29.381,8.27,57.031,8.002c27.65-0.27,50.201,21.877,50.469,49.528
c0,0.134,0,0.269,0,0.403C107.633,85.449,85.488,107.865,57.971,107.998z M57.971,9.344C31.125,9.074,9.113,30.686,8.845,57.53
s21.342,48.856,48.187,49.126c26.844,0.27,48.857-21.342,49.125-48.188c0-0.133,0-0.269,0-0.537
C106.291,31.223,84.682,9.478,57.971,9.344z"
/>
</svg>
wp-content/themes/nap/functions.php
View file @
e3cd3f6d
...
@@ -343,7 +343,8 @@ function nap_variation_url($variationID) {
...
@@ -343,7 +343,8 @@ function nap_variation_url($variationID) {
$couleur
=
$variable_product
->
get_attribute
(
'couleur'
);
$couleur
=
$variable_product
->
get_attribute
(
'couleur'
);
$color_url
=
get_term_by
(
'slug'
,
$couleur
,
'pa_couleur'
);
$color_url
=
get_term_by
(
'slug'
,
$couleur
,
'pa_couleur'
);
$format
=
$variable_product
->
get_attribute
(
'format'
);
//$format = $variable_product->get_attribute('format');
$format
=
get_post_meta
(
$variationID
,
'attribute_pa_format'
,
true
);
$format_url
=
get_term_by
(
'slug'
,
$format
,
'pa_format'
);
$format_url
=
get_term_by
(
'slug'
,
$format
,
'pa_format'
);
$url
=
'?attribute_couleur='
.
$color_url
->
slug
.
'&attribute_format='
.
$format_url
->
slug
.
'&variation_id='
.
$variationID
;
$url
=
'?attribute_couleur='
.
$color_url
->
slug
.
'&attribute_format='
.
$format_url
->
slug
.
'&variation_id='
.
$variationID
;
return
preg_replace
(
'/\s+/'
,
''
,
$url
);
return
preg_replace
(
'/\s+/'
,
''
,
$url
);
...
@@ -396,8 +397,12 @@ function nap_distinct_color_variations($variations) {
...
@@ -396,8 +397,12 @@ function nap_distinct_color_variations($variations) {
}
}
function
nap_variation_format
(
$variationID
)
{
function
nap_variation_format
(
$variationID
)
{
$variable_product
=
wc_get_product
(
$variationID
);
/*$variable_product = wc_get_product($variationID);
return
$variable_product
->
get_attribute
(
'format'
);
$name= $variable_product->get_attribute('format');*/
$meta
=
get_post_meta
(
$variationID
,
'attribute_pa_format'
,
true
);
$term
=
get_term_by
(
'slug'
,
$meta
,
'pa_format'
);
return
$slug
=
$term
->
slug
;
}
}
function
nap_distinct_format_variations
(
$variations
)
{
function
nap_distinct_format_variations
(
$variations
)
{
...
@@ -498,6 +503,7 @@ function nap_get_item($post_ID, $args = null, $current_page = '', $options = nul
...
@@ -498,6 +503,7 @@ function nap_get_item($post_ID, $args = null, $current_page = '', $options = nul
foreach
(
$variations
as
$key
=>
$value
)
{
foreach
(
$variations
as
$key
=>
$value
)
{
$color
=
nap_variation_color
(
$value
->
ID
);
$color
=
nap_variation_color
(
$value
->
ID
);
$format
=
nap_variation_format
(
$value
->
ID
);
$format
=
nap_variation_format
(
$value
->
ID
);
if
(
!
in_array
(
$color
,
$temp_colors
))
{
if
(
!
in_array
(
$color
,
$temp_colors
))
{
$temp_colors
[]
=
$color
;
$temp_colors
[]
=
$color
;
...
...
wp-content/themes/nap/woocommerce/single-product/add-to-cart/variable.php
View file @
e3cd3f6d
...
@@ -52,6 +52,7 @@ if (!function_exists('print_attribute_radio')) {
...
@@ -52,6 +52,7 @@ if (!function_exists('print_attribute_radio')) {
if
(
$name
==
'pa_couleur'
)
{
if
(
$name
==
'pa_couleur'
)
{
$hexa
=
nap_color_attribute
(
$value
);
$hexa
=
nap_color_attribute
(
$value
);
$filtered_label
=
apply_filters
(
'woocommerce_variation_option_name'
,
$label
);
$filtered_label
=
apply_filters
(
'woocommerce_variation_option_name'
,
$label
);
printf
(
' <style>
printf
(
' <style>
#'
.
$id
.
':after { background-color: '
.
$hexa
.
'; }
#'
.
$id
.
':after { background-color: '
.
$hexa
.
'; }
</style><li class="color-list '
.
$selected
.
' " data-color="'
.
$hexa
.
'">
</style><li class="color-list '
.
$selected
.
' " data-color="'
.
$hexa
.
'">
...
@@ -59,11 +60,15 @@ if (!function_exists('print_attribute_radio')) {
...
@@ -59,11 +60,15 @@ if (!function_exists('print_attribute_radio')) {
}
else
{
}
else
{
$icons
=
nap_icon_format
(
$value
);
$icons
=
nap_icon_format
(
$value
);
$format_img
=
'<img src="'
.
$icons
[
'inactive'
]
.
'" data-img = "'
.
$icons
[
'inactive'
]
.
'" data-img-active = "'
.
$icons
[
'active'
]
.
'" id="format_'
.
$index
.
'" style ="height:'
.
$icons
[
'height'
]
.
'px;width:'
.
$icons
[
'width'
]
.
'px" >'
;
if
(
$icons
[
'inactive'
]
||
$icons
[
'active'
])
$format_img
=
'<img src="'
.
$icons
[
'inactive'
]
.
'" data-img = "'
.
$icons
[
'inactive'
]
.
'" data-img-active = "'
.
$icons
[
'active'
]
.
'" id="'
.
$value
.
'" style ="height:'
.
$icons
[
'height'
]
.
'px;width:'
.
$icons
[
'width'
]
.
'px" >'
;
else
{
$default_active
=
home_url
(
'wp-content/themes/nap/assets/css/img/default_active.svg'
);
$default_inactive
=
home_url
(
'wp-content/themes/nap/assets/css/img/default_inactive.svg'
);
$format_img
=
'<img src="'
.
$default_inactive
.
'" data-img = "'
.
$default_inactive
.
'" data-img-active = "'
.
$default_active
.
'" id="'
.
$value
.
'" style ="height:35px;width:35px" >'
;
}
$filtered_label
=
apply_filters
(
'woocommerce_variation_option_name'
,
$label
);
$filtered_label
=
apply_filters
(
'woocommerce_variation_option_name'
,
$label
);
printf
(
'<li class="format-list
selected"><input type="radio" name="%1$s" value="%2$s" id="%3$s" %4$s checked
>
printf
(
'<li class="format-list
"><input type="radio" name="%1$s" value="%2$s" id="%3$s" %4$s
>
<label class="format-label" for="%3$s">'
.
$format_img
.
'</label>
<label class="format-label" for="%3$s">'
.
$format_img
.
'</label>
<div class="format-desc">'
.
$label
.
'</span>
<div class="format-desc">'
.
$label
.
'</span>
...
@@ -261,7 +266,10 @@ do_action('woocommerce_before_add_to_cart_form');
...
@@ -261,7 +266,10 @@ do_action('woocommerce_before_add_to_cart_form');
</form>
</form>
<div
class=
"product-info row center left border-l"
>
<div
class=
"product-info row center left border-l"
>
<div
class=
"info-content"
>
<div
class=
"info-content"
>
<?php
$format
=
str_replace
(
'-'
,
' '
,
$_GET
[
'attribute_format'
]);
?>
<?php
$format
=
get_post_meta
(
$current_variationID
,
'attribute_pa_format'
,
true
);
$format_info
=
get_term_by
(
'slug'
,
$format
,
'pa_format'
);
$format
=
$format_info
->
name
;
?>
<h2
class =
"crete font-small"
>
<?php
echo
$sub_cat
[
0
]
->
name
;
?>
</h2>
<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
$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"
>
<div
class=
"details font-small"
>
...
...
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