X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Add Related Category's Icon to SmartSearch results (https://forum.x-cart.com/showthread.php?t=64371)

kmjperformance 07-23-2012 11:35 AM

Add Related Category's Icon to SmartSearch results
 
I'm trying to modify SmartSearch to display a grid layout of related categories with their respective category icon.

I've figured out what file to edit: /common_files/modules/Smart_Search/smart_search.tpl
and where to put the code: below
Code:

{section name=rc loop=$related_categories max=$rcmax}

But I don't know how to get the url for the category icon. I tried this code that I found in /common_files/customer/main/subcategories_t.tpl
Code:

{get_category_image_url}
but it doesn't seem to work on that page.

Any help would be much appreciated! Once I figure it out, I'll post what I've done. I feel this is a superior way to display the related categories as most people's eyes are drawn to images rather than text.

THANKS!

kmjperformance 07-24-2012 12:58 PM

Re: Add Related Category's Icon to SmartSearch results
 
OK, so nobody has an answer to this, but how about a simple question:
How do you get a category's Icon (image) only from the CategoryID?

The smartSearch PHP file "_searcy.php" already includes common.php, which sounds to me like where the category functions are supposed to be, but the {get_category_image_url category=????} doesn't seem to work. Is there some other file I need to include?

ADDISON 07-24-2012 11:14 PM

Re: Add Related Category's Icon to SmartSearch results
 
SmartSearch is not a module supplied with XC by default. It is a paid one. You could get answers only from those who are using it.

kmjperformance 07-25-2012 10:50 AM

Re: Add Related Category's Icon to SmartSearch results
 
ADDISON, thanks for the reply. I know it's not a stock X-Cart module, but I figured there would be enough people on this forum that have used and/or modified the SmartSearch mod that might be able to help. I refuse to give up hope!

THANKS!

kmjperformance 07-25-2012 01:23 PM

Re: Add Related Category's Icon to SmartSearch results
 
OK. Figured it out. Really not that hard.

Within the section that starts
Code:

{if $related_categories}

Change
Code:

<a href="home.php?cat={$related_categories[rc].categoryid}">{$related_categories[rc].category}</a>

to
Code:

<a href="home.php?cat={$related_categories[rc].categoryid}"><img src="{$xcart_web_dir}/image.php?id={$related_categories[rc].categoryid}&amp;type=C" alt="{$related_categories[rc].category|escape}" /><br />{$related_categories[rc].category}</a>


Now, I also got rid of the <ul> and made it a grid format copying section info from the manufacturer_categories template.

cherie 07-25-2012 04:51 PM

Re: Add Related Category's Icon to SmartSearch results
 
Nice!

If you are storing images in the filesystem (recommended) then try to avoid using image.php as enough requests like that on a busy page could cause server load to go up. Instead, try to find a way to reference the actual image path.


All times are GMT -8. The time now is 05:47 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.