001.
<?php
002.
003.
#######################################################
004.
005.
006.
007.
008.
009.
010.
011.
$db
= & JFactory::getDBO();
012.
013.
$user
= & JFactory::getUser();
014.
015.
$nullDate
=
$db
->getNullDate();
016.
017.
$date
=& JFactory::
getDate
();
018.
019.
$config
= & JFactory::getConfig();
020.
021.
$now
=
$date
->toMySQL();
022.
023.
$uid
=
$this
->element->product_id;
024.
025.
$cid
=
$this
->element->category_id;
026.
027.
$option
=
'com_hikashop'
;
028.
029.
$canPublish
=
$user
->authorize(
'com_hikashop'
,
'publish'
,
'content'
,
'all'
);
030.
031.
032.
033.
034.
035.
function
normalize_alias (
$string
){
036.
037.
$table
=
array
(
038.
039.
'Ů'
=>
'U'
,
'ů'
=>
'u'
,
'Š'
=>
'S'
,
'š'
=>
's'
,
'Đ'
=>
'Dj'
,
'đ'
=>
'dj'
,
'Ž'
=>
'Z'
,
'ž'
=>
'z'
,
'Č'
=>
'C'
,
'č'
=>
'c'
,
'Ć'
=>
'C'
,
'ć'
=>
'c'
,
040.
041.
'À'
=>
'A'
,
'Á'
=>
'A'
,
'Â'
=>
'A'
,
'Ã'
=>
'A'
,
'Ä'
=>
'A'
,
'Å'
=>
'A'
,
'Æ'
=>
'A'
,
'Ç'
=>
'C'
,
'È'
=>
'E'
,
'É'
=>
'E'
,
042.
043.
'Ê'
=>
'E'
,
'Ë'
=>
'E'
,
'Ì'
=>
'I'
,
'Í'
=>
'I'
,
'Î'
=>
'I'
,
'Ï'
=>
'I'
,
'Ñ'
=>
'N'
,
'Ò'
=>
'O'
,
'Ó'
=>
'O'
,
'Ô'
=>
'O'
,
044.
045.
'Õ'
=>
'O'
,
'Ö'
=>
'O'
,
'Ø'
=>
'O'
,
'Ù'
=>
'U'
,
'Ú'
=>
'U'
,
'Û'
=>
'U'
,
'Ü'
=>
'U'
,
'Ý'
=>
'Y'
,
'Þ'
=>
'B'
,
'ß'
=>
'Ss'
,
046.
047.
'à'
=>
'a'
,
'á'
=>
'a'
,
'â'
=>
'a'
,
'ã'
=>
'a'
,
'ä'
=>
'a'
,
'å'
=>
'a'
,
'æ'
=>
'a'
,
'ç'
=>
'c'
,
'è'
=>
'e'
,
'é'
=>
'e'
,
048.
049.
'ê'
=>
'e'
,
'ë'
=>
'e'
,
'ì'
=>
'i'
,
'í'
=>
'i'
,
'î'
=>
'i'
,
'ï'
=>
'i'
,
'ð'
=>
'o'
,
'ñ'
=>
'n'
,
'ò'
=>
'o'
,
'ó'
=>
'o'
,
050.
051.
'ô'
=>
'o'
,
'õ'
=>
'o'
,
'ö'
=>
'o'
,
'ø'
=>
'o'
,
'ù'
=>
'u'
,
'ú'
=>
'u'
,
'û'
=>
'u'
,
'ý'
=>
'y'
,
'þ'
=>
'b'
,
052.
053.
'ÿ'
=>
'y'
,
'Ŕ'
=>
'R'
,
'ŕ'
=>
'r'
,
'Ř'
=>
'R'
,
'ř'
=>
'r'
,
'+'
=>
'a'
,
054.
055.
);
056.
057.
return
trim(
strtolower
(
strtr
(
$string
,
$table
)));
058.
059.
}
060.
061.
062.
063.
064.
065.
066.
067.
$query
=
'SELECT * FROM #__hikashop_product AS a LEFT JOIN #__hikashop_product_category AS cc ON cc.product_id = a.product_id WHERE cc.category_id = '
.
$cid
;
068.
069.
070.
071.
$db
->setQuery(
$query
);
072.
073.
$list
=
$db
->loadObjectList(
'product_id'
);
074.
075.
076.
077.
if
( !
is_array
(
$list
) ) {
078.
079.
$list
=
array
();
080.
081.
}
082.
083.
084.
085.
reset(
$list
);
086.
087.
088.
089.
090.
091.
$location
=
array_search
(
$uid
,
array_keys
(
$list
));
092.
093.
$rows
=
array_values
(
$list
);
094.
095.
$row
->prev = null;
096.
097.
$row
->next = null;
098.
099.
if
(
$location
-1 >= 0) {
100.
101.
102.
103.
$row
->prev =
$rows
[
$location
-1];
104.
105.
}
106.
107.
if
((
$location
+1) <
count
(
$rows
)) {
108.
109.
110.
111.
$row
->next =
$rows
[
$location
+1];
112.
113.
}
114.
115.
$pnSpace
=
"  "
;
116.
117.
118.
119.
if
(
$row
->prev) {
120.
121.
$row
->prev = JRoute::_(
'/galerie/product/show/cid-'
.
$row
->prev->product_id.
'/name-'
.
str_replace
(
" "
,
"-"
,normalize_alias(
$row
->prev->product_name)).
'/category_pathway-'
.
$row
->prev->category_id);
122.
123.
}
else
{
124.
125.
$row
->prev =
''
;
126.
127.
}
128.
129.
if
(
$row
->next) {
130.
131.
$row
->next = JRoute::_(
'/galerie/product/show/cid-'
.
$row
->next->product_id.
'/name-'
.
str_replace
(
" "
,
"-"
,normalize_alias(
$row
->next->product_name)).
'/category_pathway-'
.
$row
->next->category_id);
132.
133.
}
else
{
134.
135.
$row
->next =
''
;
136.
137.
}
138.
139.
140.
141.
142.
143.
if
(
$row
->prev ||
$row
->next)
144.
145.
{
$html
=
'<table align="center" class="pagenav"><tr>'
;
146.
147.
if
(
$row
->prev) {
$html
.=
'<td class="pagenav_prev"><a href="'
.
$row
->prev .
'">'
.JText::_(
'«'
).
$pnSpace
. JText::_(
'Prev'
) .
'</a></td>'
; }
148.
149.
if
(
$row
->prev &&
$row
->next) {
$html
.=
'<td width="50"> </td>'
;}
150.
151.
if
(
$row
->next) {
$html
.=
'<td class="pagenav_next"><a href="'
.
$row
->next .
'">'
. JText::_(
'Next'
) .
$pnSpace
. JText::_(
'»'
) .
'</a></td>'
;}
152.
153.
$html
.=
'</tr></table>'
; }
154.
155.
echo
$html
;
156.
157.
158.
159.
##################################################
160.
161.
?>