Zen Cart Logo
Forums / General Questions / Add multiple artists to a product?

Add multiple artists to a product?

Views: 888

Results 1 to 7 of 7
17 Apr 2011, 5:54 AM
#1
nadiausa avatar

nadiausa

New Zenner

Join Date:
Sep 2008
Location:
Los Angeles, CA
Posts:
82
Plugin Contributions:
0

Add multiple artists to a product?

Hi Everyone,

How do I associate multiple artists to a product. The admin product page has a drop down box for artist when making the download music product but only allows a single selection.

Any way to modify the drop down to accept multiple artist associations.

I am making a site for my films and want to use that field for the cast.

Thanks,
Nadia

17 Apr 2011, 6:17 AM
#2
nadiausa avatar

nadiausa

New Zenner

Join Date:
Sep 2008
Location:
Los Angeles, CA
Posts:
82
Plugin Contributions:
0

Re: Add multiple artists to a product?

I see a file in admin/includes/modules/product_music/collect_info.php

The code is line 147 to 161 as follows:

$artists_array = array(array('id' => '', 'text' => TEXT_NONE));

    $artists = $db->Execute("select artists_id, artists_name

                                   from " . TABLE_RECORD_ARTISTS . " order by artists_name");

    while (!$artists->EOF) {

      $artists_array[] = array('id' => $artists->fields['artists_id'],

                                     'text' => $artists->fields['artists_name']);

      $artists->MoveNext();

    }

Can this be modified to allow for multiple artist selections?

Nadia

17 Apr 2011, 6:32 AM
#3
nadiausa avatar

nadiausa

New Zenner

Join Date:
Sep 2008
Location:
Los Angeles, CA
Posts:
82
Plugin Contributions:
0

Re: Add multiple artists to a product?

And then more relevant code on line 613 through 619 as follows

<td class="main"><?php echo TEXT_PRODUCTS_RECORD_ARTIST; ?></td>

           <td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . ' ' . zen_draw_pull_down_menu('artists_id', $artists_array, $pInfo->artists_id); ?></td>

         </tr>

         <tr> 

Would I have to set up separate fields for

artist 1, artist 2, artist 3, artist 4, artist 5, artist 6, artist 7

Nadia

17 Apr 2011, 7:04 AM
#4
nadiausa avatar

nadiausa

New Zenner

Join Date:
Sep 2008
Location:
Los Angeles, CA
Posts:
82
Plugin Contributions:
0

Re: Add multiple artists to a product?

OK, so I duplicated lines 613 to 619 in the collect_info.php page.

The admin new music product creation page now shows 2 artist drop down boxes.

However, it only assigns the last box choice as the single artist upon updating.

Thats because the code assigns your selection to artist_id.

$pInfo->artists_id

So I have to change the duplicated code to end with something like:
$pInfo->artists_id2

But there is no dtabase field to store that. So how do I make a database field for artist_id2 and reference it to the databases artist_id. You see, it has to have artist_id as a related key because thats how it gets info from the artist.

I see in myphp admin there is a table called zen_product_music_extra. it contains the fields:
products_id
artists_id
recordcompany_id
music_genre_id

Should I try putting artist_id2 in there?

Nadia

18 Apr 2011, 4:17 AM
#5
nadiausa avatar

nadiausa

New Zenner

Join Date:
Sep 2008
Location:
Los Angeles, CA
Posts:
82
Plugin Contributions:
0

Re: Add multiple artists to a product?

Well it seems there are multiple pages that need to be modified such as:

admin/includes/modules/product_music/collect_info.php
Lines 613 to 619 and 147 to 161

includes/templates/template_default/templates/tpl_product_music_info_display.php
line 245
*copied to yout template folder

includes/modules/pages/product_misic_info/main_template_vars_product_type.php
lines 61, 125 and 137

includes/modules/pages/product_misic_info/main_template_vars.php
line 359

I'm not exactly sure of how to bst modify these. Ideally I could pull from the database the artists_id ten times and assign 10 different variables such as:
artist_id_1
artist_id_2
artist_id_3
artist_id_4
artist_id_5
artist_id_6
artist_id_7
artist_id_8
artist_id_9
artist_id_10

Then I could echo each them on the product info page aside the label "The Artists".

Any experts out there with the proper syntax for this?

Nadia

18 Apr 2011, 4:09 PM
#6
dw08gm avatar

dw08gm

Totally Zenned

Join Date:
Sep 2008
Location:
DownUnder, overlooking South Pole.
Posts:
1,016
Plugin Contributions:
2

Re: Add multiple artists to a product?

Hi Nadia

You pose an interesting problem that I suspect I may need answered in the near future. Unfortunately you are so far ahead of me that I cannot offer any help other than encouragement to perservere in the face of no reply.

Nevertheless, the Product Type Book (by moku) thread may give you some insight, or even an answer, as I am sure the subject of co-authors has been discussed therein.

http://www.zen-cart.com/forum/showthread.php?t=35389

Cheers

16 Jan 2013, 1:36 AM
#7
jbible avatar

jbible

New Zenner

Join Date:
Apr 2008
Posts:
60
Plugin Contributions:
0

Re: Add multiple artists to a product?

Going to tackle this soon. Rather easy to do manually directly through the database but would be nice to have it integrated with admin somehow.