Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2019
    Location
    Boulder City NV
    Posts
    2
    Plugin Contributions
    0

    Default Create custom fields for Products for Admins only

    Hi. I created a duplicate store in a private location. This is my playground.

    In my playground, i created a child table for Products by copying the products_description child table to products_suppliers and modifying the structure. I dropped two (2) fields and inserted nine (9) new fields, designed to contain Supplier data. I want these fields to be available to the Admin when he adds or edits a product, but they will not appear to the shopper on the front end.

    Which PHP scripts must I create or edit to make this happen?

    Thank you.

  2. #2
    Join Date
    Jul 2012
    Posts
    16,734
    Plugin Contributions
    17

    Default Re: Create custom fields for Products for Admins only

    Quote Originally Posted by SwissArmyKnife View Post
    Hi. I created a duplicate store in a private location. This is my playground.

    In my playground, i created a child table for Products by copying the products_description child table to products_suppliers and modifying the structure. I dropped two (2) fields and inserted nine (9) new fields, designed to contain Supplier data. I want these fields to be available to the Admin when he adds or edits a product, but they will not appear to the shopper on the front end.

    Which PHP scripts must I create or edit to make this happen?

    Thank you.
    Its been nearly a week since this was posted and it appears that no support has been offered related to this request.

    So, some basics to try to help you at least identify where changes are needed:
    The existence of data in the database does not mean that the data will be readily accessible by customers visiting the site. Think about all of the tables and records that are present in a standard database, all information doesn't just get magically displayed to the product information page. It takes code to get there. Also, just because data is in the database, doesn't mean that admins have ready access to the data.

    So, basically, whatever fields you add/create to whatever database table will not be visible to customers without some level of code to make them visible, and the that same thing is true for the admin side.

    So, these new tables with associated fields you have created, that data will not be readily available to customers until you code to make that data available.

    As for admins, well, your question is in direct relationship about how to make these fields accessible to that admins and then once accessible, how to be updateable.

    You have multiple means by which to do this; however, the most "straightforward" is for the product related information to appear in relation to the product in question.

    This is usually through the product information page. Now, if you only use one product type (product) which tends to be the default product type, then basically you will only need to worry about one "set" of files found in and below this directory:
    YOUR_ADMIN/includes/modules/

    In sequence, the files in question tend to be:
    product/collect_info.php
    product/preview_info.php
    and
    update_product.php

    Now, that said, there are some other things to consider within that modules directory: how should the system respond when copying product, moving product, deleting product, etc...

    I'm sure there is an entire help file on product and data collection, but the above three files (two in the modules/product sub-directory and one in the modules sub-directory) are at the base of input/output of the desired data.

    Now, even with these three files, there are notifiers within the files that allow you to use an observer to interact instead of modifying those files... Moving away from file modification is an ideal situation for you and all. Basically, if you can get the operations you need without modifying a file, then ideally the next new version that comes along can be updated *around* your code instead of in addition to updating your code... That is at least if the modifications of the core code are made with that in mind.

    Even if the core code updates cause a problem with your code then, update and development on other than your live site will prevent disruption of your income... Yes, that means somewhat having two websites (one development, one operational) but that also means you can make mistakes without affecting your income.

    Anyways, a lot of words to say the above, but hopefully has either guided you to your goal or perhaps duplicated what you have already found.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,591
    Plugin Contributions
    30

    Default Re: Create custom fields for Products for Admins only

    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

  4. #4
    Join Date
    Jul 2012
    Posts
    16,734
    Plugin Contributions
    17

    Default Re: Create custom fields for Products for Admins only

    Oh, and I just realized it's a good thing I didn't reference you to the generic 158 github.com code branch. Seems that between the code developers and maintainers they still haven't figured out the immediate direction they are headed.

    Not too long ago the statement was that 1.5.8 was stopping at revision 'a' and the next release was going to be some other number, hinting at version 2. But, today as I was about to reference code and files from the "abandoned" working copy branch of 158, I found that back in July the above mentioned files have been removed/ relocated. Basically, placement in the admin/includes/modules/product directory would work like a template override. The version of the files in admin/includes/modules is the base version. There's a text file in the override directory offering instruction on the concept.

    Anyways, sorry for any false direction previously provided based on making this discovery. It's certainly going to be fun to do an upgrade to whatever comes next. I do know that here and there meaningful ways of incorporating trigger points to modify site operation have been incorporated, suggested and in some cases accepted. Ideally all things essential for a site would be drop and (securely) run. As said, you should be able to do that with what you are seeking.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #5
    Join Date
    Apr 2019
    Location
    Boulder City NV
    Posts
    2
    Plugin Contributions
    0

    Default Re: Create custom fields for Products for Admins only

    Thank you, Totally Zenned. I was able to insert fields into the _products table and edit the 3 "files in question". The store owner doesn't copy or move products around; he is happy with the results.

 

 

Similar Threads

  1. v150 how to create a custom form page for only registered users?
    By buhebutler in forum General Questions
    Replies: 6
    Last Post: 4 Apr 2013, 01:08 PM
  2. How can i create custom center box, for home page only?!?
    By tcarden in forum Customization from the Admin
    Replies: 2
    Last Post: 7 Dec 2012, 07:05 PM
  3. adding custom fields for products
    By jagall in forum Setting Up Categories, Products, Attributes
    Replies: 19
    Last Post: 24 Apr 2011, 09:52 PM
  4. Replies: 5
    Last Post: 14 Jan 2009, 05:47 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR