Forums / Templates, Stylesheets, Page Layout / How to display artist name in product listing?

How to display artist name in product listing?

Locked

Views: 3,413

Results 1 to 19 of 19
This thread is locked. New replies are disabled.
9 Apr 2008, 5:23 AM
#1
shen avatar

shen

New Zenner

Join Date:
Nov 2007
Posts:
30
Plugin Contributions:
0

How to display artist name in product listing?

I have an online music shop (http://ethnosuperlounge.com/eslshop)

I would like to display the artist name with each product in the product listings, but can't find how to do it. I have used the Music Product Type.

9 Apr 2008, 1:27 PM
#2
fantasticals avatar

fantasticals

New Zenner

Join Date:
Mar 2007
Location:
Cheshire
Posts:
73
Plugin Contributions:
0

Re: How to display artist name in product listing?

If you are using the music product type is it not just a case of defining all the artist names (extras/record artists) and then selecting them from the drop down box when you add a new product.

9 Apr 2008, 1:33 PM
#3
shen avatar

shen

New Zenner

Join Date:
Nov 2007
Posts:
30
Plugin Contributions:
0

Re: How to display artist name in product listing?

You would think so, however I have done that and as you can see on my website, artist name is not displayed.

9 Apr 2008, 4:11 PM
#4
fantasticals avatar

fantasticals

New Zenner

Join Date:
Mar 2007
Location:
Cheshire
Posts:
73
Plugin Contributions:
0

Re: How to display artist name in product listing?

I take it you have set the following to true in your admin panel:

Catalog/product types/Product - Music/Show Artist

10 Apr 2008, 12:09 AM
#5
shen avatar

shen

New Zenner

Join Date:
Nov 2007
Posts:
30
Plugin Contributions:
0

Re: How to display artist name in product listing?

That causes the artist to be displayed on each music product's specific page, but not on product listing pages.

14 Apr 2008, 12:23 PM
#6
shen avatar

shen

New Zenner

Join Date:
Nov 2007
Posts:
30
Plugin Contributions:
0

Re: How to display artist name in product listing?

So does anyone have any ideas on this?

6 May 2008, 12:58 AM
#7
shen avatar

shen

New Zenner

Join Date:
Nov 2007
Posts:
30
Plugin Contributions:
0

Re: How to display artist name in product listing?

Hello, can anyone please help?

24 May 2008, 5:09 AM
#8
loungeboy avatar

loungeboy

New Zenner

Join Date:
May 2008
Posts:
2
Plugin Contributions:
0

Re: How to display artist name in product listing?

I've been scouring the threads too for an answer....

14 Nov 2008, 3:44 PM
#9
shen avatar

shen

New Zenner

Join Date:
Nov 2007
Posts:
30
Plugin Contributions:
0

Re: How to display artist name in product listing?

Hi there,
Still hoping for leads on this one...
Can anyone give me some pointers as to how to go about coding this?

14 Nov 2008, 5:00 PM
#10
shen avatar

shen

New Zenner

Join Date:
Nov 2007
Posts:
30
Plugin Contributions:
0

Re: How to display artist name in product listing?

Mmm... I seem to have cracked it!

I copied new_products.php to includes/modules/custom/new_products.php (where custom is my template)
and modified it to include artist name where relevant.

Here's the new file:

<?php
/**

  • new_products.php module
  • @package modules
  • @copyright Copyright 2003-2006 Zen Cart Development Team
  • @copyright Portions Copyright 2003 osCommerce
  • @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
  • @version $Id: new_products.php 4629 2006-09-28 15:29:18Z ajeh $
    */
    if (!defined('IS_ADMIN_FLAG')) {
    die('Illegal Access');
    }
    // display limits
    //$display_limit = zen_get_products_new_timelimit();
    $display_limit = zen_get_new_date_range();

// get artist name info
$artists_array = array(array('id' => '', 'text' => TEXT_NONE));
$artists = $db->Execute("select artists_id, artists_name
from " . TABLE_RECORD_ARTISTS);
while (!$artists->EOF) {
$artists_array[] = array('id' => $artists->fields['artists_id'],
'text' => $artists->fields['artists_name']);
$artists->MoveNext();
}

// get product info
if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
$new_products_query = "select p.products_id, p.products_image, p.products_tax_class_id, p.products_price, p.products_date_added, pe.artists_id
from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCT_MUSIC_EXTRA . " pe
where p.products_id = pe.products_id and p.products_status = 1 " . $display_limit;
} else {
$new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, p.products_date_added,
p.products_price, pe.artists_id
from " . TABLE_PRODUCTS . " p
left join " . TABLE_SPECIALS . " s
on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " .
TABLE_CATEGORIES . " c, " . TABLE_PRODUCT_MUSIC_EXTRA . " pe
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 = pe.products_id
and p.products_status = 1 " . $display_limit;
}
$new_products = $db->ExecuteRandomMulti($new_products_query, MAX_DISPLAY_NEW_PRODUCTS);

$row = 0;
$col = 0;
$list_box_contents = array();
$title = '';

$num_products_count = $new_products->RecordCount();

// show only when 1 or more
if ($num_products_count > 0) {
if ($num_products_count < SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS == 0 ) {
$col_width = floor(100/$num_products_count);
} else {
$col_width = floor(100/SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS);
}

while (!$new_products->EOF) {

$products_price = zen_get_products_display_price($new_products->fields['products_id']);

$new_products->fields['products_name'] = zen_get_products_name($new_products->fields['products_id']);
$list_box_contents[$row][$col] = array('params' => 'class="centerBoxContentsNew centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
'text' => (($new_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'products_id=' . $new_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT) . '</a><br />') . (($new_products->fields['artists_id'] == '') ? '' : $artists_array[$new_products->fields['artists_id']]['text'] . '<br />') . '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'products_id=' . $new_products->fields['products_id']) . '">' . $new_products->fields['products_name'] . '</a><br />' . $products_price);

$col ++;
if ($col > (SHOW_PRODUCT_INFO_COLUMNS_NEW_PRODUCTS - 1)) {
  $col = 0;
  $row ++;
}
$new_products->MoveNextRandom();

}

if ($new_products->RecordCount() > 0) {
if (isset($new_products_category_id) && $new_products_category_id != 0) {
$category_title = zen_get_categories_name((int)$new_products_category_id);
$title = '<h2 class="centerBoxHeading">' . sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')) . ($category_title != '' ? ' - ' . $category_title : '' ) . '</h2>';
} else {
$title = '<h2 class="centerBoxHeading">' . sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')) . '</h2>';
}
$zc_show_new_products = true;
}
}
?>

NB The part which actually outputs the artist name is

. (($new_products->fields['artists_id'] == '') ? '' : $artists_array[$new_products->fields['artists_id']]['text'] . '<br />')

(in case you want to add a span tag or something)

15 Jun 2009, 7:26 AM
#11
exoticcorpse avatar

exoticcorpse

New Zenner

Join Date:
Jan 2008
Posts:
35
Plugin Contributions:
0

Re: How to display artist name in product listing?

Thanks for this... I was able to get the artist to display in the 'What's New' box easily using your solution... however, getting the artist to display on the product listing pages is a different beast all together. Is anyone able to offer any advice on how to achieve this?

15 Jun 2009, 8:05 PM
#12
traderdan avatar

traderdan

New Zenner

Join Date:
Jan 2008
Location:
Essex, MA
Posts:
41
Plugin Contributions:
0

Re: How to display artist name in product listing?

I am trying to do the same exact thing. Would LOVE some help on this issue.

Thanks,
-Dan

15 Jun 2009, 10:41 PM
#13
exoticcorpse avatar

exoticcorpse

New Zenner

Join Date:
Jan 2008
Posts:
35
Plugin Contributions:
0

Re: How to display artist name in product listing?

It's odd that this hasnt been resolved previously as it's pretty much essential if you want to utilise the music product type effectively... anyone?

27 Jun 2009, 6:27 PM
#14
bgallagher avatar

bgallagher

New Zenner

Join Date:
Feb 2008
Posts:
41
Plugin Contributions:
0

Re: How to display artist name in product listing?

It does seem strange that there seems to be little info about how to display information from the products_description table on the products listing pages. NOT the products info page(zen does that for you) ----
I've been searching for info on how to accomplish this. Is there a thread for this already? if so please link it. I've had no luck.

28 Jun 2009, 8:48 PM
#15
traderdan avatar

traderdan

New Zenner

Join Date:
Jan 2008
Location:
Essex, MA
Posts:
41
Plugin Contributions:
0

Re: How to display artist name in product listing?

Hey All-

I've made some real progress on this issue that, although isn't an ideal solution, works out rather well. So far I am very pleased with the end result. Take a look at my product listings and if anyone likes what they see I will be happy to share my methods.....

http://www.villageproduce.com/Store/

Cheers,
-Dan

29 Jun 2009, 4:38 AM
#16
exoticcorpse avatar

exoticcorpse

New Zenner

Join Date:
Jan 2008
Posts:
35
Plugin Contributions:
0

Re: How to display artist name in product listing?

Look good Dan, please share?

29 Jun 2009, 5:17 AM
#17
traderdan avatar

traderdan

New Zenner

Join Date:
Jan 2008
Location:
Essex, MA
Posts:
41
Plugin Contributions:
0

Re: How to display artist name in product listing?

OK, the basic concept is as follows...

(1) I made it so that the product listing index would not strip out the product description HTML. This way, any HTML that I included in the actual description would also show up on the index listing. There is more info on how to do this here: http://www.zen-cart.com/forum/showthread.php?t=126373&highlight=product+listing+html

(2) In each of my product descriptions, I manually added the artist name and link, all assigned with a class that I defined in my CSS. So the first handful of lines in my product description, for example, would look something like this:

<p class="extraLabel">Artist: <a title="View all products by this artist" href="http://www.villageproduce.com/Store/index.php?typefilter=artist&artists_id=1">Ryan Montbleau Band</a></p>

<p class="productYear">(Oct. 2007)</p>

The band returned to a little farm in Woodstock.....

(3) Finally, under Admin --> Configuration --> Product Listing, I set the 'Display Product Description' attribute to 600. Depending on how much HTML you put up front in your descriptions though, you will want to adjust this accordingly.

This is definitely not a clean, automated solution that easily updates all of your products... quite the contrary. It is very manual, but if you don't have a lot of products, then it's a reasonable workaround, and the end result is quite attractive in my opinion.

Hopefully that helps, but if you need more in-depth help I will do my best to assist. Please bare in mind though that I'm quite new to ZC, though I've been designing and coding for nearly 10 years now.

Good luck~!
-Dan

5 Dec 2010, 4:50 AM
#18
pianojoe avatar

pianojoe

New Zenner

Join Date:
Nov 2010
Posts:
6
Plugin Contributions:
0

Re: How to display artist name in product listing?

I've used a similar approach, hacking all pages where the product title appears, to include the artists name as well. This sums up to 11 pages, and counting. Even though I'm a fan of the override system, upgrading will be a nightmare when 1.3.9i hits the streets.

This is such an obvious thing, it needs to be resolved from above!

5 Dec 2010, 5:16 AM
#19
pianojoe avatar

pianojoe

New Zenner

Join Date:
Nov 2010
Posts:
6
Plugin Contributions:
0

Re: How to display artist name in product listing?

The big advantage of having the artist's name seperate in the first place: You could use a different typeface, and you could link the artist's name to his category.

On the other hand, if it doesn't seem worth the effort, what about adding the artist to the product name in the first place? Like, instead of naming your product "The Dark Side Of the Moon", just name it "The Dark Side Of the Moon (Pink Floyd)". Anyone done this? How do you feel about it?