Numinix Extra Fields to Product Page on Storefront
I've installed the Numinix Extra Fields add-on and was successful in getting the extra fields to appear in the admin product creation page. I opened the shop's database and have seen a sample extra field in it that was created with the Numinix Extra Fields application.
The problem I'm having at this point is that the field's values are not writing to the database.
When I return to the product creation page, the values I entered previously do not appear either (apparently because they were never really written to the DB).
I spent several hours trying to get the data to show up on the product page in the store, only to later find there was never any data in the DB to display. This has become a real mess. Perhaps I need a developer more than I need an answer to this DB problem. Either would be appreciated. Thank you.
Re: Numinix Extra Fields to Product Page on Storefront
Sorry, I should have titled the thread "Numinix Extra Fields problem writing to database."
Unfortunately I'm not even close to the "Numinix Extra Fields to Product Page on Storefront" problem yet.
Re: Numinix Extra Fields to Product Page on Storefront
I found the solution to this problem... get away from this add-on!
I've read many threads about it of others trying to face problems every step of the way. I'm having all of the same problems, and there are few solutions (if any) to be found in the forums.
In my case it didn't create new fields in the Music product type. When I finally got it to show new fields in the admin's music product creation page, it wasn't writing to the database (nor retaining data previously entered - I assume the same problem).
At the rate I'm going it will be too long and too much frustration before I even see a field value show up on a store product page. I've gotten basically nowhere in four days of trying to make t work.
I also found that Numinix Extra Fields offers no easy way to remove a field once it's been created. Additionally, it offers the option of creating various fields to work with other modifications that I don't even need.
So in some regards it doesn't do what I need (remove a created field created with Numinix Extra Fields, offer the option to display field values on a store's product page). In other regards it offers too much (I don't need the fields the add-on offers, nor do I need the new fields in product types other than music).
It seems like too many headaches for something that isn't exactly what I want. Scrapped it and reverted to backups.
All I really want are some extra fields in the Product - Music type (much like the music specific fields of Recording Artist, Record Company, and Music Genre already included in Product - Music) that show up on the store's product pages as well.
It seems as if modifying the Product - Music type to add the fields I want would be a better option than the add-on.
Is there a way to do that which isn't so complicated and confusing?
Thank you
Re: Numinix Extra Fields to Product Page on Storefront
in answer to your question... no. adding fields to a product type can be a lot of work.
some things that need to get done:
- add fields to the database
- modify the admin side to display those fields and update them
- modify the catalog side (includes/classes/products) to get those fields from the database
- modify your template to display them
those are just the things off the top of my head.
if you are not very savvy with ZC, it can be a bear to get everything working just the way you like it.
good luck!
Re: Numinix Extra Fields to Product Page on Storefront
Is there a page that explains adding fields to the database? Can it be done manually with MyPhpAdmin?
I think I can duplicate all of the stuff on the store side by following exactly what the Recording Artist field does in the Product - Music type.
The Recording Artist field currently works in the same manner I want the new field to work. So all I need is another one like it.
But I don't know where to begin to make the necessary changes to the database.
Any suggestions? Even a point in the right direction would be greatly appreciated. Thank you.
Re: Numinix Extra Fields to Product Page on Storefront
it can be done manually. there are many ways to handle this.... you can either add new fields to an existing table or create a new table. each way has its pluses and minuses...
i think the key thing is to have a test server so that you can play without fear of screwing up your live website.
in any event, i would review the following 2 links, to give you a bit of an idea about what to do:
https://www.thatsoftwareguy.com/zenc...ble_field.html
https://www.zen-cart.com/showthread....Product-Fields
best.
Re: Numinix Extra Fields to Product Page on Storefront
Thank you. I will review those links and read up on altering the database.
I use a second copy of ZC in a separate directory for testing, and make backups of the store and database of the test shop before attempting any changes.
I was able to make changes in the Product - Music product type, but got an error on my music product store pages (but not on general products pages) and got a white page on my admin music product product creation pages (but not on general products). I think this may have been due to not having the database table (called TABLE_MEDIA_FORMAT) set up before the store attempted to utilize them. Anyway, I took the errors being music specific to be a good sign that I was heading in the right direction.
I think setting up the database is the biggest part of the problem here.
Re: Numinix Extra Fields to Product Page on Storefront
Quote:
Originally Posted by
Joseph M
Thank you. I will review those links and read up on altering the database.
I use a second copy of ZC in a separate directory for testing, and make backups of the store and database of the test shop before attempting any changes.
I was able to make changes in the Product - Music product type, but got an error on my music product store pages (but not on general products pages) and got a white page on my admin music product product creation pages (but not on general products). I think this may have been due to not having the database table (called TABLE_MEDIA_FORMAT) set up before the store attempted to utilize them. Anyway, I took the errors being music specific to be a good sign that I was heading in the right direction.
I think setting up the database is the biggest part of the problem here.
in my experience the database part is the easiest part... your experience may differ....
setting up a db table requires the name being put into:
includes/database_tables.php
else what i like to do as much as possible is set up a new file (including any new table defines):
includes/extra_datafiles/my_mods.php
and keep as MUCH as possible in there. that would include all defines, any new functions, etc.... it will make it easier come time to upgrade...
in addition, i am NOT a fan of 2 different defines for admin as well as catalog side. so once you set up the above file, i like to make all of those things accessible from the admin side. you can do that by adding another new file:
YOUR_ADMIN/includes/auto_loaders/config.my_mods.php
and within there add:
PHP Code:
<?php
$autoLoadConfig[200][] = array(
'autoType' => 'require',
'loadFile' => DIR_FS_CATALOG . DIR_WS_INCLUDES . 'extra_datafiles/my_mods.php'
);
hope that helps get you started!
best.
Re: Numinix Extra Fields to Product Page on Storefront
That's a lot to digest for a beginner. But it did get me going in a good direction.
includes/database_tables.php doesn't seem to have any of the specific references to the Product - Music type. Would the changes be made in includes/extra_datafiles/music_type_database_names.php ?
I did add to that file:
Code:
define('TABLE_MEDIA_FORMAT', DB_PREFIX . 'media_format');
define('TABLE_MEDIA_FORMAT_INFO', DB_PREFIX . 'media_format_info');
But it had no effect on my database that I could see.
I followed the 1st instruction at https://www.thatsoftwareguy.com/zenc...ble_field.html and through Admin->Tools->Install SQL Patches entered the query
Quote:
ALTER TABLE products ADD MEDIA_FORMAT tinyint(1) default '0' NOT NULL;
I can now see
Quote:
`MEDIA_FORMAT` tinyint(1) NOT NULL DEFAULT '0'
in the database when I search for "MEDIA_FORMAT."
Also I had existing products in my shop. Does that mean I have to prepare the database further before it is usable?
Re: Numinix Extra Fields to Product Page on Storefront
joseph,
i appreciate that you are a beginner and that you are trying to follow along....
so, please TRY and keep everything in the new file that i referenced above. you will thank me in the long run.
setting up DEFINE will do NOTHING to the database. what it allows you to do is use the TABLE_MEDIA_FORMAT in your code as a constant as you progress along.
in your example above, you have set up 2 tables in the defines for potential use which is definitely NOT what you want to do. you have a choice to make, you can either add more fields to an existing table or add those fields to your new table.
you should do some reading up on databases and tables and fields.... it is very basic stuff....
after that you have altered an EXISTING table called products to have an additional field which is called media_format. that field is tinyint, which can store 256 integers.
as this is a format for your media type, i would guess 256 would be enough; but you would then need to maintain another table so that you can know that integer 1 for example might be MP3, while integer 2 could be a cassette, etc. or you could build that validation into the table already by use of the enum type as opposed to tinyint. you can read about the enum type here:
https://dev.mysql.com/doc/refman/8.0/en/enum.html
but as you can see, you may be quickly getting deeper and deeper into coding some thing custom which is why it is advisable to see if an existing plug-in could do 85% of what you want it to do and then add some of the coding for the remaining 15%.
best.
Re: Numinix Extra Fields to Product Page on Storefront
Quote:
you should do some reading up on databases and tables and fields.... it is very basic stuff....
So that's where I started. In my case video tutorials on the basics of databases, tables, and using phpMyAdmin.
I was able to insert the table and use ZC's error logs to guide me after I started getting errors. So far, I've been successful at adding the new field to my music product creation page; and the values of the new field (with which I populated the new table) show in the associated drop-down menu.
I'd like to be able to populate that table via the Extras Admin Menu, however the new field doesn't appear there. I know with the introduction of ZC 1.5.0 the method for doing so has changed. I've reviewed https://www.zen-cart.com/content.php...e-v1-5-0-admin but still don't quite understand. After I get the "Media Format" option in the Admin Extras menu, and get the values to show on store pages, I should be able to call this modification complete.
Quote:
so, please TRY and keep everything in the new file that i referenced above. you will thank me in the long run.
I recognize the value in keeping ZC as upgrade friendly as possible. For now, I'm doing all of my work on a test site and keeping good backups as I go along. Just getting this to work (anyway I can) will be a major milestone for me. I plan to set up a fresh test site after this and implement your suggestion above. Due to the addition of previous modifications and add-ons (and all of the experimentation and guesswork that went along with trying to install them), I have some pretty sloppy files and file structures in my ZC. So a fresh start at a clean, upgrade friendly ZC will likely be justified. Thank you.