TransWikia.com

How to create custom link for category?

Magento Asked by R_Solanki on January 30, 2021

I have to create category in Magento backend, it display to front end, can it possible if category name is Ex. like Football, and when i click it football category, it redirect to another sites link?

Ex. Category 1 Is Football -> Site 1 Name Like Ex. www.football.com and when click Football category its Redirect It Site 2 Like Ex. www.hockey.com

Pls Help And Suggest Some Ideas.

3 Answers

I dont know why you want to do this, but you can achieve by .htaccess

use 301 redirect rule for that

<IfModule mod_rewrite.c>
  #301 redirect
  redirect 301 oldURL NEWURL
</IfModule>

Answered by Murtuza Zabuawala on January 30, 2021

You can create custom Url Rewrites from Magento Admin panel.

Magento admin > Catalog > URL Rewrite Management >

Search for current category request path and delete it

Now you will able to create new url rewrite for that particular category.

ID Path : unique id path 
Request Path : football.html 
Target Path    :www.hockey.com 
Redirect : 301

Answered by Jitheesh V O on January 30, 2021

Easiest possible way to do is:

Admin Level: In the category(Football) description you can add some script:

<script>window.location.href = "http://www.football.com";</script>

Code Level (Dirty way): You need to override core file: app/code/core/Mage/Catalog/Block/Navigation.php

There inside function _renderCategoryMenuItemHtml find below code

$html[] = '<a href="'.$this->getCategoryUrl($category).'"'.$linkClass.'>';
$html[] = '<span>' . $this->escapeHtml($category->getName()) . '</span>';
$html[] = '</a>';

& then put condition to identify category the compose the URL & replace with $this->getCategoryUrl($category)as per your requirement.

Answered by Akhil Gupta on January 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP