Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Add Related Category's Icon to SmartSearch results

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 07-23-2012, 11:35 AM
 
kmjperformance kmjperformance is offline
 

Advanced Member
  
Join Date: Jul 2008
Location: Iowa
Posts: 42
 

Question 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!
__________________

X-Cart 4.4.5
PHP 5.3.14-1
MySQL 5.0.51
Linux + Apache
Mods:
AlteredCart SmartSearch w/ AJAX Predictive Search w/ Extras Add-On v2, BuyTogether, Checkout One, OnSale
********* PowerFilter
WebsiteCM CDSEOPro
Phpmagicscripts Reviews-Controller
CFL Systems Products Page Layout, System Messages mod
Custom work by CFLSystems
Custom work by us
Reply With Quote
  #2  
Old 07-24-2012, 12:58 PM
 
kmjperformance kmjperformance is offline
 

Advanced Member
  
Join Date: Jul 2008
Location: Iowa
Posts: 42
 

Default 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?
__________________

X-Cart 4.4.5
PHP 5.3.14-1
MySQL 5.0.51
Linux + Apache
Mods:
AlteredCart SmartSearch w/ AJAX Predictive Search w/ Extras Add-On v2, BuyTogether, Checkout One, OnSale
********* PowerFilter
WebsiteCM CDSEOPro
Phpmagicscripts Reviews-Controller
CFL Systems Products Page Layout, System Messages mod
Custom work by CFLSystems
Custom work by us
Reply With Quote
  #3  
Old 07-24-2012, 11:14 PM
  ADDISON's Avatar 
ADDISON ADDISON is offline
 

X-Man
  
Join Date: Jan 2008
Posts: 2,613
 

Default 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.
__________________
X-Cart Next: Business 5.2 (learning and testing)
X-Cart Classic: Gold and Gold Plus 4.7
Lots of Modules and Customizations
OS in use: Red Hat Enterprise, Fedora, CentOS, Debian, Ubuntu, Linux Mint, Kali Linux
Ideas for Server configuration (basicaly): Nginx/Pound (reverse proxy), Apache/Nginx (webserver), Squid/Varnish (cache server), HHVM or (PHP-FPM + PHP 5.6 + opcache), MariaDB/Percona MySQL Server, Redis (storing sessions)

You can catch my ideas here: http://ideas.x-cart.com
Reply With Quote
  #4  
Old 07-25-2012, 10:50 AM
 
kmjperformance kmjperformance is offline
 

Advanced Member
  
Join Date: Jul 2008
Location: Iowa
Posts: 42
 

Default 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!
__________________

X-Cart 4.4.5
PHP 5.3.14-1
MySQL 5.0.51
Linux + Apache
Mods:
AlteredCart SmartSearch w/ AJAX Predictive Search w/ Extras Add-On v2, BuyTogether, Checkout One, OnSale
********* PowerFilter
WebsiteCM CDSEOPro
Phpmagicscripts Reviews-Controller
CFL Systems Products Page Layout, System Messages mod
Custom work by CFLSystems
Custom work by us
Reply With Quote
  #5  
Old 07-25-2012, 01:23 PM
 
kmjperformance kmjperformance is offline
 

Advanced Member
  
Join Date: Jul 2008
Location: Iowa
Posts: 42
 

Talking 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.
__________________

X-Cart 4.4.5
PHP 5.3.14-1
MySQL 5.0.51
Linux + Apache
Mods:
AlteredCart SmartSearch w/ AJAX Predictive Search w/ Extras Add-On v2, BuyTogether, Checkout One, OnSale
********* PowerFilter
WebsiteCM CDSEOPro
Phpmagicscripts Reviews-Controller
CFL Systems Products Page Layout, System Messages mod
Custom work by CFLSystems
Custom work by us
Reply With Quote
  #6  
Old 07-25-2012, 04:51 PM
  cherie's Avatar 
cherie cherie is offline
 

X-Wizard
  
Join Date: May 2003
Location: USA
Posts: 1,534
 

Default 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.
__________________
redlimeweb.com
custom mods and design integration
4.7 linux
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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

vB 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:01 PM.

   

 
X-Cart forums © 2001-2020