I have 2 different answers to solve this issue. The first is the easy way with minimum configuration and little control, and the second is the long way so you can have full control over every category image displayed.
The easy way:
1) Add a record to the table
"xcart_config" as follows:
Code:
insert into xcart_config (name,`comment`,value,category,orderby,`type`,defvalue) VALUES ('show_category_image','Show category image','Y','Appearance','1300','checkbox','Y')
2) Modify the file
"skin1/customer/main/subcategories.tpl"
Around line 17, find the line:
Code:
{if $tmp} [img]{if $current_category.icon_url}{$current_category.icon_url}{else}{$xcart_web_dir}/icon.php?categoryid={$cat}{/if}[/img] {/if}
and change it to:
Code:
{if $tmp and $config.Appearance.show_category_image eq "Y"} [img]{if $current_category.icon_url}{$current_category.icon_url}{else}{$xcart_web_dir}/icon.php?categoryid={$cat}{/if}[/img] {/if}
That's all...
If you want to change the way the category images are displayed just go to the
Administration area and select the
General settings / Appearance options and select or deselect the option to
Show category image (it should be at the bottom of the page).
With this option selected, all category images will be shown and with it deselected, all category images will not be shown.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Now, the long way:
1) Add a new field
show_image to the table
xcart_categories:
Code:
ALTER TABLE `xcart_categories` ADD `show_image` CHAR( 1 ) DEFAULT 'Y' NOT NULL ;
Note: If you want the default option to always start with "No" instead of "Yes" to display category images, then just execute the code below instead:
Code:
ALTER TABLE `xcart_categories` ADD `show_image` CHAR( 1 ) DEFAULT 'N' NOT NULL ;
2) Add a new label
lbl_show_image in the
Language area:
Go to the
Language option and select the language you want to edit. Make sure the
Select topic is on the
Labels option. Now, go down towards the bottom of the page and add a new label entry.
Code:
Where "Variable" = "lbl_show_image", "Description" = "Show image" and "Value" = "Show image"
3) Then change the following 3 files:
-skin1/customer/main/subcategories.tpl
-skin1/admin/main/category_modify.tpl
-admin/category_modify.php
In the file
skin1/customer/main/subcategories.tpl around line 17 change:
Code:
{if $tmp} [img]{if $current_category.icon_url}{$current_category.icon_url}{else}{$xcart_web_dir}/icon.php?categoryid={$cat}{/if}[/img] {/if}
to
Code:
{if $tmp and $current_category.show_image eq "Y"} [img]{if $current_category.icon_url}{$current_category.icon_url}{else}{$xcart_web_dir}/icon.php?categoryid={$cat}{/if}[/img] {/if}
In the file
skin1/admin/main/category_modify.tpl around line 72 find the following code:
Code:
{if $file_upload_data.file_path}
<TR>
<TD align="center">
{$lng.txt_save_category_icon_note}
</TD>
</TR>
{/if}
</TABLE>
</TD>
</TR>
and insert this code right after it:
Code:
<TR>
<TD height="10" class="FormButton" nowrap>{$lng.lbl_show_image}:</TD>
<TD width="10" height="10"><FONT class="CustomerMessage"></FONT></TD>
<TD height="10">
<SELECT name="show_image">
<OPTION value='Y' {if ($current_category.show_image eq 'Y')} selected {/if}>{$lng.lbl_yes}</OPTION>
<OPTION value='N' {if ($current_category.show_image eq 'N')} selected {/if}>{$lng.lbl_no}</OPTION>
</SELECT>
</TD>
</TR>
Note: If you want the default option on the add new category screen to always start with "No" instead of "Yes" to display category images, then just insert the code below instead:
Code:
<TR>
<TD height="10" class="FormButton" nowrap>{$lng.lbl_show_image}:</TD>
<TD width="10" height="10"><FONT class="CustomerMessage"></FONT></TD>
<TD height="10">
<SELECT name="show_image">
<OPTION value='N' {if ($current_category.show_image eq 'N')} selected {/if}>{$lng.lbl_no}</OPTION>
<OPTION value='Y' {if ($current_category.show_image eq 'Y')} selected {/if}>{$lng.lbl_yes}</OPTION>
</SELECT>
</TD>
</TR>
In the file
admin/category_modify.php around line 135 change:
Code:
db_query("UPDATE $sql_tbl[categories] SET category='$category_name', description='$description', meta_descr='$meta_descr', meta_keywords='$meta_keywords', avail='$avail', order_by='$order_by', membership='$cat_membership' WHERE categoryid='$cat'");
to
Code:
db_query("UPDATE $sql_tbl[categories] SET category='$category_name', description='$description', meta_descr='$meta_descr', meta_keywords='$meta_keywords', avail='$avail', order_by='$order_by', membership='$cat_membership', show_image='$show_image' WHERE categoryid='$cat'");
That's it.....
Now you can have full control over what category icons are displayed.
When you go the modify category option there will now be an option for
Show image towards the top of the screen, where you can select to allow to display or not display this specific image for this category.
If you have any suggestions, please let me know....