Jump to content

Archived

This topic is now archived and is closed to further replies.

longhorn1999

tep_href_link for a manufacturer and subcategory

Recommended Posts

Hi,

 

I've been going through the text in my site to make sure that all the links are written correctly, and I see that there's one thing which I'm not quite sure about.

 

To make a regular link to a category for example might be:

 

<a href="<?php echo tep_href_link(FILENAME_DEFAULT, 'cPath=30'); ?>">Televisions</a>

 

And the link for the subcategory LCD TVs might be:

 

<a href="<?php echo tep_href_link(FILENAME_DEFAULT, 'cPath=30_31'); ?>">LCDs</a>

 

And the link for all products of the manufacturer, Sony, would be:

 

<a href="<?php echo tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=27'); ?>">Sony</a>

 

 

 

But if I wanted to only show Sony LCDs instead of all Sonys, what would be the proper syntax?

 

 

I'm using Ultimate SEO Urls 5, and the page url for this product listing would be http://www.somesite.com/sony-m-27.html?filter_id=31&sort=2a

 

 

Any ideas?

Share this post


Link to post
Share on other sites

Use

 

<a href="<?php echo tep_href_link(FILENAME_DEFAULT, 'cPath=31'); ?>">LCDs</a>

 

Instead of

 

<a href="<?php echo tep_href_link(FILENAME_DEFAULT, 'cPath=30_31'); ?>">LCDs</a>

Share this post


Link to post
Share on other sites

Thanks Ashley. You're right, I can just use the subcategory id the same as the category id.

 

 

But any ideas about how to link to specific subcategories and manufacturers together?

Share this post


Link to post
Share on other sites

Thanks Ashley. You're right, I can just use the subcategory id the same as the category id.

 

 

But any ideas about how to link to specific subcategories and manufacturers together?

 

Try using filter_id. You can turn it on in admin.

Share this post


Link to post
Share on other sites

Could you tell me where filter_id is exactly in the admin? I can't seem to find it in mine.

 

Configuration - product listing.

Share this post


Link to post
Share on other sites

Thanks again Ashley. Actually I have filter_id set to enable in the admin.

 

I'm still trying to figure out the proper syntax for, in this example, only Sony LCDs as opposed to any other brand.

 

Here the LCD category has the id 31 and the manufacturer Sony has the id 27.

 

This is the syntax of the actual url w/ Ultimate SEO Urls 5:

 

http://www.example-TV-store.com/LCDs-c-31.html?filter_id=27&sort=2a

 

Is there a way to create a tep_href link that takes me to this specific page, i.e., the LCD category listing that has been

filtered to just the one manufacturer, Sony?

Share this post


Link to post
Share on other sites

Have you tried

 

<a href="<?php echo tep_href_link(FILENAME_DEFAULT, 'filter_id=31'); ?>">Sony LCDs</a>

Share this post


Link to post
Share on other sites

Just tried it and unfortunately it doesn't work, as it just takes me back to the home page.

 

<a href="<?php echo tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=27'); ?>">Sony</a> is what's there right now, and this returns all Sony products.

 

I would've thought that the way to filter this with category 31 (LCDs) would be something like

<a href="<?php echo tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=27, filter_id=31'); ?>">Sony LCDs</a> but of course that doesn't work. Somehow the manufacturer id 27 and the category id 31 should both be included, but I don't know what the proper syntax is.

Share this post


Link to post
Share on other sites

There are 5 parameters for tep href function.

 

tep_href_link($page, $parameters , $connection, $add_session_id , $search_engine_safe )

 

$page is the page you are linking to.

$parameters is parameters for the url (action=send etc)

$connection is SSL or NONSSL

$add_session_id is normally 'true' so sid is added

$search_engine_safe if set to true and SEARCH_ENGINE_FRIENDLY_URLS is set to 'true' (in admin) sef url's are created.

 

http://forums.oscommerce.com/topic/330479-what-is-the-oscsid-why-you-must-not-loose-it/

 

eg:

<a href="<?php echo tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=27', 'NONSSL'); ?>">Sony</a>

 

So how you suggested it won't work. (don't think you can specify multiple parameters).

Share this post


Link to post
Share on other sites

Hmm.. Very useful info for sure, thanks. But I guess I'm still stuck for now. I am surprised that there doesn't appear to be a way to add a manufacturer or category filter to a tep_href link. Has no one else seen a use for these kind of specific links in their site, or is it simply not possible? I suppose just forcing cookie use and forgetting tep_href links altogether is the other option.

Share this post


Link to post
Share on other sites

OK I just got the answer for future reference from Robert (FWR Media) in another thread.

 

 

This link in my example would look like:

tep_href_link( FILENAME_DEFAULT, 'cPath=31&filter_id=27&sort=2a' )

Share this post


Link to post
Share on other sites

OK I just got the answer for future reference from Robert (FWR Media) in another thread.

 

 

This link in my example would look like:

tep_href_link( FILENAME_DEFAULT, 'cPath=31&filter_id=27&sort=2a' )

 

This also works

 

tep_href_link( FILENAME_DEFAULT, 'manufacturers_id=10&filter_id=657'

Share this post


Link to post
Share on other sites

×