Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / Is this an error? - Product Type Music

Is this an error? - Product Type Music

Locked

Views: 1,102

Results 1 to 3 of 3
This thread is locked. New replies are disabled.
15 Nov 2008, 7:04 AM
#1
rwoody avatar

rwoody

Totally Zenned

Join Date:
Aug 2004
Location:
Fountain Hills, AZ
Posts:
476
Plugin Contributions:
0

Is this an error? - Product Type Music

I'm building a new product type and I'm using the existing product_type_music as my model. (version 1.38a)

In coding all the pages, I've come down to the last couple that I needed to modify and I stumbled on something that I never noticed before. In the past I've created new product types successfully but I did not use these files as a model.

In the two files, admin/record_artist.php and admin/music_genre.php, on or around lines 93, there is what looks like an incorrect reference - $manufacturer -

 $manufacturer = $db->Execute("select artists_image
                                        from " . TABLE_RECORD_ARTISTS . "
                                        where artists_id = '" . (int)$artists_id . "'");
          $image_location = DIR_FS_CATALOG_IMAGES . $manufacturer->fields['artists_image'];

If that is correct, can someone give me a bit of a programming logic explanation. I'm definitely not a Php guru, but that loses me. :blink:

Also further down in the code there are several references to: php manufacturer_inputs_string , which I would have thought should have beenphp record_artist_inputs_string or ```php
music_genre_inputs_string


Could someone clarify why the reference to manufacturer is in these two files?

Thanks a bunch

Ruth
15 Nov 2008, 7:57 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Is this an error? - Product Type Music

You forgot the $ in front of each of those.
Those are just variable names.
As long as they're used consistently where needed, they'll function just fine.

I suspect that when those scripts were written they were cloned from the manufacturer editing script, and thus you're seeing the similarities from there as leftovers that didn't get cleaned up with new names. Doesn't hurt the functionality though as long as they're consistent.

There'll be some tidying in the next major release.

15 Nov 2008, 8:09 AM
#3
rwoody avatar

rwoody

Totally Zenned

Join Date:
Aug 2004
Location:
Fountain Hills, AZ
Posts:
476
Plugin Contributions:
0

Re: Is this an error? - Product Type Music

I was just being a bit sloppy in my post (re the missing $ -its in my actual code), but since I am utilizing the manufacturers within my site and within the new product type, I'm concerned that could create issues.

There are a couple of other issues, such as mID, which refers back to the manufacturer's ID, but as you said as long as they are consistent they will work, but from a clean programming logic it isn't correct. I was just surprised as these are in the core files and for a moment, (being 1AM here) I thought I was losing it..LOL -

Just to make myself feel confident in my own logic, I just d/l the latest release of the Book Type (which by the way one must now be a detective to find as it's no longer in the d/ls section) and reviewed his code and it matched mine as far as logic goes.. so I'm happy now.

As I said I'm not a php guru so when I see core files done differently than what I am doing... I immediately doubt my own coding standards.

Thanks for being there as always!!

Ruth