Go Back   Mosets Community > Archives > Mosets Tree 2.2 > Discussions, Troubleshooting & Problems

 
 
Thread Tools Search this Thread Display Modes
  #1  
Old 06-18-2011, 02:49 PM
marinos marinos is offline
Mosets'd
 
Join Date: Sep 2010
Posts: 104
Default Add listing ID to alias

Hello all

I am using listing title as the alias for all listings. The problem I am having is that this just opens the door to duplicate listings. I would like to add the link ID to the end of the alias to avoid duplicate listings and conflicts.

If anyone had a solution for this please share or bid on my elance project for this here. http://www.elance.com/j/add-link-id-...omla/24780889/
  #2  
Old 06-24-2011, 05:00 PM
marinos marinos is offline
Mosets'd
 
Join Date: Sep 2010
Posts: 104
Default Solved

My Elancer solved this with a small hack in 2 pages. Hope this is included in the next update. This works well on my setup but when the programer tested it on a fresh install it worked without the -1 in the script. so try both with and without the -1 if your having issues. other than that I cant help further. Hope this helps others with the same problem.

change 1 of 2

In administrator\components\com_tree\admin.mtree.php

Find
Code:
				// Get last inserted listing ID
				$mysql_last_insert_cl_id = $database->insertid();
replace with

Code:
				// Get last inserted listing ID
				$mysql_last_insert_cl_id = $database->insertid()-1;

				//add by dowei _ add link_id to alias				
				$row1 = new mtLinks( $database );
				$row1->load( $mysql_last_insert_cl_id);
				$row1->alias = substr($row1->alias,0,40)."-".$mysql_last_insert_cl_id;
				$row1->store();
				//end by dowei _ add link_id to alias
Change 2 of 2

In components\com_mtree\mtree.php

Find

Code:
					unset($tmp_cats);
				}
			}
		}

		# Update "Also appear in these categories" aka other categories
Replace with

Code:
					unset($tmp_cats);
				}
			}else{//add by dowei _ add link_id to alias		
				
				$mysql_last_insert_cl_id = $database->insertid()-1;
				
				$row1 = new mtLinks( $database );
				$row1->load( $mysql_last_insert_cl_id);
				$row1->alias = substr($row1->alias,0,40)."-".$mysql_last_insert_cl_id;
				$row1->store();				
			}//end by dowei _ add link_id to alias
		}

		# Update "Also appear in these categories" aka other categories
  #3  
Old 06-25-2011, 04:18 PM
marinos marinos is offline
Mosets'd
 
Join Date: Sep 2010
Posts: 104
Default

note: the script above also limits the alias to 40 characters.

You can change it to whatever you like by changing the 40 to whatever you like
  #4  
Old 06-27-2011, 02:16 PM
dknight dknight is offline
Mosets Team - Lead Developer
 
Join Date: Dec 2004
Posts: 26,442
Default

Thank you for sharing the mods!
__________________
Lee
Lead Developer
Mosets.com - Quality Joomla! Solutions
  #5  
Old 08-26-2012, 11:05 PM
gianfrancolupi gianfrancolupi is offline
Mosets'd
 
Join Date: Jun 2011
Posts: 47
Thumbs up

Quote:
Originally Posted by dknight View Post
Thank you for sharing the mods!
Hi,

I have the same problem with several duplicated titles, and this solution seems the best.

- will this hack included in the next Mosetsís release?
- If yes, is there a way to re-write all the existing aliases?

Thank you!
  #6  
Old 09-17-2012, 09:17 PM
marinos marinos is offline
Mosets'd
 
Join Date: Sep 2010
Posts: 104
Default

hi Im in the process of upgrading my site and will need to upgrade my account to get the latest version of tree. would like to know if this hack is included in the latest version before upgrading.
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +8. The time now is 02:07 PM.

Copyright © 2005-2010 Mosets Consulting

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.