Advertisement:

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

Freduf

  • Sr. Member
  • ****
  • Posts: 268
Great, thank you it works very well.

I have a version 3.01

Legion

  • Hero Member
  • *****
  • Posts: 622
  • I am founder of top20remedies.com buyeradvise.com
where is the  emages?

Freduf

  • Sr. Member
  • ****
  • Posts: 268
the image on the listing of ads
look at the second link on this announcement, it is an image of class

http://www.laraiderie.com/emplois-services

sigivr

  • Sr. Member
  • ****
  • Posts: 471
http://forums.osclass.org/tips-and-tricks/(tutorial)-showing-different-images-per-main-category-instead-of-no_photo-gif/

im followin this tutorial, and is working fine, on subcategories, but when user select a main category, the showing image is a "no image avaliable"  is working great when a user select a subcategorie it shows the image that set for that category. but unfortunaly is not for subcategories, can somebody help me? please.

Look at my site and try to post in a  main category to realize whats going on
www.ofertaencaliente.com
Ill apreciate your help.

BRYAN

  • Jr. Member
  • **
  • Posts: 57
  • Beef Ruins Yet Another Nation

robbie.kein

  • Full Member
  • ***
  • Posts: 205
hi navjottomer,
i followed your tutorial and I put the function code in the functions.php file of my theme. I replaced the file main.php the string "<img src =" <? php echo osc_current_web_theme_url ('images / no_photo.gif');?> "alt =" "title =" "/>" with the string "<img src = "<? php echo osc_current_web_theme_url ('images /'). osc_item_parent_category_id ().. 'png'?> "alt =" No image available "/>"
the result you can see it in the picture attached. Where did I go wrong?

Regards

Note: of course I added the pictures to the categories in the directory "... / images" on my server.
« Last Edit: May 26, 2013, 11:19:15 am by robbie.kein »

conflituoso

  • Newbie
  • *
  • Posts: 7
does this work on bender theme?

dcentm213

  • Newbie
  • *
  • Posts: 16
@navjottomer

Thank you so much this is so great. It work fine for me.

Hostingames

  • Full Member
  • ***
  • Posts: 189
hi
the only problem I have not image that the image gives me please thank you

skr678

  • Jr. Member
  • **
  • Posts: 52
Thank you for a great mod.  It's working fine with one exception.

From homepage latest ads, if I click See all offers the premium listing without a photo picks up the same category ID of the first non premium ad.

The search link is /index.php?page=search

But search list picks up the correct category ID for the premium ads with no photos.

Roberto

  • Newbie
  • *
  • Posts: 46
Thank you! Very nice tutorial! It's possible to set a different image for subcategories too?

sirjones

  • Full Member
  • ***
  • Posts: 102
how if the image(s) of main category picked from ads image? any idea please?

carpenter

  • Newbie
  • *
  • Posts: 1
Hey,

This tutorial shows images if I use sub-categories, but it shows no any image if adds are placed in parent-categories.
"Allow users to select a parent category as a category when inserting or editing a listing " is on.
I want to use only main (parent) categories and no subcategories. Then this tutorial doesnt work. Trying to change, nothing helps. Maybe somebody had a same problem or could say what to change in those codes?

functions.php

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') ;
        return (int) osc_field($category, "fk_i_parent_id", "") ;
    }

main.php and searchlist.php

Code: [Select]
<img src="<?php echo osc_current_web_theme_url('images/') . osc_item_parent_category_id() .'.png' ?>" alt="No image available" />

Qosmio Studio

  • Jr. Member
  • **
  • Posts: 71
what about 3.2.2 ??

didnt find the rest of the codes for main.php and search.php

Mubashar

  • Newbie
  • *
  • Posts: 13
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" />