Technical Parameters Table
ver 2.0

15.04.2005

The module is intended for xt:Commerce v3.0.3 though will work and with 2.0 RC1 and 1.0 beta 2.

Allows to create the table technical (and not only) parameters to the goods through the system of administration XT-Commerce.

Unfortunately support multilanguage while is absent.

                  *new! - to matching with version 1.02


 

 


Usage:

    In section the categories / products to each name the link to the editor of parameters is added.

 

   Possibility to divide parameters to groups, for example, for an autoradio tape recorder is present at least three components: a tuner, the tape recorder, the amplifier.

 

  Again entered names of parameters are saved and anchored to the group. In the further they will be accessible through the dropping out menu. It essentially simplifies input of parameters.



Installation


Creation of SQL tables.
  All necessary contains in tpt.sql file

Changes of the admin panel

1. Load new files from catalog/admin/in appropriate folders on your server.
2. We change admin/categories_view.php. (approximately 120 line):

<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_STATUS; ?></td>
<td class="dataTableHeadingContent" align="center"><?php echo "TPT"; ?></td> <!-- TPT 2.0-->
<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_PRICE; ?></td>
<td class="dataTableHeadingContent" align="center"><?php echo '% max'; ?></td>
<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?></td>
- Hereinafter yellow color designates the added code.


approximately 175 line:

<td class="dataTableContent" align="center">--</td>
          <td class="dataTableContent" align="center">--</td>

          <td class="dataTableContent" align="center">&nbsp;</td> <!-- // TPT 2.0-->
          <td class="dataTableContent" align="right"><?php if ( (is_object($cInfo)) && ($categories['categories_id'] == $cInfo->categories_id) ) { echo xtc_image(DIR_WS_IMAGES . 'icon_arrow_right.gif', ''); } else { echo '<a href="' . xtc_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories['categories_id']) . '">' . xtc_image(DIR_WS_IMAGES . 'icon_info.gif', IMAGE_ICON_INFO) . '</a>'; } ?>&nbsp;</td>


       </tr>
approximately 243 line
<td class="dataTableContent" align="center"><a href=<?php echo xtc_href_link(FILENAME_PRODUCTS_PARAMETER . '?category_path=' . $cPath . '&products_id=' . $products['products_id']); ?>>TPT</a></td> <!-- // TPT 2.0-->
<td class="dataTableContent" align="center">
<?php
// Show price
echo $currencies->format($products['products_price']);
//End Show price

3. We change admin/includes/application_top.php .

approximately 130 line

 define('FILENAME_SHIPPING_STATUS', 'shipping_status.php');
define('FILENAME_SALES_REPORT','stats_sales_report.php');
define('FILENAME_MODULE_EXPORT','module_export.php');
// TPT 2.0
define('FILENAME_PRODUCTS_PARAMETER', 'parameters.php');
define('FILENAME_PRODUCTS_PARAMETER_COPIER', 'products_parameter_copier.php');
// TPT 2.0 End


approximately 184 line

define('TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS', 'products_options_values_to_products_options');
define('TABLE_PRODUCTS_TO_CATEGORIES', 'products_to_categories');
//TPT 2.0
define('TABLE_PRODUCT_PARAMETERS', 'products_parameters');
define('TABLE_PRODUCT_PARAMETERS_GROUPS', 'products_parameters_gpoups');
define('TABLE_PRODUCT_PARAMETERS_NAMES', 'products_parameters_names');
//TPT 2.0 END

4. We change admin/includes/column_left.php (approximately 27 line)

echo ('<div class="menuBoxHeading"><b>'.BOX_HEADING_PRODUCTS.'</b></div>');
if (($_SESSION['customers_status']['customers_status_id'] == '0') && ($admin_access['categories'] == '1')) echo '<a href="' . xtc_href_link(FILENAME_CATEGORIES, '', 'NONSSL') . '" class="menuBoxContentLink"> -' . BOX_CATEGORIES . '</a><br>';
//TPT Copier 2.0
if (($_SESSION['customers_status']['customers_status_id'] == '0') && ($admin_access['categories'] == '1')) echo '<a href="' . xtc_href_link(FILENAME_PRODUCTS_PARAMETER_COPIER, '', 'NONSSL') . '" class="menuBoxContentLink"> -' . BOX_PARAMETER_COPIER . '</a><br>';
//TPT Copier 2.0 END

5. We change lang/YOU_LANGUAGE/admin/YOU_LANGUAGE.php :
approximately 150 line

define('BOX_TOOLS_BLACKLIST','CC-Blacklist');
//TPT Copier 1.0 for TPT 2.0
define('BOX_PARAMETER_COPIER', 'Parameter Copier');
//TPT Copier 1.0 END

6. We change admin/includes/functions/html_output.php :
Add in the end, before ?>


if (!function_exists("xtc_output_string")){

include_once(DIR_FS_INC . 'xtc_parse_input_field_data.inc.php');
function xtc_output_string($string, $translate = false, $protected = false) {
    if ($protected == true) {
       return htmlspecialchars($string);
    } else {
        if ($translate == false) {
            return xtc_parse_input_field_data($string, array('"' => '&quot;'));
        } else {
          return xtc_parse_input_field_data($string, $translate);
      }
   }
}

}

////
// Output a form pull down multiselect menu
if (!function_exists("xtc_draw_pull_multiselect_menu")){

function xtc_draw_pull_multiselect_menu($name, $values, $defaults, $parameters = '') {
     $field = '<select multiple name="' . xtc_output_string($name) . '"';

      if (xtc_not_null($parameters)) $field .= ' ' . $parameters;

     $field .= '>' . "\n";

     if (empty($default) && isset($GLOBALS[$name])) $default = stripslashes($GLOBALS[$name]);

     for ($i = 0, $n = sizeof($values); $i < $n; $i++) {
         $field .= '<option value="' . xtc_output_string($values[$i]['id']) . '"';
         if (in_array($values[$i]['id'], $defaults)) {
             $field .= ' SELECTED';
         }
         $field .= '>' . xtc_output_string($values[$i]['text'], array('"' => '&quot;', '\'' => '&#039;', '<' => '&lt;', '>' => '&gt;')) . '</option>';
    }
    $field .= '</select>';

    return $field;
 }

}

7. We change admin/includes/functions/general.php :
Changes in xtc_remove_product function ()   (approximately 1145 line):     if (USE_CACHE == 'true') {
       xtc_reset_cache_block('categories');
       xtc_reset_cache_block('also_purchased');
    }
    //TPT 2.0
   $get_parameter_names_id = xtc_db_query("SELECT DISTINCT parameter_name_id FROM " . TABLE_PRODUCT_PARAMETERS . " WHERE products_id = '" . xtc_db_input($product_id) . "'");
   xtc_db_query("delete from " . TABLE_PRODUCT_PARAMETERS . " where products_id = '" . xtc_db_input($product_id) . "'");
   while($parameter_names_id = xtc_db_fetch_array($get_parameter_names_id)){
      $dup_par_n_query = xtc_db_query("select count(*) as total from " . TABLE_PRODUCT_PARAMETERS . " where parameter_name_id = '" . xtc_db_input($parameter_names_id['parameter_name_id']) . "'");
      $dup_par_n = xtc_db_fetch_array($dup_par_n_query);
      if(!$dup_par_n['total']){
          xtc_db_query("delete from " . TABLE_PRODUCT_PARAMETERS_NAMES . " where id = '" . xtc_db_input($parameter_names_id['parameter_name_id']) . "'");
      }
   }
   //TPT 2.0 END
}

 


 


Changes of  catalog
8. Load new files from catalog/ in appropriate folders on your server

Attention! It is meant, that yours the template is in the directory templates/xtc2


9. We change  includes/modules/product_info.php.

approximately 183 line

 include(DIR_WS_MODULES . FILENAME_PRODUCTS_MEDIA);
//TPT 2.0
include(DIR_WS_MODULES . 'tpt.php
');
//TPT 2.0 end

10. We change  templates/xtc2/module/product_info/product_info_v1.html
   approximately 130 line

   <table width="100%" border="0">
      <tr>
           <td><div align="center">{$MODULE_tpt}</div></td>
     </tr>
  </table>

{if $MODULE_also_purchased != ''}
  <table width="100%" border="0">
    <tr>
         <td align="center">{$MODULE_also_purchased}<br /></td>
   </tr>
  </table>{/if}
{$FORM_END}

 

11. We change  includes/database_tables.php
Add in the end, before ?>

//TPT 2.0
define('TABLE_PRODUCT_PARAMETERS', 'products_parameters');
define('TABLE_PRODUCT_PARAMETERS_GROUPS', 'products_parameters_gpoups');
define('TABLE_PRODUCT_PARAMETERS_NAMES', 'products_parameters_names');
//TPT 2.0 end

12. Execute from a file tpt.sql  SQL inquiry in a database.
 

Actually and everything, should work.

Credits

ver 1.0-beta-russian_only - Spanium http://high-end.aac.ru/
ver 1.01 - Vetal
ver 1.02 - Vetal
ver 2.0 - Witalij Olejnik (xaoc ,xaoc2)  - xaoc@o2.pl