Results 1 to 10 of 29

Hybrid View

  1. #1
    Join Date
    Apr 2011
    Posts
    91
    Plugin Contributions
    0

    Default Re: v151 New / Custom Extra Product Fields

    Actually I wrote 2009 (webego thread), but I was thinking of 2007 (crazy_chris thread). I decided not to try the numinix, and instead edited files... WITHOUT complete success, but some success. Here is what I did so far:

    http://www.zen-cart.com/showthread.p...-your-Products
    http://www.zen-cart.com/showthread.p...y-listing-page


    THE SHORT LIST:

    1.Admin>Tools>Install SQL Patches
    ALTER TABLE `products` ADD `products_newfield` TEXT;

    2. Edit "/admin/includes/modules/product/collect_info.php".

    2a. After "$parameters = array", add to list with others:
    'products_newfield' => '',

    2b. After "$product = $db->Execute("select"," , add to list with others:
    p.products_newfield

    2c. Add the input fields in the product-mask, in area with other add:

    <tr>
    <td class="main"><?php echo TEXT_PRODUCT_NOTES; ?></td>
    <td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . zen_draw_input_field('products_newfield', $pInfo->products_newfield); ?></td>
    </tr>
    <tr>
    <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
    </tr>

    3. Edit "/admin/includes/modules/product/preview_info.php"

    After "$product = $db->Execute("select", add to list with others:
    p.products_newfield

    4. Edit "/admin/includes/modules/update_product.php"
    After "$sql_data_array = array(", add to list with others:
    'products_newfield' => zen_db_prepare_input($_POST['products_newfield']),

    QUESTION QUESTION for #4: Shoud I also add after "// Data-cleaning to prevent MySQL5 data-type mismatch errors:" with the others:
    $tmp_value = zen_db_prepare_input($_POST['products_newfield']);
    $products_newfield = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;

    5. Edit "/includes/modules/pages/product_info/main_template_vars.php"

    After "$sql = "select", add to list with others:
    p.products_newfield

    Also added to the list with the others:
    $products_newfield = $product_info->fields['products_newfield'];


    Then also with the others after "// build show flags from product type layout settings", I added:

    $flag_show_product_info_newfield = zen_get_show_product_switch($_GET['products_id'], 'newfield');


    6. Edit "/includes/templates/MYTEMPLATE/templates/tpl_product_info_display.php

    <?php echo (($flag_show_product_info_newfield == 1) ? '<li>' . $products_notes . TEXT_PRODUCT_NEWFIELD . '</li>' : '') . "\n"; ?>

    QUESTION QUESTION #6: The above does not work (I see "(bullet point) 100.101TEXT_PRODUCT_NEWFIELD"), but below does:
    <!--bof product newfield -->
    <?php if ($products_newfield != '') {
    ?>
    <div class="productGeneral"><li>Newfield:<?php echo $products_newfield; ?></li></div>
    <?php
    }
    ?>
    <!--eof product newfield -->

    Also works:
    <?php if (!empty($product_info->fields['products_newfield'])) echo $product_info->fields['products_newfield']; ?>

    7. Edit "/includes/languages/english/YOUR_TEMPLATE/index.php"

    define('TABLE_HEADING_NEWFIELD', 'Newfield');

    8. Edit "/includes/modules/pages/index/main_template_vars.php

    (under "// create column list $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL,")
    'PRODUCT_LIST_NEWFIELD' => PRODUCT_LIST_NEWFIELD,

    case 'PRODUCT_LIST_NEWFIELD':
    $select_column_list .= 'p.products_newfield, ';
    break;

    9. Edit "/includes/modules/YOUR_TEMPLATE/product_listing.php", and add:

    case 'PRODUCT_LIST_NEWFIELD':
    $lc_text = TABLE_HEADING_NEWFIELD;
    $lc_align = '';
    $zc_col_count_description++;
    break;

    10. Edit "/includes/index_filters/default_filter.php", and add to "$select_column_list" (4 different times):

    p.products_newfield,

    case 'PRODUCT_LIST_NEWFIELD':
    $listing_sql .= " order by p.products_newfield " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
    break;


    11. Insert into configuration:

    ?????????????????????

    I messed up my table somehow. Basically what happened is that the thread listed:

    insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Display Product Newfield', 'PRODUCT_LIST_NEWFIELD, '4', 'Do you want to display the Product Newfield', 8, 5, now());

    BUT, I received an error, so I went into phpmyadmin, exported the configuration table as cvs, opened it in open office, inserted row around 212, copied and pasted similar row and edited it to "newfield", and imported the cvs into phpmyadmin (deleting original during the import).

    NOW I SEE THE NEWFIELD IN ADMIN, BUT in admin>configuration>product listing when I click on edit, no text box appears on the right. I can click on update, then the value changes from 3(3 for example) to blank ( for example) for ANY AND ALL in this admin>configuration>product listing area. Here's an example of a row from the cvs file:

    212,"Display Product Image","PRODUCT_LIST_IMAGE",1,"Do you want to display the Product Image?",8,1,"2014-07-03 07:51:01","2009-05-30 08:43:46","NULL","NULL"

    218,"Display Product Newfield","PRODUCT_LIST_NEWFIELD",3,"Do you want to display the Product Newfield?",8,7,"NULL","2009-05-30 08:43:46","NULL","NULL"

    So, that is a BIG problem.

    2nd problem, the product listing added the newfield, but like this when nothing is in that field for a product:

    0

    And like this when the value I entered is MEMEMEM:

    MEMEMEM

    So, 2nd issue really is to stop showing "0" when empty.

    And 3rd problem is that on the individual product page it shows:

    MEMEMEMTEXT_PRODUCT_NEWFIELD
    Last edited by stiggybaby; 4 Jul 2014 at 06:58 PM.
    Zen Cart 1.5.3, Database Patch Level: 1.5.3
    Server OS: Linux 2.6.32, Database: MySQL 5.5.41
    HTTP Server: Apache, PHP Version: 5.4.37

  2. #2
    Join Date
    Apr 2011
    Posts
    91
    Plugin Contributions
    0

    Default Re: v151 New / Custom Extra Product Fields

    Sorry, I was sooo involved in these file edits and trying to get zencart setup, that I completely forgot my manners...

    Thank you both bislewl, and balihr for your replies, and if you have any further direction in helping me out with any or part of the above, it would be greatly appreciated. PLUS, I really want to have a more complete thread on this issue with a FINALIZED 1.5.1 step-by-step so people don't have to google their way for days and days through tons and tons of posts, only to not get the issue solved.

    I've read about several other sellers, like myself, of different parts, where extra fields are an absolute MUST due to the type of product and customer needs.
    Zen Cart 1.5.3, Database Patch Level: 1.5.3
    Server OS: Linux 2.6.32, Database: MySQL 5.5.41
    HTTP Server: Apache, PHP Version: 5.4.37

  3. #3
    Join Date
    May 2006
    Location
    Gardiner, Maine
    Posts
    2,371
    Plugin Contributions
    23

    Default Re: v151 New / Custom Extra Product Fields

    Hmm, the apsona shop manager is free and is a lot easier to use than the ezpopulate. Fields added to the product table automatically get included.
    http://apsona.com/pages/ec/signup.html

    Additionally, I wrote the extra product fields mod - it uses a different table because it had the possibility of adding many fields and I wanted to keep that info separated out of the products table.

    I've thought about a new version since that one was actually written more to include a flash file on the product page and that's probably not happening anymore. At least I hope so.

    So perhaps it would be best to rewrite the mod to include upload maybe 2 PDFs (the other reason for the mod) and several text fields. Connect them to the product table instead and that would have solved your problem, correct?
    The full-time Zen Cart Guru. WizTech4ZC.com
    New template for 2.0 viewable here: 2.0 Demo

  4. #4
    Join Date
    Apr 2011
    Posts
    91
    Plugin Contributions
    0

    Default Re: v151 New / Custom Extra Product Fields

    Quote Originally Posted by delia View Post
    ...So perhaps it would be best to rewrite the mod to include upload maybe 2 PDFs (the other reason for the mod) and several text fields. Connect them to the product table instead and that would have solved your problem, correct?
    YES, YES, YES!!!!

    From what I have read from several dozen posts on the forum that would help ALL of us parts type of stores (plus have the extra fields searchable, so customers can find the part they need easily would be a big bonus too).
    Zen Cart 1.5.3, Database Patch Level: 1.5.3
    Server OS: Linux 2.6.32, Database: MySQL 5.5.41
    HTTP Server: Apache, PHP Version: 5.4.37

  5. #5
    Join Date
    May 2006
    Location
    Gardiner, Maine
    Posts
    2,371
    Plugin Contributions
    23

    Default Re: v151 New / Custom Extra Product Fields

    Searchable is a whole 'nother thing. Though maybe if this was all pulled into the product table, that would take care of itself.

    I'm updating the mod now for zc v1.5.3 but making a change like that in tables is major. I'm just going to upload this one with the small change and do another version that changes majorly. I'll let you know when I have a the fully revised mod ready.
    The full-time Zen Cart Guru. WizTech4ZC.com
    New template for 2.0 viewable here: 2.0 Demo

  6. #6
    Join Date
    Apr 2011
    Posts
    91
    Plugin Contributions
    0

    Default Re: v151 New / Custom Extra Product Fields

    Quote Originally Posted by delia View Post
    Searchable is a whole 'nother thing. Though maybe if this was all pulled into the product table, that would take care of itself...
    Yep!

    Quote Originally Posted by delia View Post
    I'm updating the mod now for zc v1.5.3 but making a change like that in tables is major. I'm just going to upload this one with the small change and do another version that changes majorly. I'll let you know when I have a the fully revised mod ready.
    SUH! - WHEAT! Sweet!
    Zen Cart 1.5.3, Database Patch Level: 1.5.3
    Server OS: Linux 2.6.32, Database: MySQL 5.5.41
    HTTP Server: Apache, PHP Version: 5.4.37

  7. #7
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: v151 New / Custom Extra Product Fields

    In general I'd recommend not altering the "products" table directly, if at all possible, mostly to make things easier for upgrades.
    Then adapt the search code to include your additional tables' relevant fields if search is a required component to specific fields you're adding.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  8. #8
    Join Date
    Jul 2014
    Location
    Santiago
    Posts
    53
    Plugin Contributions
    0

    Default Re: v151 New / Custom Extra Product Fields

    Quote Originally Posted by delia View Post
    Hmm, the apsona shop manager is free and is a lot easier to use than the ezpopulate. Fields added to the product table automatically get included.
    http://apsona.com/pages/ec/signup.html

    Additionally, I wrote the extra product fields mod - it uses a different table because it had the possibility of adding many fields and I wanted to keep that info separated out of the products table.

    I've thought about a new version since that one was actually written more to include a flash file on the product page and that's probably not happening anymore. At least I hope so.

    So perhaps it would be best to rewrite the mod to include upload maybe 2 PDFs (the other reason for the mod) and several text fields. Connect them to the product table instead and that would have solved your problem, correct?
    Hi Delia:

    Please let me know when you re-write the the mod to include several text fields in the product table or better yet in a table that does not touch core files. The nature of our products require much additional information as well.
    Last edited by FoodSourceDirect; 23 Aug 2014 at 01:25 PM. Reason: made a mistake

  9. #9
    Join Date
    May 2006
    Location
    Gardiner, Maine
    Posts
    2,371
    Plugin Contributions
    23

    Default Re: v151 New / Custom Extra Product Fields

    I have that done but was trying to incorporate searching that table and ran into problems. I will let you know when I have it ready.
    The full-time Zen Cart Guru. WizTech4ZC.com
    New template for 2.0 viewable here: 2.0 Demo

  10. #10
    Join Date
    Jul 2014
    Location
    Santiago
    Posts
    53
    Plugin Contributions
    0

    Default Re: v151 New / Custom Extra Product Fields

    Quote Originally Posted by delia View Post
    I have that done but was trying to incorporate searching that table and ran into problems. I will let you know when I have it ready.
    Great news. Thank you for the update.

 

 

Similar Threads

  1. product extra fields
    By lions1855 in forum General Questions
    Replies: 6
    Last Post: 24 Mar 2010, 02:14 PM
  2. show custom product fields on new and all product pages
    By crl in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 1 Oct 2007, 05:04 AM
  3. Product Extra Fields
    By webie in forum Customization from the Admin
    Replies: 0
    Last Post: 23 Sep 2007, 07:16 PM
  4. What's the easiest way to add custom fields to the New Product page?
    By christopherw in forum Setting Up Categories, Products, Attributes
    Replies: 4
    Last Post: 18 Sep 2007, 06:16 PM

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