Results 1 to 10 of 10
  1. #1
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,227
    Plugin Contributions
    6

    red flag Adding Extra Fields to Product Description

    Hi I have created some extra fields for the product description page which are working and populating correctly.

    These are fields I've written independently, not by using a third party mod such as Numinix Product Fields.

    This is the code I have in my product description which currently only displays '$products_Text_1' from the code below. How would I change this to display all fields?

    <!--bof Product Texts -->
    <?php if ($products_Text_1 != '') { ?>
    <div id="productText" class="productGeneral"><strong>Text 1: </strong><a href="<?php echo $products_Text_link_1; ?>"><?php echo $products_Text_1; ?></a></div>
    <div id="productText" class="productGeneral"><strong>Text 2: </strong><a href="<?php echo $products_Text_link_2; ?>"><?php echo $products_Text_2; ?></a></div>
    <div id="productText" class="productGeneral"><strong>Text 3: </strong><a href="<?php echo $products_Text_link_3; ?>"><?php echo $products_Text_3; ?></a></div>
    <div id="productText" class="productGeneral"><strong>Text 4: </strong><a href="<?php echo $products_Text_link_4; ?>"><?php echo $products_Text_4; ?></a></div>
    <?php } ?>
    <!--eof Product Texts -->

    Thanks

    Nick
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Adding Extra Fields to Product Description

    I have created some extra fields for the product description page which are working and populating correctly.
    which currently only displays '$products_Text_1' from the code below
    You first state that they are working - then state that they are not????

    Which one is it???

    Well I can get you started

    First you need to add fields to the table "product_description" for products_Text_1, products_Text_2, etc
    keeping in mind that by default there is only "products_description text" present now you might change the naming convention to
    something like
    Code:
    products_description text_1
    products_description text_2
    One then need to change the admin > includes > modules > update_product.php file about line 13
    Code:
     if (isset($_POST['edit_x']) || isset($_POST['edit_y'])) {
        $action = 'new_product';
      } elseif ($_POST['products_model'] . $_POST['products_url'] . $_POST['products_name'] . $_POST['products_description'] != '')
    about line 112
    Code:
          $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_url' => zen_db_prepare_input($_POST['products_url'][$language_id]));
    In file admin > includes > modules > product > collect_info.php every line for "products_description" needs to be added to with your additional fields

    All the above only gets it so one can enter in the admin the additional fields
    I suspect that you have added the code you posted to includes/templates/your_template/templates/product_info_display.php which will also need to be altered

    I may have missed some files that need alteration
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,227
    Plugin Contributions
    6

    Default Re: Adding Extra Fields to Product Description

    What I meant is that they are working from the admin side and capturing data in the admin correctly. The first field 'products_Text_link_1' displays data inputted into the admin and pulls it correctly from the database into the front end on the product description/information page, however the code I supplied only displays 'products_Text_link_1'

    And it doesn't display 'products_Text_link_2', 'products_Text_link_3', 'products_Text_link_4' etc even though data is being captured from the admin.

    I suspect I need to add something in this <?php if ($products_Text_1 != '') { ?> but am unsure what I need to change to get all fields to display on the front end.

    The code I have put in this post is the code I am using in the front end products description file tpl_products_description.php and that is the code I need help with. All the admin/database work has been done. Hope that makes sense?
    Last edited by Nick1973; 14 Apr 2016 at 11:15 PM. Reason: Added extra
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

  4. #4
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Adding Extra Fields to Product Description

    The code I have put in this post is the code I am using in the front end products description file tpl_products_description.php
    Do n ot see the code you referenced???
    Also, there is no file named tpl_products_description.php in a stock ZenCart fileset???
    Zen-Venom Get Bitten

  5. #5
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,227
    Plugin Contributions
    6

    Default Re: Adding Extra Fields to Product Description

    Sorry my error, This is the code that is in tpl_product_info_display.php

    <!--bof Product Texts -->
    <?php if ($products_Text_1 != '') { ?>
    <div id="productText" class="productGeneral"><strong>Text 1: </strong><a href="<?php echo $products_Text_link_1; ?>"><?php echo $products_Text_1; ?></a></div>
    <div id="productText" class="productGeneral"><strong>Text 2: </strong><a href="<?php echo $products_Text_link_2; ?>"><?php echo $products_Text_2; ?></a></div>
    <div id="productText" class="productGeneral"><strong>Text 3: </strong><a href="<?php echo $products_Text_link_3; ?>"><?php echo $products_Text_3; ?></a></div>
    <div id="productText" class="productGeneral"><strong>Text 4: </strong><a href="<?php echo $products_Text_link_4; ?>"><?php echo $products_Text_4; ?></a></div>
    <?php } ?>
    <!--eof Product Texts -->


    This is what I need help with so it displays the fields on the Products Description page on the front end.
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

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

    Default Re: Adding Extra Fields to Product Description

    You say that nothing past products_links_1 displays, but when you view the source code does the remaining html appear? If so, then the issue is more likely that the variables being referenced are not being populated on the store side at the same "time" the first one is populated...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  7. #7
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,227
    Plugin Contributions
    6

    Default Re: Adding Extra Fields to Product Description

    It doesn't matter, I've just seen my error. I hadn't put the variables into product_info/main_template_vars.php
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

  8. #8
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,227
    Plugin Contributions
    6

    Default Re: Adding Extra Fields to Product Description

    I should also say I've fixed this myself :-)
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

  9. #9
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Adding Extra Fields to Product Description

    I hadn't put the variables into product_info/main_template_vars.php
    Would this be /includes/modules/pages/product_info/main_template_vars.php
    Zen-Venom Get Bitten

  10. #10
    Join Date
    Sep 2008
    Location
    Cleethorpes
    Posts
    1,227
    Plugin Contributions
    6

    Default Re: Adding Extra Fields to Product Description

    Yes that is correct. I'm going to stick a mod or a set of mods together anyway as it/they will be useful for certain tasks.
    Nick Smith - Venture Design and Print
    https://venturedesignandprint.co.uk

 

 

Similar Threads

  1. Adding html tables to product description adds extra line breaks
    By ndknsrln in forum Templates, Stylesheets, Page Layout
    Replies: 17
    Last Post: 4 Mar 2013, 12:35 AM
  2. Adding extra fields to contact us page
    By webmiss in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 13 Sep 2007, 08:06 PM
  3. Adding one or two extra fields to a product
    By Rasputin in forum Setting Up Categories, Products, Attributes
    Replies: 8
    Last Post: 22 May 2007, 07:32 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