Page 1 of 5 123 ... LastLast
Results 1 to 10 of 48
  1. #1
    Join Date
    Jun 2009
    Location
    Orange County, California
    Posts
    508
    Plugin Contributions
    17

    Default Automatically populate category images from their product images

    It's quite tedious to add category images one by one by hand!

    It would be very helpful to automatically pull the category images from the product photos that are contained within.

    I've searched for modules to do this, and have found none. Anyone have any ideas how to tackle the custom coding?
    Jackie Taferner - JT Website Design
    Custom Website Design and Ecommerce
    **Support the community. Don't Private Message, post your questions in the forum.**

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    67,931
    Plugin Contributions
    6

    Default Re: Automatically populate category images from their product images

    Usually a Category has many Products and the Products have 1 to many images ...

    How would you determine from the Products which image should be used for the whole category?
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.3]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

  3. #3
    Join Date
    Jun 2009
    Location
    Orange County, California
    Posts
    508
    Plugin Contributions
    17

    Default Re: Automatically populate category images from their product images

    By default, i could use the main image from the first product in the category.

    So, for example my product that has sort order "1", and has 3 images:

    101.jpg <-- use this one
    101_2.jpg
    101_3.jpg


    It would be even neater if the product could be specified in the admin:

    Product to display for categories images (by sort order #): 1

    But for me, this is actually not necessary because my products within each subcategory all have the same main image.... ANY product from the category will do fine :)

    I'm just thinking to make it scalable and put into a module for others to use.
    Jackie Taferner - JT Website Design
    Custom Website Design and Ecommerce
    **Support the community. Don't Private Message, post your questions in the forum.**

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    67,931
    Plugin Contributions
    6

    Default Re: Automatically populate category images from their product images

    How often are you making categories that you cannot just tell it the categories image when you set the category image then?

    Or does the Product image for the category change that often that you need to update the category image?

    I am having trouble picturing how a site would be setup where the Categories image is the same as the Product image and all the Products in a Category would use the same image ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.3]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

  5. #5
    Join Date
    Jun 2009
    Location
    Orange County, California
    Posts
    508
    Plugin Contributions
    17

    Default Re: Automatically populate category images from their product images

    Well, I'm using easy populate which is quite easy to name all the product images and simply upload to db. Unfortunately the category images are not so simple.

    Manually adding the images by hand to every category is such a chore. This particular store doesn't have an insane number of categories, but it would be so much easier for it to auto-pull the images based on the products inside.

    I know there are lots of others who are in a worse spot than me - they have thousands of products and categories, and would spend upwards of 10-20 hours just uploading category images.

    That's not very efficient. I'd like to make a solution for everyone that can be put in modules section. I imagine it wouldn't be too tough - just a bit of editing to the product-listing.php template to pull a different image from the db?
    Jackie Taferner - JT Website Design
    Custom Website Design and Ecommerce
    **Support the community. Don't Private Message, post your questions in the forum.**

  6. #6
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    67,931
    Plugin Contributions
    6

    Default Re: Automatically populate category images from their product images

    In the Developers Tool Kit ... if you do a search on:
    categories_image

    you can see all the places referenced and you can check to see if you can just change a simple template or module or perhaps the function for your needs on this ...

    This is pretty specialized as I have not had too many people who need this ...

    You could also customize a simple routine to be run when you update your products to go rebuild the categories table with the correct image from the products table based on the master_categories_id (assuming that is correct) ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.3]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

  7. #7
    Join Date
    Jun 2009
    Location
    Orange County, California
    Posts
    508
    Plugin Contributions
    17

    Default Re: Automatically populate category images from their product images

    Ok, I will see what I can find tonight - thanks for the info!

    I'm sure I'll have more questions once I dive into it :)
    Jackie Taferner - JT Website Design
    Custom Website Design and Ecommerce
    **Support the community. Don't Private Message, post your questions in the forum.**

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

    Default Re: Automatically populate category images from their product images

    I would like this function also - I have just uploaded 13000 products which lie in 300 categories, each of which require an image. I will have to look into it.....

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

    Default Re: Automatically populate category images from their product images

    while (!$categories->EOF) {

    $cat_image = $categories->fields['categories_name'] . ".jpg";
    $filename = '/path/to/' . $cat_image;


    if (file_exists($filename)) {
    $cat_image = $categories->fields['categories_name'] . ".jpg";
    } else {
    $cat_image = "pixel_trans.gif";
    }

    if (!$categories->fields['categories_image']) !$categories->fields['categories_image'] = $cat_image;


    You could use this code in your category_row.php - This looks for a image matching the categories name - if the file exists it will show it....

    /path/to/ - should be same as what is in your config files
    Last edited by WebMC; 21 Aug 2010 at 05:13 PM.

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

    Default Re: Automatically populate category images from their product images

    instead of /path/to

    $filename = DIR_WS_IMAGES . $cat_image;

    more of a zen cart way..... no changes needed then

    not a fully grown solution to the problem but might be a quicker way to bulk upload category images, just make sure the category image you want to use matches the category name and have them in your image folder.
    Last edited by WebMC; 21 Aug 2010 at 05:26 PM.

 

 
Page 1 of 5 123 ... LastLast

Similar Threads

  1. valign category images and product images to bottom
    By litepockets in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 18 May 2010, 02:48 AM
  2. Displaying product images alongside category images?
    By dperis in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 5 Nov 2008, 12:14 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. Displaying Category Images instead of product images
    By Jongle in forum Customization from the Admin
    Replies: 6
    Last Post: 27 Aug 2008, 12:19 PM
  5. 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
  •