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
02692434
Commit
02692434
authored
Aug 04, 2017
by
imac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update]Redmine - #644 : Add URL to product page
parent
349939a3
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
35 deletions
+34
-35
footer-shop.php
wp-content/themes/nap/footer-shop.php
+8
-1
functions.php
wp-content/themes/nap/functions.php
+3
-27
header-shop.php
wp-content/themes/nap/header-shop.php
+8
-1
simple.php
...mes/nap/woocommerce/single-product/add-to-cart/simple.php
+8
-3
variable.php
...s/nap/woocommerce/single-product/add-to-cart/variable.php
+7
-3
No files found.
wp-content/themes/nap/footer-shop.php
View file @
02692434
<?php
wp_footer
();
?>
<?php
$ext_ref
=
externe_referrer
();
if
(
$ext_ref
)
{
get_footer
();
}
else
{
wp_footer
();
}
?>
wp-content/themes/nap/functions.php
View file @
02692434
...
...
@@ -599,39 +599,15 @@ function nap_save_general_proddata_custom_field( $post_id ) {
}
//MS 2017-08-02 : Get referrer
function
externe_referrer
(
)
{
function
externe_referrer
(
)
{
$url
=
$_SERVER
[
'HTTP_REFERER'
];
$postid
=
url_to_postid
(
$url
);
$ref
=
false
;
$uri
=
$_SERVER
[
'HTTP_HOST'
]
.
$_SERVER
[
'REQUEST_URI'
];
$pageWasRefreshed
=
isset
(
$_SERVER
[
'HTTP_CACHE_CONTROL'
])
&&
$_SERVER
[
'HTTP_CACHE_CONTROL'
]
===
'max-age=0'
;
if
(
$pageWasRefreshed
)
{
$postid
=
-
1
;
}
else
{
$postid
=
0
;
}
if
(
$postid
<
0
){
if
(
$pageWasRefreshed
||
empty
(
$url
)
)
{
$ref
=
true
;
}
echo
$postid
;
if
(
$pageWasRefreshed
)
{
$postid
=
-
1
;
}
global
$post
;
$terms
=
get_the_terms
(
$post
->
ID
,
'product_cat'
);
foreach
(
$terms
as
$term
)
{
$product_cat_id
=
$term
->
term_id
;
echo
'prod_eeeeee === '
.
$product_cat_id
;
break
;
return
$ref
;
}
}
wp-content/themes/nap/header-shop.php
View file @
02692434
<?php
wp_head
();
//get_header( 'shop' );?>
<?php
$ext_ref
=
externe_referrer
();
if
(
$ext_ref
)
{
get_header
();
}
else
{
wp_head
();
}
?>
wp-content/themes/nap/woocommerce/single-product/add-to-cart/simple.php
View file @
02692434
...
...
@@ -24,15 +24,20 @@ global $product;
$id
=
get_the_ID
();
$parent_cat
=
wp_get_post_terms
(
$product
->
get_id
(),
'product_cat'
,
array
(
'parent'
=>
0
,
'fields'
=>
'ids'
));
$sub_cat
=
wp_get_post_terms
(
$product
->
get_id
(),
'product_cat'
,
array
(
'parent'
=>
$parent_cat
[
0
],
'fields'
=>
'names'
));
//Get Bach URL
$ext_ref
=
externe_referrer
();
if
(
$ext_ref
)
{
$category_link
=
get_category_link
(
$parent_cat
[
0
]);
}
else
{
$category_link
=
"#"
;
}
do_action
(
'woocommerce_before_add_to_cart_form'
);
?>
<div
id=
"product"
class=
"clearfix"
>
<div
class=
"product-images row animated"
>
<div
class =
"btn-wrapper row close-panel"
>
<div
class=
"pink-btn circle-btn"
><a
href=
"
#
"
><span
class =
"abs-center backlink"
>
Retour
</span></a></div>
<div
class=
"pink-btn circle-btn"
><a
href=
"
<?php
echo
$category_link
?>
"
><span
class =
"abs-center backlink"
>
Retour
</span></a></div>
</div>
<div
class=
"product-slides row"
>
<div
class=
"product-header"
>
...
...
wp-content/themes/nap/woocommerce/single-product/add-to-cart/variable.php
View file @
02692434
...
...
@@ -26,9 +26,13 @@ $attribute_keys = array_keys($attributes);
$parent_cat
=
wp_get_post_terms
(
$product
->
get_id
(),
'product_cat'
,
array
(
'parent'
=>
0
,
'fields'
=>
'ids'
));
$sub_cat
=
wp_get_post_terms
(
$product
->
get_id
(),
'product_cat'
,
array
(
'parent'
=>
$parent_cat
[
0
],
'fields'
=>
'names'
));
$current_variationID
=
$_GET
[
'variation_id'
];
$ext_ref
=
externe_referrer
();
if
(
$ext_ref
)
{
$category_link
=
get_category_link
(
$parent_cat
[
0
]);
}
else
{
$category_link
=
"#"
;
}
if
(
!
function_exists
(
'print_attribute_radio'
))
{
function
print_attribute_radio
(
$checked_value
,
$value
,
$label
,
$name
,
$index
=
0
)
{
...
...
@@ -76,7 +80,7 @@ do_action('woocommerce_before_add_to_cart_form');
<div
id=
"product"
class=
"clearfix"
>
<div
class=
"product-images row animated"
>
<div
class =
"btn-wrapper row close-panel"
>
<div
class=
"pink-btn circle-btn"
><a
href=
"
#
"
><span
class =
"abs-center backlink"
>
Retour
</span></a></div>
<div
class=
"pink-btn circle-btn"
><a
href=
"
<?php
echo
$category_link
?>
"
><span
class =
"abs-center backlink"
>
Retour
</span></a></div>
</div>
<div
class=
"product-slides row"
>
<div
class=
"product-header"
>
...
...
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