Support Forums

category ID in url

This is a discussion on category ID in url within the Customizations forums, part of the Developer Forums category; How can i print the category id currently being viewed into an url like this: Code: <a href="www.mysite.com/{$cat.id}>Link</a> Result: <a ...


Go Back   68 Classifieds Forums > Developer Forums > Customizations

Reply
 
Thread Tools Display Modes
Old 08-08-2011, 02:15 PM   #1
Customer
 
Join Date: Jul 2010
Posts: 23
Rep Power: 6
tango is on a distinguished road
Default category ID in url

How can i print the category id currently being viewed into an url like this:

Code:
<a href="www.mysite.com/{$cat.id}>Link</a>
Result: <a href="www.mysite.com/444>Link</a>
Thanks
tango is offline   Reply With Quote
Old 08-08-2011, 03:30 PM   #2
Developer & Moderator
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 2,370
Rep Power: 72
Mike-N-Tosh is just really nice Mike-N-Tosh is just really nice
Default

You're going to need to provide more information as it appears that you are trying to do this dynamically. Different template files use different smarty variables depending on the template file and how you got there (e.g. which php script set the template file).

So you need to provide details as to how and exactly which template etc., for anyone to answer your question.

Of course you can help yourself by reading all available online documentation, such as how to find what smarty variables are available in the template file you are using.
__________________
Mike-N-Tosh
IndianaPC.org - A community website (v3.1.10 Developer - heavily modified & used as the CMS)
Sandbox [localhost(v3.1.10, v4.0.9, 4.1.10,4.2,5.0)] for development and customization
Visit My blog: reviews, tips, tricks, tutorials and my store with Templates, Mods & Docs
Web Hosting | Web Design & Development | 68 Classifieds Customizations
I am not a 68C employee, just a user and try to help out
Mike-N-Tosh is offline   Reply With Quote
Old 08-08-2011, 07:26 PM   #3
Customer
 
Join Date: Jul 2010
Posts: 23
Rep Power: 6
tango is on a distinguished road
Default

Thanks for replying.I'm using the default template with version 4.1.10 (designer) and using the debug tag i found this: {$getcats}. What i was doing is just linking to search results using the subcategory ID and what ever location. Something like this:

Tag:
Code:
<a href="http://mysite.com/searchresults.php?searchtext=&type={$cat.id}&opt1=Mars&Submit=Search">Mars</a>
Result:
Code:
<a href="http://mysite.com/searchresults.php?searchtext=&type=4&opt1=Mars&Submit=Search">Mars</a>
I was placing it on the showlistings.tpl page

Last edited by tango; 08-08-2011 at 08:21 PM.
tango is offline   Reply With Quote
Old 08-19-2011, 01:11 PM   #4
Customer
 
Join Date: Jul 2010
Posts: 23
Rep Power: 6
tango is on a distinguished road
Default

I'm using the default template (designer) with version 4.1.10, all i need is a dynamic tag for the category being viewed for example, a person is viewing the listings in the Birds sub category then the "tag" will generate "bird category" like this:
HTML Code:
http://websites.com/listings/{tag}
http://website.com/listings/bird-category
If you need more info about what i am on about please ask me
tango is offline   Reply With Quote
Old 08-19-2011, 04:46 PM   #5
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 3,427
Rep Power: 87
seymourjames is a jewel in the rough
Default

I am personally lost in terms of what you are trying to do. Please tell us whether you talking about a set of category listings, a set of search results or an actual advert.

Are you trying to know the category of any listing on a set of search results? are you trying to print it out or make a link or what?
__________________
"The fool doth think he is wise, but the wise man knows himself to be a fool.".

TemplateCodes.com for 68C, Version 4 Templates & Modules
Get the Best U.S Hosting, Best U.K Hosting
seymourjames is offline   Reply With Quote
Old 08-20-2011, 12:18 PM   #6
Developer & Moderator
 
 
Join Date: Jan 2007
Location: Pennsylvania, USA
Posts: 2,370
Rep Power: 72
Mike-N-Tosh is just really nice Mike-N-Tosh is just really nice
Default

I am just as confused, as you are referring to 3 completely different types of results in your concept.

The first thing I don't understand about your original question is simply that if you are already on the page showing the results, then why do you now need a link to it if you're already viewing the page???

Why would you want to place a link to the page that you're already viewing???

The second URL example doesn't even exist. Where are you getting that from?
__________________
Mike-N-Tosh
IndianaPC.org - A community website (v3.1.10 Developer - heavily modified & used as the CMS)
Sandbox [localhost(v3.1.10, v4.0.9, 4.1.10,4.2,5.0)] for development and customization
Visit My blog: reviews, tips, tricks, tutorials and my store with Templates, Mods & Docs
Web Hosting | Web Design & Development | 68 Classifieds Customizations
I am not a 68C employee, just a user and try to help out
Mike-N-Tosh is offline   Reply With Quote
Old 08-21-2011, 08:17 PM   #7
Customer
 
Join Date: Jul 2010
Posts: 23
Rep Power: 6
tango is on a distinguished road
Default

Thanks for responding

Quote:
The second URL example doesn't even exist. Where are you getting that from?
Your right scratch that one

Sorry fellas for not explaining more clearly

You know if you search for something using the search form and you select, lets say the birds sub category and its category Id happens to be 22, you get an url like this:

searchresults.php?searchtext=&type=22&minprice=&maxprice=&opt1=UK&opt5=&Submit=Search

What i meant to do was place a few links for each country on the showlistings.tpl, so when clicked it would go to the search page for that sub category id and filter the results for what ever country (extra field) they clicked on.

HTML Code:
<a href="http://websites.org/searchresults.php?&type=8&opt1=UK&Submit=Search>UK</a>
<a href="http://websites.org/searchresults.php?&type=8&opt1=France&Submit=Search>France</a>
The only problem that i cant get around is how to show the sub categories Id (&type=id) in the search link becasue the id changes for each sub category.

Quote:
Are you trying to know the category of any listing on a set of search results? are you trying to print it out or make a link or what?
Im trying to link to the search results and filter them by country which is an extra field.

Quote:
The first thing I don't understand about your original question is simply that if you are already on the page showing the results, then why do you now need a link to it if you're already viewing the page???
To filter by country, the hyper linked countries would be placed on the showlistings.tpl page

Last edited by tango; 08-21-2011 at 08:40 PM.
tango is offline   Reply With Quote
Old 08-22-2011, 06:27 AM   #8
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 3,427
Rep Power: 87
seymourjames is a jewel in the rough
Default

To be frank I am still a little confused. You need to be more specific as to what behavior you actually expect to have. Explain the goal and not what you think the technical solution is likely to be.

i.e a user searches on a category and an extrafield, he then gets a set of search results, user is then presented with links but to what exactly. To the same category with another extrafield? To a different category with the same extrafield? To another category with another extrafield? To a set of searches which are the subcategories of the orginal category with another extrafield, etc.

In general, I would have thought this is a better solution to the over all problem I think you are trying to address.

It would seem you are asking for a selector on search results where someone can select an extrafield (country in this case) from say a dropdown on the search results page to redisplay results for specific countries. In other words they don't have to fill out the search form again and just click on another country. The new results appear each time. Unfortunately this does not exist.

The best I can see at this point is to consider using the global search module and place it on the showlsitings page. Then perhaps modifying it slightly to always present the countries in the dropdown (if they are fixed for all categories - they don't need to have a dynamic behavior). Perhaps keep the other variables already chosen in the other search fields. Something close to this idea is here

Property For Sale In France


The property type is an extrafield with fixed values across all categories (areas in my case). In fact this module could be placed onto a showlistings page and would work just the same. It may be possible to autocomplete the category based upon the last search.
__________________
"The fool doth think he is wise, but the wise man knows himself to be a fool.".

TemplateCodes.com for 68C, Version 4 Templates & Modules
Get the Best U.S Hosting, Best U.K Hosting

Last edited by seymourjames; 08-22-2011 at 06:30 AM.
seymourjames is offline   Reply With Quote
Old 08-22-2011, 07:25 PM   #9
Customer
 
Join Date: Jul 2010
Posts: 23
Rep Power: 6
tango is on a distinguished road
Default

Ya the quick search module would be my best bet for that particular modification, thanks for the advice. Your filter module does what is required so i will stick with that since i got it working correctly today
tango is offline   Reply With Quote
Old 08-22-2011, 07:42 PM   #10
All Hands On Deck
 
 
Join Date: Mar 2008
Posts: 3,427
Rep Power: 87
seymourjames is a jewel in the rough
Default

Global search module. The quick search does not handle extra fields.
__________________
"The fool doth think he is wise, but the wise man knows himself to be a fool.".

TemplateCodes.com for 68C, Version 4 Templates & Modules
Get the Best U.S Hosting, Best U.K Hosting
seymourjames is offline   Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Category title under or above category picture ? mikeyc Customizations 4 09-10-2009 01:49 PM
View Selected Category and Sub Category during checkout process? Kazza Technical Support 4 10-27-2008 09:02 AM
Category & Sub Category Descriptions & Keywords jj30 Technical Support 0 06-20-2008 08:32 AM
Mass Move listings of a category to another category Success Technical Support 3 04-10-2008 11:01 AM
How to align custom category images with category links. michael Templates, HTML, CSS, and Design Help 5 02-22-2007 12:42 PM


All times are GMT -4. The time now is 01:32 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2011, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0