- Posts: 102
- Thank you received: 3
Hikashop next product button
- Rabbiteggs
-
Topic Author
- Offline
Less
More
10 years 3 months ago - 10 years 3 months ago #246636
by Rabbiteggs
Hikashop next product button was created by Rabbiteggs
-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.6.0
Hello,
Is anyone make links between first and last product?
Now it's works like: product 1 > product 2 > product 3
It would be good if: product 1 > product 2 > product 3 > product 1
Circle linked products for better SEO)
Thnx.
-- Joomla version -- : 3.6.0
Hello,
Is anyone make links between first and last product?
Now it's works like: product 1 > product 2 > product 3
It would be good if: product 1 > product 2 > product 3 > product 1
Circle linked products for better SEO)
Thnx.
Last edit: 10 years 3 months ago by Rabbiteggs.
Please Log in or Create an account to join the conversation.
10 years 3 months ago #246667
by nicolas
Replied by nicolas on topic Hikashop next product button
Hi,
Thank you for your feedback. That's a good idea.
You can add the code:
after the code:
in the file components/com_hikashop/views/product/view.html.php and that should do it.
Thank you for your feedback. That's a good idea.
You can add the code:
Code:
if($config->get('circle_around_for_shortcuts', 1)){
if(empty($links->next) && !empty($links->previous)){
$id_next = first($articles);
$elt = $productClass->get($id_next);
$productClass->addAlias($elt);
$links->next = hikashop_completeLink('product&task=show&cid='.(int)$id_next.'&name='.$elt->alias.'&'.$pathway.$url_itemid);
$links->next_product = $elt;
}
if(empty($links->previous) && !empty($links->next)){
$id_previous = end($articles);
$elt = $productClass->get($id_previous);
$productClass->addAlias($elt);
$links->previous = hikashop_completeLink('product&task=show&cid='.(int)$id_previous.'&name='.$elt->alias.'&'.$pathway.$url_itemid);
$links->previous_product = $elt;
}
}
Code:
if(isset($articles[$n])) {
$id_next = $articles[$n];
$elt = $productClass->get($id_next);
$productClass->addAlias($elt);
$links->next = hikashop_completeLink('product&task=show&cid='.(int)$id_next.'&name='.$elt->alias.'&'.$pathway.$url_itemid);
$links->next_product = $elt;
}
break;
}
Please Log in or Create an account to join the conversation.
- Rabbiteggs
-
Topic Author
- Offline
Less
More
- Posts: 102
- Thank you received: 3
10 years 3 months ago #246715
by Rabbiteggs
Replied by Rabbiteggs on topic Hikashop next product button
Thank you very much for you attention.
Something wrong. It doesn't work((
Something wrong. It doesn't work((
Please Log in or Create an account to join the conversation.
10 years 3 months ago #246735
by nicolas
Replied by nicolas on topic Hikashop next product button
Hi,
Change the line:
$id_next = first($articles);
to:
$id_next = reset($articles);
in the code I gave and it will work. I've tested it myself.
Change the line:
$id_next = first($articles);
to:
$id_next = reset($articles);
in the code I gave and it will work. I've tested it myself.
Please Log in or Create an account to join the conversation.
- Rabbiteggs
-
Topic Author
- Offline
Less
More
- Posts: 102
- Thank you received: 3
10 years 3 months ago #246741
by Rabbiteggs
Replied by Rabbiteggs on topic Hikashop next product button
Hello,
I don't know why)) My view.html file in attachment
I don't know why)) My view.html file in attachment
Please Log in or Create an account to join the conversation.
10 years 3 months ago #246743
by nicolas
Replied by nicolas on topic Hikashop next product button
Hmm, you have a different version of the code than I do.
You need to add a } before the code and remove one after so that the new code goes outside of the foreach loop.
Like that:
You need to add a } before the code and remove one after so that the new code goes outside of the foreach loop.
Like that:
Code:
foreach($articles as $k => $article){
if($article != $element->product_id && $article != $element->product_parent_id)
continue;
$links->path = JURI::root() . 'media/com_hikashop/images/icons/';
$pathway = '';
if(isset($category_pathway))
$pathway = $pathway_sef_name.'='.$category_pathway;
if($k != 0) {
$p = $k - 1;
$id_previous = $articles[$p];
$elt = $productClass->get($id_previous);
$productClass->addAlias($elt);
$links->previous = hikashop_completeLink('product&task=show&cid='.(int)$id_previous.'&name='.$elt->alias.'&'.$pathway.$url_itemid);
$links->previous_product = $elt;
}
$n = $k;
while(isset($articles[$n]) && ($articles[$n] == $element->product_id || $articles[$n] == $element->product_parent_id)) {
$n++;
}
if(isset($articles[$n])) {
$id_next = $articles[$n];
$elt = $productClass->get($id_next);
$productClass->addAlias($elt);
$links->next = hikashop_completeLink('product&task=show&cid='.(int)$id_next.'&name='.$elt->alias.'&'.$pathway.$url_itemid);
$links->next_product = $elt;
}
break;
}
if($config->get('circle_around_for_shortcuts', 1)){
if(empty($links->next) && !empty($links->previous)){
$id_next = reset($articles);
$elt = $productClass->get($id_next);
$productClass->addAlias($elt);
$links->next = hikashop_completeLink('product&task=show&cid='.(int)$id_next.'&name='.$elt->alias.'&'.$pathway.$url_itemid);
$links->next_product = $elt;
}
if(empty($links->previous) && !empty($links->next)){
$id_previous = end($articles);
$elt = $productClass->get($id_previous);
$productClass->addAlias($elt);
$links->previous = hikashop_completeLink('product&task=show&cid='.(int)$id_previous.'&name='.$elt->alias.'&'.$pathway.$url_itemid);
$links->previous_product = $elt;
}
}
Please Log in or Create an account to join the conversation.
- Rabbiteggs
-
Topic Author
- Offline
Less
More
- Posts: 102
- Thank you received: 3
10 years 3 months ago #246787
by Rabbiteggs
Replied by Rabbiteggs on topic Hikashop next product button
Thank you very much. It works well!
Please Log in or Create an account to join the conversation.
10 years 3 months ago #246791
by kyratn
Replied by kyratn on topic Hikashop next product button
Hi,
Will this be added to hikashop it self by default? As this is kinda hack....
Thanks
Will this be added to hikashop it self by default? As this is kinda hack....
Thanks
Please Log in or Create an account to join the conversation.
10 years 3 months ago #246809
by nicolas
Replied by nicolas on topic Hikashop next product button
Yes, it will be added for the next version of HikaShop.
Please Log in or Create an account to join the conversation.
Time to create page: 0.071 seconds