Advertisement:

Author Topic: [Tutorial] Showing different images per main category instead of no_photo.gif  (Read 15289 times)

keerthi

  • Hero Member
  • *****
  • Posts: 505
Hello, I m using friendly urls. how to findout the number corresponding to the category without reverting?

teseo

  • Hero Member
  • *****
  • Posts: 6169
Hi,

In your Admin Dashboard:

Dashboard => Listings by category. The link for every category includes a parameter "catId", there is your id.

Regards

keerthi

  • Hero Member
  • *****
  • Posts: 505
Yes. Found It. Also @teseo on a completely other note. my item url is now. www.sitename.com/category/subcategory/item-title. Is it safe to change it to www.sitename.com/item-title. It seems like it will affect my previously posted ads. there is a htaccess code for 301 redirection pointing the old url to new url (but i dont know it. if you know it pls mention it). Or if there is an other way pls mention.

teseo

  • Hero Member
  • *****
  • Posts: 6169
PM your site URL and I'll take a look.

Regards

design

  • Hero Member
  • *****
  • Posts: 2619
  • Osclass 3.5 MAC/PC w/ Modern Browsers
Im using this tutorial.


it's working, except on the third level, it want to pull the second level image (thinking it's the parent)


would it be easier for me to just upload the same image with all the id's for the name? I guess I could make the images more unique  but it will mean 100's of images.


what would you do?

design

  • Hero Member
  • *****
  • Posts: 2619
  • Osclass 3.5 MAC/PC w/ Modern Browsers
I put this together it is showing the third level yea!! but it clears the second level back to 0 for the cat id


for instance the url -->  /images/0.jpg


Code: [Select]
     function osc_item_parent_category_id() {
        if ( !View::newInstance()->_exists('item_category') ) {
            View::newInstance()->_exportVariableToView('item_category', Category::newInstance()->findByPrimaryKey( osc_item_category_id() ) );
        }
$category = View::newInstance()->_get('item_category') ;
$parentCategory = osc_get_category('id', $category['fk_i_parent_id']);
        View::newInstance()->_exportVariableToView('id', $parentCategory);
        return (int) osc_field($parentCategory, "fk_i_parent_id", "") ;
    }




design

  • Hero Member
  • *****
  • Posts: 2619
  • Osclass 3.5 MAC/PC w/ Modern Browsers
I try'd still can't get it to work...anyone have an idea for the above^^ I even tried doing a second else statement lol


apparently the users on my site don't do images :-/




april123

  • Newbie
  • *
  • Posts: 7
I´ve a problem.

what I need to do exactly.

how it works on 3.3.2

thank you

april123

  • Newbie
  • *
  • Posts: 7
I´ve renamed a Picture to categoryid (31.png )

I´ve replaced the code in search_list.php ....       

In main.php I can´t find anything to replace

And now I make an offer in category 31 and the picture is the same as before


Whats wrong ???


Thanks for this tip.
I am using OSC3.2.2
Here is my solution.
Just replace in search_list.php and main.php. No need to add any thing to function.php
Code: [Select]
<img src="<?php echo osc_current_web_theme_url('images/') . osc_item_category_id .'.png' ?>" alt="No image available" />