Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

remove category image


808smokey

Recommended Posts

Posted

Hi,

 

I've added an image for each of my categories through the admin panel where you create a "new category". Well I don't really like the look of that anymore and I'd like to just delete the picture altogher. How can I do this since there is no remove option? Just delete the picture and set "Image required" to false under admin/config/images. But if I do that then I erase the picture of the product so I'm stuck.

 

Thanks for your help

Posted

just comment out the place that displays the categories images?

not sure if you want to do that but if you do i believe its this line on index.php

 

 

<?php echo tep_image(DIR_WS_IMAGES . $category['categories_image'], $category['categories_name'], HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?>

 

another option is to upload a transparent gif image in place of the one you have already which will therefore show as nothing. call it pixel or something and make it a 1x1 transparent gif.

always here to offer some useless advice....

Posted

OK last night I decided to hack in something to actually do this... but unfortunately I have the category descritption contribution installed so I can just post the page... But if anyone wants to hack it in this is basically what I did:

osC Contributions I have published.

 

Note: Some I only provided minor changes, updates or additions!

Posted

continued.....

 

 

admin/categories.php

 

around line 37 find:

 

case 'update_category':

and add this below it:

//Category Image Removal
if ( ($HTTP_POST_VARS['edit_x']) || ($HTTP_POST_VARS['edit_y']) ) {
         $HTTP_GET_VARS['action'] = 'edit_category_ACD';
       } else {
   if ($HTTP_POST_VARS['delete_catimage'] == 'yes') {
          unlink(DIR_FS_CATALOG_IMAGES . $HTTP_POST_VARS['categories_previous_image']);
               if ($HTTP_POST_VARS['categories_image'] == $HTTP_POST_VARS['categories_previous_image']) {
                   $HTTP_POST_VARS['categories_image'] = 'none';
               }}else
   if ($HTTP_POST_VARS['unlink_catimage'] == 'yes') {
   if ($HTTP_POST_VARS['categories_image'] == $HTTP_POST_VARS['categories_previous_image']) {
                   $HTTP_POST_VARS['categories_image'] = 'none';
         }}} // may have to remove one if you have other contributions like category description

 

and now for the fun part: with the category description installed I went to:

TEXT_EDIT_CATEGORIES_IMAGE

area and worked this in:

 

<td class="main"><?php echo TEXT_EDIT_CATEGORIES_IMAGE; ?>
<br><?php if (($HTTP_GET_VARS['cID']) && $cInfo->categories_image != 'none') {echo tep_draw_separator('pixel_trans.gif', '5', '5') . tep_draw_checkbox_field('unlink_catimage', 'yes', false) . '<small><b>Remove</b> Image from Category?</small>'; ?><br><?php echo tep_draw_separator('pixel_trans.gif', '5', '5') . tep_draw_checkbox_field('delete_catimage', 'yes', false) . '<small><b>Delete</b> image from Server?</small>'; }?></td><td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_file_field('categories_image') . '<br>' . tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . $cInfo->categories_image . tep_draw_hidden_field('categories_previous_image', $cInfo->categories_image); ?></td>

 

But I know that wont work on a clean install - but yuou might be able to make it work for you. - Good luck and use it at your own risk - AND BACKUP FIRST!

osC Contributions I have published.

 

Note: Some I only provided minor changes, updates or additions!

Posted

why didnt you just comment out the line that displays the image?

that would have been far simpler.

but nice work on the code you posted :D

always here to offer some useless advice....

Posted

Beacuse that does not allow you to remove just one Category Image. It would hide all of them.

 

I did so that my clients can remove them - I thought it was something that should be able to be done from the admin area.

 

Thanks - could be ugly code - I am no programmer just a hacker :D

 

C-

osC Contributions I have published.

 

Note: Some I only provided minor changes, updates or additions!

Archived

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

×
×
  • Create New...