Jump to content

Image in category menu


dizzi

Recommended Posts

Hi all,

I want to add a category image to the category menu. I'm using CC4 and right now the code is 

<ul class="ul-nav">
                    <!-- END: ul_start -->
                    <!-- BEGIN: li_start -->
                    <li class="li-nav">
                    <!-- END: li_start -->
                    <a href="index.php?_a=viewCat&amp;catId={DATA.cat_id}">{DATA.cat_name}</a>                    <!-- BEGIN: li_end -->
                    </li>
                    <!-- END: li_end -->
                    <!-- BEGIN: ul_end -->
                </ul>
 
and I want to place the small image here 
 
<a href="index.php?_a=viewCat&amp;catId={DATA.cat_id}">{DATA.cat_name}IMAGE TO GO HERE</a>                    <!-- BEGIN: li_end -->
 
Can anyone direct me on how to "call" the category image. I'm assuming its something like this 
 
<a href="index.php?_a=viewCat&amp;catId={DATA.cat_id}">{DATA.cat_name}<img src="CODE THAT CALLS THE RELEVANT CAT IMAGE"</a>                    <!-- BEGIN: li_end -->
 
Hope this makes sense.
Cheers.
Miles
Link to comment
Share on other sites

Hi Miles, 

 

This isn't hugely straightforward.. You need to edit the function "getCategoryTree" in the classes/catalog.class.php file.

 

1. The select query on the CubeCart_category needs to pull out the cat_image number. 

2. The foreach loop needs to take this ID and add key to the $results array with the image path using the function "imagePath" from classes/catalogue.class.php

3. Then add the macro to the HTML template as you have above.  

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...