Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / Showing category image as featured product image

Showing category image as featured product image

Locked

Views: 1,935

Results 1 to 6 of 6
This thread is locked. New replies are disabled.
15 Dec 2006, 4:03 PM
#1
lydiam avatar

lydiam

New Zenner

Join Date:
Dec 2006
Posts:
4
Plugin Contributions:
0

Showing category image as featured product image

The site I am working on is at http://s142103556.websitehome.co.uk/.
As you can see it is being used to sell mobile phones. Due to the fact that each phone has a large number of deals, which each cost different ammounts I have decided to make each phone into a sub-category.
I would like to show some of these phones on the front page, I have been trying to edit the Featured Products, listing to make this possible.

The main problem is that currently the product image (just the network logo) is being shown rather than the phone image.
I have tried to do this by replacing:

zen_image(DIR_WS_IMAGES . $featured_products->fields['products_image'], $featured_products->fields['products_name'], 
```with
```php
zen_image(DIR_WS_IMAGES . $categories->fields['categories_image'], $categories->fields['categories_name'], 
```but that only worked on pages where the image had already appeared.

Could someone please give me the db query so that $categories is defined correctly.

Thanks,
Lydia
15 Dec 2006, 6:23 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Showing category image as featured product image

The images named orange.jpg and O2.jpg are images the you must have uploaded as the product image.

Don't hack the code - upload the correct image for the product.

16 Dec 2006, 10:46 AM
#3
lydiam avatar

lydiam

New Zenner

Join Date:
Dec 2006
Posts:
4
Plugin Contributions:
0

Re: Showing category image as featured product image

But on the category page I still want to see the network provider logos, so visitors can easily see which provider each deal is from.

16 Dec 2006, 4:48 PM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Showing category image as featured product image

Add these plan images as additional images by renaming a copy if the image with the phone image name followed by a sffix of _1 & _2 etc

This way you can easily remove a plan logo when this changes by removing it's image

18 Dec 2006, 9:50 AM
#5
lydiam avatar

lydiam

New Zenner

Join Date:
Dec 2006
Posts:
4
Plugin Contributions:
0

Re: Showing category image as featured product image

Err sorry but I don't really see how that will help.

18 Dec 2006, 10:52 AM
#6
lydiam avatar

lydiam

New Zenner

Join Date:
Dec 2006
Posts:
4
Plugin Contributions:
0

Re: Showing category image as featured product image

Never mind I have now managed it. The queries needed to be changed to

if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
  $featured_products_query = "select distinct p.products_id, p.products_image, pd.products_name, c.categories_image, cd.categories_name
                           from (" . TABLE_PRODUCTS . " p
                           left join " . TABLE_FEATURED . " f on p.products_id = f.products_id 
                           left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id
                           
                           left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on p.products_id = p2c.products_id
                           left join " . TABLE_CATEGORIES_DESCRIPTION . " cd on p2c.categories_id = cd.categories_id),
                   
                           " . TABLE_CATEGORIES . " c
                           
                           where p.products_id = p2c.products_id
                           and p2c.categories_id = c.categories_id
                           and p.products_id = f.products_id and p.products_id = pd.products_id and p.products_status = 1 and f.status = 1 and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";
} else {
  $featured_products_query = "select distinct p.products_id, p.products_image, pd.products_name, c.categories_image, cd.categories_name
                           from (" . TABLE_PRODUCTS . " p
                           left join " . TABLE_FEATURED . " f on p.products_id = f.products_id
                           left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id 
                           
                           left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on p.products_id = p2c.products_id
                           left join " . TABLE_CATEGORIES_DESCRIPTION . " cd on p2c.categories_id = cd.categories_id),
                   
                           " . TABLE_CATEGORIES . " c
                           where p.products_id = p2c.products_id
                           and p2c.categories_id = c.categories_id
                           and c.parent_id = '" . (int)$new_products_category_id . "'
                           and p.products_id = f.products_id and p.products_id = pd.products_id and p.products_status = 1 and f.status = 1 and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";

}