Page 4 of 5 FirstFirst ... 2345 LastLast
Results 31 to 40 of 48
  1. #31
    Join Date
    Aug 2010
    Location
    Hartland, MI
    Posts
    282
    Plugin Contributions
    3

    Default Re: Automatically populate category images from their product images

    If you had this implemented just a minute ago it seemed to be working just fine, then the browser couldn't connect to the server any longer???

    Quote Originally Posted by cheaperbyfar View Post
    Dunno, copied yours in exactly, still doesn't work. Guess I'm gonna go the other route.....come back to this later. The other addon I have installed is category dressing, but don't think that's interfering.

  2. #32

    Default Re: Automatically populate category images from their product images

    I cheated... Exported products and categories with apsona and matched filenames from products to category images. Actually only took about 3 minutes... Anyone need better explanation let me know. Wanted more of the random thing going on...

  3. #33
    Join Date
    Jun 2008
    Posts
    111
    Plugin Contributions
    0

    Default Re: Automatically populate category images from their product images

    ooh. aponsa. had never heard of that one before. love it. thanks.

    did anyone get the random image code bit to work? i copy and pasted it as is, but no go... i would love a randomizer for category images.
    :) emily
    http://store.inspiritcommon.com/
    ZC 1.3.8a on Godaddy :: EP 1.2.5.4 :: Adv Search 1.1 and a buncha other stuff

  4. #34
    Join Date
    Jun 2008
    Posts
    111
    Plugin Contributions
    0

    Default Re: Automatically populate category images from their product images

    Quote Originally Posted by gjh42 View Post
    WebMC's randomizing code could also be put in the same place:
    PHP Code:
      while (!$categories->EOF) {
        global 
    $db;
        
    $sql "select products_image from " TABLE_PRODUCTS " where master_categories_id = " $categories->fields['categories_id'] . " ORDER BY RAND() LIMIT 1";
        
    $result $db->Execute($sql);
        
    $cat_image $result->fields['products_image'];
        
    $cat_image file_exists(DIR_WS_IMAGES $cat_image)? $cat_image'pixel_trans.gif';
        if (!
    $categories->fields['categories_image']) !$categories->fields['categories_image'] = $cat_image
    i've implemented this and it's working now that i got a pesky template issue ironed out. and i've got two questions/wishes:

    is there a way to have it not to display images from products where there are no images? i'm seeing a lot of the 'photo not available' image as my category photos. really, there aren't a ton of unavailable images either...

    is there a way to restrict the width of the image displayed? in one of my sections one random image is wide, the other are tall... the wide one runs off the edge into the right sideboxes (see attached) and i don't know if i can control that, short of re-saving that image as a portrait orientation...
    Attached Images Attached Images  
    :) emily
    http://store.inspiritcommon.com/
    ZC 1.3.8a on Godaddy :: EP 1.2.5.4 :: Adv Search 1.1 and a buncha other stuff

  5. #35
    Join Date
    Jul 2010
    Location
    Kent UK
    Posts
    50
    Plugin Contributions
    0

    Default Re: Automatically populate category images from their product images

    Quote Originally Posted by WebMC View Post
    $sql = "select products_image from " . TABLE_PRODUCTS . " where master_categories_id = " . $categories->fields['categories_id'] . " AND products_image IS NOT NULL AND products_image != '.jpg' AND products_image != ' ' ORDER BY RAND() LIMIT 1";


    you could change the sql to that to decrease the chances of it finding an empty image.......

    I am tempted to look into a way for the if statement to repeat the lookup if no file exists but this might be dangerous if no products have images in the category.....
    I should of pointed out this code this code wont work for categories which contain subcategories as obviously in zen cart you cant have both products and categories on the same level, and therefore the query wont find any images. But You can still add those in manually....

    Also when playing around with code I never intended to have catetory images on product info - if you did you would probably need to place the code there also.....

    If you play around with the sql you could reduce the chances of it picking up an empty image......"AND products_image IS NOT NULL" ( I only have .jpg in these because I concatenated this string to the image names in excell and if it was empty would have left that)
    Last edited by WebMC; 5 Oct 2010 at 11:02 PM.

  6. #36
    Join Date
    Jul 2010
    Location
    Kent UK
    Posts
    50
    Plugin Contributions
    0

    Default Re: Automatically populate category images from their product images

    Quote Originally Posted by fontaholic View Post

    is there a way to restrict the width of the image displayed?
    That's weird - that usually happens when you have a really thin picture, I think thats going to happen even if you added it manually - you just need to edit the image and make sure it is taller - Ideally square by modifying the canvas size.

    I would recommend installing image handler if you havent already (don't quote me on that as I can't verify how well it works throughout the versions but it works well for me...)

    failing that you could add max-width in your css somewhere - but that usually gives you unproporitonal results....
    (use firebug and check the class if you don't know it)

  7. #37
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Automatically populate category images from their product images

    Wow. Yes, that's wide:)

    Do you have custom settings for these in Configuration > Images?
    Small Image Width
    Small Image Height

    Calculate Image Size

    Image - Product Listing Width
    Image - Product Listing Height
    Image - Product New Listing Width
    Image - Product New Listing Height
    Image - New Products Width
    Image - New Products Height
    Image - Featured Products Width
    Image - Featured Products Height
    Image - Product All Listing Width
    Image - Product All Listing Height

    As long as you use "proportional images" setting, the images should be shrunk if necessary to fit the dimensions.
    Last edited by gjh42; 6 Oct 2010 at 12:17 AM.

  8. #38
    Join Date
    Jun 2008
    Posts
    111
    Plugin Contributions
    0

    Default Re: Automatically populate category images from their product images

    i definitely have some custom image sizes in there... i adjusted them when i didn't really know what i was doing, so maybe that's what (some of*) the issue is:

    Small Image Width 222
    Small Image Height 222
    Calculate Image Size true
    Image - Product Listing Width 144
    Image - Product Listing Height 222
    Image - Product New Listing Width 100
    Image - Product New Listing Height 80
    Image - New Products Width 100
    Image - New Products Height 80
    Image - Featured Products Width 100
    Image - Featured Products Height 80
    Image - Product All Listing Width 100
    Image - Product All Listing Height 80

    my product categories are pretty deep. big bummer that it doesn't display images of upper categories.
    :) emily
    http://store.inspiritcommon.com/
    ZC 1.3.8a on Godaddy :: EP 1.2.5.4 :: Adv Search 1.1 and a buncha other stuff

  9. #39
    Join Date
    Jul 2010
    Location
    Kent UK
    Posts
    50
    Plugin Contributions
    0

    Default Re: Automatically populate category images from their product images

    Quote Originally Posted by WebMC View Post
    I should of pointed out this code this code wont work for categories which contain subcategories as obviously in zen cart you cant have both products and categories on the same level, and therefore the query wont find any images. But You can still add those in manually...
    Atleast I think thats the case - I gave up testing a while ago (and was only looking at subcategories one level deep) as I dont need this code but there is probably a way round it if someone wanted to take time to expand the code - i might be wrong...

  10. #40
    Join Date
    Jun 2008
    Posts
    111
    Plugin Contributions
    0

    Default Re: Automatically populate category images from their product images

    yeah, it makes sense, no products, no images registered.... thanks. i'm no php guru. i know only enough to really mess stuff up and not be able to figure out the issue for months!
    :) emily
    http://store.inspiritcommon.com/
    ZC 1.3.8a on Godaddy :: EP 1.2.5.4 :: Adv Search 1.1 and a buncha other stuff

 

 
Page 4 of 5 FirstFirst ... 2345 LastLast

Similar Threads

  1. Category images from product images
    By korayp in forum All Other Contributions/Addons
    Replies: 3
    Last Post: 22 Dec 2009, 04:12 PM
  2. How do I keep the banner images from resizing automatically?
    By bparker in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 19 Nov 2008, 03:33 AM
  3. Populate Images by Category and Product
    By borillion_star in forum Customization from the Admin
    Replies: 0
    Last Post: 1 Sep 2008, 08:57 PM
  4. Automatically populate sub category images + change attribute ordering
    By GTrotter in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 30 Apr 2007, 07:54 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR