Page 16 of 16 FirstFirst ... 6141516
Results 151 to 159 of 159
  1. #151
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,492
    Plugin Contributions
    88

    Default Re: How To Add New Product Fields?

    Debbie, you'll want to 'model' your additional language field(s) changes based on those that are in the 'base' Zen Cart for a product's description. Note that I'm using the file structure for zc156; if your store is still on zc155, they might be in different spots.

    Affected modules:
    - /admin/includes/modules/product/collect_info.php (create an 'array' of products_features).
    - /admin/includes/modules/product/preview_info.php (display those arrays of information, if applicable, and make sure to record the arrays into a to-be-posted variable for the product's insert/update action.
    - /admin/includes/modules/update_product.php (add the language-specific 'features' on the database insert/update).

    Search each file for the use of products_description and mimic the processing for the products_features information. Note that on a product's edit, the language-specific description is pulled from the database via a function (not sure how you've got that set up for the products_features).

  2. #152
    Join Date
    Mar 2009
    Location
    Essex, UK
    Posts
    446
    Plugin Contributions
    0

    Default Re: How To Add New Product Fields?

    Hi lat9

    I have had a play tonight and it would work except for on update_product.php where it fails to retain the information.

    Ironically I stumbled on a post I wrote on the other thread about 4 years ago where the language tag was causing all the issues (funny how times change). https://www.zen-cart.com/showthread....32#post1271232

    It seems that all the product fields worthy of a language setup are sitting in the products_desription table. I have tried to add my field to this, but nothing seems to work.

    Please advise. :)
    Debbie Harrison
    DVH Design | Web Design blog

  3. #153
    Join Date
    Mar 2009
    Location
    Essex, UK
    Posts
    446
    Plugin Contributions
    0

    Default Re: How To Add New Product Fields?

    Hi

    I always appreciate your advice, more so at the moment because anyhting I try just doesn't work.

    where I am trying to copy the pattern for products_url and products_description I get error messages.

    I tried to add product_features to around line 113 of admin/includs/modules/update_products.php

    Code:
    $languages = zen_get_languages();
        for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
          $language_id = $languages[$i]['id'];
    
          $sql_data_array = array('products_name' => zen_db_prepare_input($_POST['products_name'][$language_id]),
                                  'products_description' => zen_db_prepare_input($_POST['products_description'][$language_id]),
                                  'products_features' => zen_db_prepare_input($_POST['products_features'][$language_id]),
                                  'products_url' => zen_db_prepare_input($_POST['products_url'][$language_id]));
    I am assuming this is because the name description and url fields are all in table_products_description as opposed to table_product where my new fields sit.

    Please help.
    Last edited by dharrison; 16 Oct 2019 at 12:07 PM. Reason: I can't spell
    Debbie Harrison
    DVH Design | Web Design blog

  4. #154
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,492
    Plugin Contributions
    88

    Default Re: How To Add New Product Fields?

    Debbie, what errors are you receiving when you try to save that information? The line of inserted code you posted looks good.

    How many occurrences of products_features to you find in each of the three changed modules?

  5. #155
    Join Date
    Dec 2007
    Location
    Payson, AZ
    Posts
    1,076
    Plugin Contributions
    15

    Default Re: How To Add New Product Fields?

    Quote Originally Posted by dharrison View Post
    Hi

    I always appreciate your advice, more so at the moment because anyhting I try just doesn't work.

    where I am trying to copy the pattern for products_url and products_description I get error messages.

    I tried to add product_features to around line 113 of admin/includs/modules/update_products.php

    Code:
    $languages = zen_get_languages();
        for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
          $language_id = $languages[$i]['id'];
    
          $sql_data_array = array('products_name' => zen_db_prepare_input($_POST['products_name'][$language_id]),
                                  'products_description' => zen_db_prepare_input($_POST['products_description'][$language_id]),
                                  'products_features' => zen_db_prepare_input($_POST['products_features'][$language_id]),
                                  'products_url' => zen_db_prepare_input($_POST['products_url'][$language_id]));
    I am assuming this is because the name description and url fields are all in table_products_description as opposed to table_product where my new fields sit.

    Please help.
    Was wounding what table structure you was using.. URL's and such that don't need translation can go into the product table our your own table easily enough, product descriptions should have the ability to be translated into other languages. They could go into the products description table our a table you created with a language id.

    The code section you posted is using the products_description table.. did you get the posted value.. its at the top of the page..
    Code:
    elseif ((isset($_POST['products_model']) ? $_POST['products_model'] : '') . (isset($_POST['products_url']) ? implode('', $_POST['products_url']) : '') . (isset($_POST['products_name']) ? implode('', $_POST['products_name']) : '') . (isset($_POST['products_description']) ? implode('', $_POST['products_description']) : '') . (isset($_POST['products_features']) ? implode('', $_POST['products_features']) : '') != '') {
    Dave
    Always forward thinking... Lost my mind!

  6. #156
    Join Date
    Mar 2009
    Location
    Essex, UK
    Posts
    446
    Plugin Contributions
    0

    Default Re: How To Add New Product Fields?

    Hi DaveWest

    No I didn't get that code at the top of the page. My version of Zencart being used is 1.5.5e if that makes any difference.

    It has been suggested (thanks lat9) that I need to add these fields to the table products_description in order to set the language. So will try that and let you know
    Debbie Harrison
    DVH Design | Web Design blog

  7. #157
    Join Date
    Dec 2007
    Location
    Payson, AZ
    Posts
    1,076
    Plugin Contributions
    15

    Default Re: How To Add New Product Fields?

    Quote Originally Posted by dharrison View Post
    Hi DaveWest

    No I didn't get that code at the top of the page. My version of Zencart being used is 1.5.5e if that makes any difference.
    Yes... code sample as i'm working in ZC1.5.6, but the line is there simplified in 1.5.5, which is why the suggestion of copy, paste and modify to what you need...
    Dave
    Always forward thinking... Lost my mind!

  8. #158
    Join Date
    Mar 2009
    Location
    Essex, UK
    Posts
    446
    Plugin Contributions
    0

    Default Re: How To Add New Product Fields?

    Hi Dave & lat9

    So far so good, I can add product fields to the products_description and there are now no errors. But when I complete the new fields, update and go back into them, my new product fields are empty.

    Debbie Harrison
    DVH Design | Web Design blog

  9. #159
    Join Date
    Dec 2007
    Location
    Payson, AZ
    Posts
    1,076
    Plugin Contributions
    15

    Default Re: How To Add New Product Fields?

    Quote Originally Posted by dharrison View Post
    Hi Dave & lat9

    So far so good, I can add product fields to the products_description and there are now no errors. But when I complete the new fields, update and go back into them, my new product fields are empty.

    Form process:
    collect_info.php gets the form data inputs which posts to preview_info.php which then has to re-post the data to update_product.php which then saves/updates the sql tables. Look at preview and see if your fields have a hidden form field to pass the data on as products_description does.
    From ZC1.5.5e update_product.php line 151:
    Code:
    echo zen_draw_hidden_field('products_description[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_description[$languages[$i]['id']]), ENT_COMPAT, CHARSET, TRUE));
    Dave
    Always forward thinking... Lost my mind!

 

 
Page 16 of 16 FirstFirst ... 6141516

Similar Threads

  1. How to add new fields?
    By chandroo007 in forum Upgrading from 1.3.x to 1.3.9
    Replies: 1
    Last Post: 1 Jun 2010, 03:13 PM
  2. How To Add New Fields to Invoice?
    By PudzPud in forum Basic Configuration
    Replies: 7
    Last Post: 15 Nov 2009, 03:50 PM
  3. Replies: 1
    Last Post: 10 Dec 2007, 02:40 PM
  4. How to add labels to new fields
    By kappaluppa in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 3 Feb 2007, 07:16 PM
  5. How i can add new data fields to a Product
    By shreesoft in forum Customization from the Admin
    Replies: 4
    Last Post: 2 Oct 2006, 03:10 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