- Posts: 220
- Thank you received: 8
Changing Previous/next links
12 years 8 months ago #140952
by Udo
Changing Previous/next links was created by Udo
-- HikaShop version -- :2.2.3 Business edition
-- Joomla version -- : 1.5.26
-- PHP version -- : 5.3.8
Hi,
Two questions about the previous/next links on top of the product pages.
1. Is it possible to show the name of the previous/next product instead of a button image?
2. How to change the ordering method of products used by the previous/next links?
The products in my categories are ordered alphabetical.
But the previous/next links use ordering by id. That's very confusing to the customers. These buttons link to the previous product in the id-order and the next product in the id-order.
I can't find a way to change this to have Previous linking to the previous product in the alphabetical order,
and Next linking to the next product in alphabetical order .
regards,
Udo
-- Joomla version -- : 1.5.26
-- PHP version -- : 5.3.8
Hi,
Two questions about the previous/next links on top of the product pages.
1. Is it possible to show the name of the previous/next product instead of a button image?
2. How to change the ordering method of products used by the previous/next links?
The products in my categories are ordered alphabetical.
But the previous/next links use ordering by id. That's very confusing to the customers. These buttons link to the previous product in the id-order and the next product in the id-order.
I can't find a way to change this to have Previous linking to the previous product in the alphabetical order,
and Next linking to the next product in alphabetical order .
regards,
Udo
Please Log in or Create an account to join the conversation.
Less
More
- Posts: 12953
- Thank you received: 1778
12 years 8 months ago #140992
by Mohamed Thelji
Replied by Mohamed Thelji on topic Changing Previous/next links
Hi Udo,
1. I think that you'll probably find your answer through this thread .
2. I don't think that you'll be able to change that without using some code customization.
1. I think that you'll probably find your answer through this thread .
2. I don't think that you'll be able to change that without using some code customization.
Please Log in or Create an account to join the conversation.
12 years 8 months ago #141062
by Udo
Replied by Udo on topic Changing Previous/next links
Hi Mohamed,
Thanks for the reply.
1. I already read this thread. The code presented changes the prev/next buttons into the text Previous and Next.
My question is about changing .the buttons into the name of the previous product, and the name of the next product. So customers can see which product is linked to.
Is this possible?
2. Is the code customization difficult to do?
As it is now the prev/next links are of no use for me because for the customers there is no logic in the ordering.
regards,
Udo
Thanks for the reply.
1. I already read this thread. The code presented changes the prev/next buttons into the text Previous and Next.
My question is about changing .the buttons into the name of the previous product, and the name of the next product. So customers can see which product is linked to.
Is this possible?
2. Is the code customization difficult to do?
As it is now the prev/next links are of no use for me because for the customers there is no logic in the ordering.
regards,
Udo
Please Log in or Create an account to join the conversation.
12 years 8 months ago #141141
by nicolas
Replied by nicolas on topic Changing Previous/next links
Hi,
1. Anything is possible with the appropriate code. You would have to add the code:
$links->previous_product = $elt;
after:
$links->previous = hikashop_completeLink('product&task=show&cid='.(int)$id_previous.'&name='.$elt->alias.'&'.$pathway.$url_itemid);
and:
$links->next_product = $elt;
after:
$links->next = hikashop_completeLink('product&task=show&cid='.(int)$id_next.'&name='.$elt->alias.'&'.$pathway.$url_itemid);
in the file components/com_hikashop/views/product/view.html.php
and then change the code:
JText :: _('PREVIOUS_PRODUCT')
to:
$this->links->previous_product->product_name
and:
JText :: _('NEXT_PRODUCT')
to:
$this->links->next_product->product_name
in the file "show" of the view "product" via the menu Display>Views.
2. The ordering is not done based on the id but based on the ordering value of the products in the category. If you want to change that you'll have to edit the file components/com_hikashop/views/product/view.html.php and change the line:
$query='SELECT DISTINCT a.product_id FROM '.hikashop_table('product_category').' AS a LEFT JOIN '.hikashop_table('product').' AS b ON a.product_id=b.product_id WHERE '.implode(' AND ',$filters).' GROUP BY a.product_id ORDER BY a.ordering ASC';
to:
$query='SELECT DISTINCT a.product_id FROM '.hikashop_table('product_category').' AS a LEFT JOIN '.hikashop_table('product').' AS b ON a.product_id=b.product_id WHERE '.implode(' AND ',$filters).' GROUP BY a.product_id ORDER BY b.product_name ASC';
1. Anything is possible with the appropriate code. You would have to add the code:
$links->previous_product = $elt;
after:
$links->previous = hikashop_completeLink('product&task=show&cid='.(int)$id_previous.'&name='.$elt->alias.'&'.$pathway.$url_itemid);
and:
$links->next_product = $elt;
after:
$links->next = hikashop_completeLink('product&task=show&cid='.(int)$id_next.'&name='.$elt->alias.'&'.$pathway.$url_itemid);
in the file components/com_hikashop/views/product/view.html.php
and then change the code:
JText :: _('PREVIOUS_PRODUCT')
to:
$this->links->previous_product->product_name
and:
JText :: _('NEXT_PRODUCT')
to:
$this->links->next_product->product_name
in the file "show" of the view "product" via the menu Display>Views.
2. The ordering is not done based on the id but based on the ordering value of the products in the category. If you want to change that you'll have to edit the file components/com_hikashop/views/product/view.html.php and change the line:
$query='SELECT DISTINCT a.product_id FROM '.hikashop_table('product_category').' AS a LEFT JOIN '.hikashop_table('product').' AS b ON a.product_id=b.product_id WHERE '.implode(' AND ',$filters).' GROUP BY a.product_id ORDER BY a.ordering ASC';
to:
$query='SELECT DISTINCT a.product_id FROM '.hikashop_table('product_category').' AS a LEFT JOIN '.hikashop_table('product').' AS b ON a.product_id=b.product_id WHERE '.implode(' AND ',$filters).' GROUP BY a.product_id ORDER BY b.product_name ASC';
The following user(s) said Thank You: Udo
Please Log in or Create an account to join the conversation.
12 years 8 months ago #141296
by Udo
Replied by Udo on topic Changing Previous/next links
Thanks, Nicolas, works great, just what I needed.
Only one small disadvantage: after an update the changes in view.html.php get lost.
But it's a small effort to adjust the code again.
regards,
Udo
Only one small disadvantage: after an update the changes in view.html.php get lost.
But it's a small effort to adjust the code again.
regards,
Udo
Please Log in or Create an account to join the conversation.
12 years 8 months ago #141331
by nicolas
Replied by nicolas on topic Changing Previous/next links
We'll add the lines in the view.html.php in the next version as this might be useful for others.
Please Log in or Create an account to join the conversation.
Time to create page: 0.184 seconds