Page 11 of 16 FirstFirst ... 910111213 ... LastLast
Results 101 to 110 of 159
  1. #101
    Join Date
    Oct 2010
    Posts
    1
    Plugin Contributions
    0

    help question Re: How To Add New Product Fields?

    Thanks for the great post! It worked perfectly.

    One question, in Step 8 of the original post, it showed how to display the data in a single product listing. That worked perfectly. How would one display the same new product field data in the All Products listing?

    I've been wracking my brain all day. My PHP skills are a little lacking for this one. Any help would be appreciated.

  2. #102
    Join Date
    Oct 2010
    Posts
    2
    Plugin Contributions
    0

    Default Re: How To Add New Product Fields?

    Quote Originally Posted by gormant View Post
    Thanks for the great post! It worked perfectly.

    One question, in Step 8 of the original post, it showed how to display the data in a single product listing. That worked perfectly. How would one display the same new product field data in the All Products listing?

    I've been wracking my brain all day. My PHP skills are a little lacking for this one. Any help would be appreciated.
    Hello everyone,
    I am facing exactly the same problem. I want the new field to appear
    in the search results. I have made a few modifications in header.php
    (the select and where parts of the search query and manually added the new field in $define_list) but I can't quite
    locate the exact lines of code that are responsible for field selection
    during proudct listing.

    Lazaros.

  3. #103
    Join Date
    Oct 2010
    Posts
    2
    Plugin Contributions
    0

    Default Re: How To Add New Product Fields?

    To answer my own question in case someone else is looking for the same piece of info..

    The file under question is
    /includes/modules/product_listing.php

    Lazaros

  4. #104
    Join Date
    Jun 2008
    Posts
    23
    Plugin Contributions
    0

    Default Re: How To Add New Product Fields?

    Would someone please take a look at this code and help me identify the problem. I get the following error:

    1054 Unknown column 'pdex.products_year' in 'field list'
    in:

    [select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id, p.products_quantity, p.products_weight, p.products_priced_by_attribute, p.product_is_free, p.products_qty_box_status, p.products_quantity_order_max, p.products_discount_type, p.products_discount_type_from, p.products_sort_order, p.products_price_sorter, pdex.products_year from zen_products p, zen_products_description pd, zen_product_extra_fields pdex where p.products_status = '1' and p.products_id = '3' and pd.products_id = p.products_id and p.products_id = pdex.products_id and pd.language_id = '1']

    This is what I have done on a fresh install of v1.3.9g


    1. New table PRODUCT_EXTRA_FIELDS

    2. includes/database_tables.php

    define('TABLE_PRODUCT_EXTRA_FIELDS', DB_PREFIX . 'product_extra_fields');

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


    p.products_sort_order, pdex.products_year
    from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCT_EXTRA_FIELDS . " pdex
    where p.products_id = pd.products_id and p.products_id = pdex.products_id


    4. admin/includes/modules/product/collect_info.php


    $parameters = array('products_name' => '',
    'products_description' => '',

    'master_categories_id' => '',
    'products_year' => ''
    );



    p.products_price_sorter, p.master_categories_id, pdex.products_year

    from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " .
    TABLE_PRODUCT_EXTRA_FIELDS . " pdex
    where p.products_id = '" . (int)$_GET['pID'] . "'

    and p.products_id = pd.products_id and p.products_id = pdex.products_id

    and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'");

    5. still in collect_info.php

    <!-- BOF - Additional field added -->
    <tr>
    <td class="main"><?php echo 'Year of Release: '; ?></td>
    <td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '13') . '&nbsp;' .
    zen_draw_input_field('products_year', $pInfo->products_year, zen_set_field_length(TABLE_PRODUCT_EXTRA_FIELDS, 'products_year')); ?></td>
    </tr>
    <!-- EOF - Additional field added -->

    6. admin/includes/modules/update_product.php

    (line 106)
    ////////////// MY ADDED FIELDS ////////////////////
    $sql_data_array = array('products_year' => zen_db_prepare_input($_POST['products_year']));

    if ($action == 'insert_product') {
    $insert_sql_data = array('products_id' => $products_id);

    $sql_data_array = array_merge($sql_data_array, $insert_sql_data);

    zen_db_perform(TABLE_PRODUCT_EXTRA_FIELDS, $sql_data_array);
    } elseif ($action == 'update_product') {
    zen_db_perform(TABLE_PRODUCT_EXTRA_FIELDS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'");
    }
    /////////////////////////////////////////////

    7. includes/modules/pages/product_info/main_template_vars.php

    p.products_price_sorter, pdex.products_year

    from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCT_EXTRA_FIELDS . " pdex

    where p.products_status = '1'

    and p.products_id = '" . (int)$_GET['products_id'] . "'

    and pd.products_id = p.products_id and p.products_id = pdex.products_id

    and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";


    $products_year = $product_info->fields['products_year'];

    8. includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_display.php

    <!--bof Product Year -->
    <?php
    if ($products_year != '') {
    ?>
    <div id="productYear" class="productGeneral"><strong>Year: </strong><?php echo $products_year; ?></div>
    <?php
    }
    ?>
    <!--eof Product Year -->

  5. #105
    Join Date
    Nov 2005
    Posts
    86
    Plugin Contributions
    1

    Default Re: How To Add New Product Fields?

    are you getting this error on the admin or public site?

    What are you doing when the error appears, adding, editing product etc...

  6. #106
    Join Date
    May 2009
    Location
    Kansas
    Posts
    39
    Plugin Contributions
    0

    Default Re: How To Add New Product Fields?

    Have a question for the Easy Populate gurus-

    When using Easy Populate, duplicating a product to a new category creates the product - but without any product info.
    Nothing shows including the product name, model,...and including the new fields that were added.

    I have tried to modify "easypopulate.php" with the new field info including the "PRODUCTS_EXTRA_STUFF" table but run into errors when processing.

    However, I am able to "copy" one product to another category successfully with all info being populated in the duplicate product when not using easy populate.

    I was hoping that someone might be able to show how to alter "easypopulate.php" for the new table info "PRODUCTS_EXTRA_STUFF" .

    Otherwise this mod has worked great. Thank you to webego and all for their input.

  7. #107
    Join Date
    Feb 2011
    Posts
    3
    Plugin Contributions
    0

    Default Re: How To Add New Product Fields?

    okay so I'm at the point of adding my new field the reports section.

    I have this in my database_tables.php file
    define('TABLE_PRODUCTS_EXTRA_STUFF', DB_PREFIX . 'products_extra_stuff');

    my new field is called pdex.reorder_code I do not know how to define it in this report so it will be echo right now no value for the new field is being displayed.

    can any see whats going on here

    here is my code

    ?>
    <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html <?php echo HTML_PARAMS; ?>>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
    <title><?php echo TITLE; ?></title>
    <link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
    <link rel="stylesheet" type="text/css" href="includes/cssjsmenuhover.css" media="all" id="hoverJS">
    <script language="javascript" src="includes/menu.js"></script>
    <script language="javascript" src="includes/general.js"></script>
    <script type="text/javascript">
    <!--
    function init()
    {
    cssjsmenu('navbar');
    if (document.getElementById)
    {
    var kill = document.getElementById('hoverJS');
    kill.disabled = true;
    }
    }
    // -->
    </script>
    </head>
    <body onload="init()">
    <!-- header //-->
    <?php require(DIR_WS_INCLUDES . 'header.php'); ?>
    <!-- header_eof //-->

    <!-- body //-->
    <table border="0" width="100%" cellspacing="2" cellpadding="2">
    <tr>
    <!-- body_text //-->
    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
    <tr>
    <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
    <tr>
    <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
    <td class="pageHeading" align="right"><?php echo zen_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
    </tr>
    </table></td>
    </tr>
    <tr>
    <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
    <tr>
    <td valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">
    <tr class="dataTableHeadingRow">
    <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_NUMBER; ?></td>
    <td class="dataTableHeadingContent"><?php echo TABLE_HEADING_PRODUCTS; ?></td>
    <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_VIEWED; ?>&nbsp;</td>
    <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_reorder_code; ?></td>
    <td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_product_image; ?></td>
    </tr>
    <?php
    if (isset($_GET['page']) && ($_GET['page'] > 1)) $rows = $_GET['page'] * MAX_DISPLAY_SEARCH_RESULTS_REPORTS - MAX_DISPLAY_SEARCH_RESULTS_REPORTS;
    $rows = 0;
    $products_query_raw = "select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_type from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and pd.language_id='" . $_SESSION['languages_id'] . "' order by p.products_quantity, pd.products_name";
    $products_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS_REPORTS, $products_query_raw, $products_query_numrows);
    $products = $db->Execute($products_query_raw);
    while (!$products->EOF) {

    // only show low stock on products that can be added to the cart
    if ($zc_products->get_allow_add_to_cart($products->fields['products_id']) == 'Y') {

    $rows++;

    if (strlen($rows) < 2) {
    $rows = '0' . $rows;
    }

    $type_handler = $zc_products->get_admin_handler($products->fields['products_type']);

    $cPath = zen_get_product_path($products->fields['products_id']);
    ?>
    <tr class="dataTableRow" onMouseOver="rowOverEffect(this)" onMouseOut="rowOutEffect(this)" onClick="document.location.href='<?php echo zen_href_link($type_handler, '&product_type=' . $products->fields['products_type'] . '&cPath=' . $cPath . '&pID=' . $products->fields['products_id'] . '&action=new_product'); ?>'">
    <td class="dataTableContent" align="right"><?php echo $products->fields['products_id']; ?>&nbsp;&nbsp;</td>
    <td class="dataTableContent"><?php echo '<a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products->fields['products_id']) . '">' . $products->fields['products_name'] . '</a>'; ?></td>
    <td class="dataTableContent" align="center"><?php echo $products->fields['products_quantity']; ?>&nbsp;</td>
    <td class="dataTableContent" align="center"><?php echo $products->fields['pdex.reorder_code']; ?></td>
    <td class="dataTableContent" align="center"><?php echo $products->fields['products_image']; ?>&nbsp;</td>
    </tr>
    <?php
    }
    $products->MoveNext();
    }
    ?>
    </table></td>
    </tr>
    <tr>
    <td colspan="3"><table border="0" width="100%" cellspacing="0" cellpadding="2">
    <tr>
    <td class="smallText" valign="top"><?php echo $products_split->display_count($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_REPORTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>
    <td class="smallText" align="right"><?php echo $products_split->display_links($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_REPORTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?></td>
    </tr>
    </table></td>
    </tr>
    </table></td>
    </tr>
    </table></td>
    <!-- body_text_eof //-->
    </tr>
    </table>
    <!-- body_eof //-->

    <!-- footer //-->

  8. #108
    Join Date
    May 2008
    Posts
    188
    Plugin Contributions
    0

    Default Re: How To Add New Product Fields?

    Thanks for getting this going webego it helps me a lot, hopefully I can give a little back.

    This was working fine for me until I tried to copy a product but I reliased that copying a product doesn't add an extra row in the added fields table for the newly copied product. As I use copy product alot I though I'd try to code a fix. So here goes.

    I've continued the original example using product_colour as the added field.

    I would be pleased if someone from the zen team can cast their eye over this to see if the code is ok, it works but there may be a better way of doing it.

    As always backup and test before you try this.


    Open admin/includes/modules/copy_to_confirm.php

    find (line 35 for me)




    replace with

    $product = $db->Execute("select p.products_type, p.products_quantity, p.products_model, p.products_image,
    p.products_price, p.products_virtual, p.products_date_available, p.products_weight,
    p.products_tax_class_id, p.manufacturers_id,
    p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute,
    p.product_is_free, p.product_is_call, p.products_quantity_mixed,
    p.product_is_always_free_shipping, p.products_qty_box_status, p.products_quantity_order_max, p.products_sort_order,
    p.products_price_sorter, p.master_categories_id,
    pdex.products_colour,
    from " . TABLE_PRODUCTS . " p, " . TABLE_ADDED_FIELDS." pdex
    where p.products_id = '" . (int)$products_id . "'
    and pdex.products_id = '" . (int)$products_id . "'");[/QUOTE

    Then after (line 109)


    add

    // added fields////////
    $db->Execute("insert into " . TABLE_ADDED_FIELDS . "
    (products_id, products_colour )
    values ('" . (int)$dup_products_id ."', '" . zen_db_input($product->fields['products_colour']) . "' )");
    // added fields////////

    Sorry I can't seem to add source tag only quote, but you get my meaning
    I found 2 issues with this which I figured I would share with the community for the benefit of others coming across the thread: ...

    Firstly the first statment above gave me a sql syntax error - the cause being the , at the end of pdex.products_colour in

    p.products_price_sorter, p.master_categories_id,
    pdex.products_colour,
    from " . TABLE_PRODUCTS . " p, " . TABLE_ADDED_FIELDS."

    remove the, to sort this out.

    p.products_price_sorter, p.master_categories_id,
    pdex.products_colour
    from " . TABLE_PRODUCTS . " p, " . TABLE_ADDED_FIELDS."

    is how it should look.

    The other one to watch out for is both mentions of TABLE_ADDED_FIELDS - If you have been following the original coding webego used TABLE_PRODUCTS_EXTRA_STUFF (products_extra_stuff being the database field used) Just make sure that you have used the same database field name.

  9. #109
    Join Date
    Mar 2011
    Location
    Ireland
    Posts
    286
    Plugin Contributions
    0

    Default Re: How To Add New Product Fields?

    HELP:

    getting this error:

    #1136 - Column count doesn't match value count at row 1

  10. #110
    Join Date
    Mar 2011
    Location
    Ireland
    Posts
    286
    Plugin Contributions
    0

    Default Re: How To Add New Product Fields?

    Quote Originally Posted by jagall View Post
    HELP:

    getting this error:

    #1136 - Column count doesn't match value count at row 1
    sorry in MYSQL when I put in the following code:
    INSERT zen_products_extra_stuff (products_id, products_count, products_rrp) SELECT products_id, '' FROM zen_products

    none of records appearing in admin, i have install alot of mods since starting zen cart could this have something to do with this?

 

 
Page 11 of 16 FirstFirst ... 910111213 ... LastLast

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

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