Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

HTMLArea v3.0


Guest

Recommended Posts

Although it's been mentioned already, I definitely have to say, this is an awesome contribution!! I installed it in the categories section and it works beautifully. However, for some reason, when I try to send out e-mails, it doesn't retain the HTML format.

 

I modified admin/mail.php , the editor is there, when I click on Send, it takes me to the preview screen, but it shows up as plain text (source code). What could be causing this?

 

Many thanks in advance!!

Link to comment
Share on other sites

  • Replies 128
  • Created
  • Last Reply

Top Posters In This Topic

I hate to ask this, but install instructions, have they changed any since the very first posting of them in this topic?

those were dated, Jan. 19, 2004.

I downloaded the latest version of this, dated Jan. 24, 2005.

I cant find any included install instructions, and all I can seem to find are the ones from over a year ago posted in this topic.

I tried with that, but couldnt get anything to work with it.

Maybe someone can shine some light for me?

 

Regards

Tom

Edited by Qwiz
Link to comment
Share on other sites

ok,, maybe someone can tell me what i did wrong then.

Right now I have only attempted to install this in one file till i get it working,, then i will do the rest.

 

I downloaded the current verion of this from osc dated Jan 24, 2005

http://www.oscommerce.com/community/contributions,1800

i am working with newsletters.php on ms2

this is in the admin folder.

 

My store,, all my catalog file's are in my root, public_html folder.

 

that way,, when they type in the url name, the default index.php is my catalog.

 

i upladed the html files to a folder called htmlarea just as instructed.

 

in admin/newsletter.php

just before </head>, I added the following

<!-- DWD Modify -> Add: HTMLArea v3.0 !-->
<!-- Load HTMLArea Core Files. !-->
<script type="text/javascript" src="/htmlarea/htmlarea.js"></script>
<script type="text/javascript" src="/htmlarea/dialog.js"></script>
<script type="text/javascript" src="/htmlarea/lang/en.js"></script>

<!-- Load HTMLArea Plugins. !-->
<script type="text/javascript">
HTMLArea.loadPlugin("TableOperations");
HTMLArea.loadPlugin("SpellChecker");
</script>

<!-- Load HTMLArea StyleSheet. !-->
<style type="text/css">
@import url(/htmlarea/htmlarea.css);
</style>
<!-- DWD Modify End. !-->

</head>

 

then just after </head> with the "<body marginwidth=" statement , i edited the line to show

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus(); HTMLArea.replaceAll()"

 

then, "echo tep_draw_textarea_fie" statement was edited to reflect

<td class="main"><?php echo tep_draw_textarea_field('content', 'soft', '100%', '20', $nInfo->content); ?></td>

 

when i go to newsletters, i get a windows style message stating that,,

 

WARNING:_editor_url is not set! .........

 

and when you click ok, the normal input window appears to type in a newsletter content.

 

Can ANYONE shine some light for me.

 

Thanks in Advance

Tom

Link to comment
Share on other sites

I have tried differnet paths in the step one above.

 

looking at the java consol, its looking for the htmlarea files in the admin folder.

 

which is path public_html/admin

and the files are in public_html/htmlarea

 

i have tried /hmtlarea/

./htmlarea/

../htmlarea/

htmlarea/

 

i have even put the whole path in,,, and it dont seem to change anything

:wacko:

Tom

Link to comment
Share on other sites

reading this topic,, in the older version, there was some talk of going into htmlarea.js and changing this.editer_url and adding the path to htmlarea.

 

The version of 3.0 does not have the line this.editor_url.

it simply has editor_url.

When i edit this line to reflect the full path of the file,, reflecting the path of http://hillbillybargains.com/htmlarea/

I then still get the same error msg, but looking at the java console, i only have one line now,, which states that the image editor was not defined on line 911, and line 911 is,

 

plugin = eval(plugin);

 

.

Anyone have any ideal what I am doin wrong?

Please see above post's for details

Tom

Link to comment
Share on other sites

Hi...

 

i sorry to bother,

 

but i would like to know if someone had succed in updating their MAXI DVD admintools to the HTML Area 3.0.

 

I tryed to just replace with the information given on the first page, but with no success. After few hours of unlucky try, i decided to ask directly here if someone can give me some instructions to help me migrate my old HTML Area to the 3.0's one.

 

thanks by advance

 

Here is for exemple my admin/categories.php

 

<?php

/*

 $Id: categories.php,v 1.146 2003/07/11 14:40:27 hpdl Exp $

 

 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com

 

 Copyright (c) 2003 osCommerce

 

 Released under the GNU General Public License

*/

 

 require('includes/application_top.php');

 

 require(DIR_WS_CLASSES . 'currencies.php');

 $currencies = new currencies();

 

 $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : '');

 

 if (tep_not_null($action)) {

   switch ($action) {

     case 'setflag':

       if ( ($HTTP_GET_VARS['flag'] == '0') || ($HTTP_GET_VARS['flag'] == '1') ) {

         if (isset($HTTP_GET_VARS['pID'])) {

           tep_set_product_status($HTTP_GET_VARS['pID'], $HTTP_GET_VARS['flag']);

         }

 

         if (USE_CACHE == 'true') {

           tep_reset_cache_block('categories');

           tep_reset_cache_block('also_purchased');

         }

       }

 

       tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $HTTP_GET_VARS['cPath'] . '&pID=' . $HTTP_GET_VARS['pID']));

       break;

     case 'insert_category':

     case 'update_category':

       if (isset($HTTP_POST_VARS['categories_id'])) $categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);

       $sort_order = tep_db_prepare_input($HTTP_POST_VARS['sort_order']);

 

       $sql_data_array = array('sort_order' => $sort_order);

 

       if ($action == 'insert_category') {

         $insert_sql_data = array('parent_id' => $current_category_id,

                                  'date_added' => 'now()');

 

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

 

         tep_db_perform(TABLE_CATEGORIES, $sql_data_array);

 

         $categories_id = tep_db_insert_id();

       } elseif ($action == 'update_category') {

         $update_sql_data = array('last_modified' => 'now()');

 

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

 

         tep_db_perform(TABLE_CATEGORIES, $sql_data_array, 'update', "categories_id = '" . (int)$categories_id . "'");

       }

 

       $languages = tep_get_languages();

       for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

         $categories_name_array = $HTTP_POST_VARS['categories_name'];

 

         $language_id = $languages[$i]['id'];

 

         $sql_data_array = array('categories_name' => tep_db_prepare_input($categories_name_array[$language_id]));

 

         if ($action == 'insert_category') {

           $insert_sql_data = array('categories_id' => $categories_id,

                                    'language_id' => $languages[$i]['id']);

 

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

 

           tep_db_perform(TABLE_CATEGORIES_DESCRIPTION, $sql_data_array);

         } elseif ($action == 'update_category') {

           tep_db_perform(TABLE_CATEGORIES_DESCRIPTION, $sql_data_array, 'update', "categories_id = '" . (int)$categories_id . "' and language_id = '" . (int)$languages[$i]['id'] . "'");

         }

       }

 

       if (HTML_AREA_WYSIWYG_DISABLE == 'Disable') {

         if ($categories_image = new upload('categories_image', DIR_FS_CATALOG_IMAGES)) {

           tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . tep_db_input($categories_image->filename) . "' where categories_id = '" . (int)$categories_id . "'");

         }

       } else {

         if (isset($HTTP_POST_VARS['categories_image']) && tep_not_null($HTTP_POST_VARS['categories_image']) && ($HTTP_POST_VARS['categories_image'] != 'none')) {

           tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . tep_db_input($HTTP_POST_VARS['categories_image']) . "' where categories_id = '" . (int)$categories_id . "'");

         }

       }

 

       if (USE_CACHE == 'true') {

         tep_reset_cache_block('categories');

         tep_reset_cache_block('also_purchased');

       }

 

       tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories_id));

       break;

     case 'delete_category_confirm':

       if (isset($HTTP_POST_VARS['categories_id'])) {

         $categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);

 

         $categories = tep_get_category_tree($categories_id, '', '0', '', true);

         $products = array();

         $products_delete = array();

 

         for ($i=0, $n=sizeof($categories); $i<$n; $i++) {

           $product_ids_query = tep_db_query("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$categories[$i]['id'] . "'");

 

           while ($product_ids = tep_db_fetch_array($product_ids_query)) {

             $products[$product_ids['products_id']]['categories'][] = $categories[$i]['id'];

           }

         }

 

         reset($products);

         while (list($key, $value) = each($products)) {

           $category_ids = '';

 

           for ($i=0, $n=sizeof($value['categories']); $i<$n; $i++) {

             $category_ids .= "'" . (int)$value['categories'][$i] . "', ";

           }

           $category_ids = substr($category_ids, 0, -2);

 

           $check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$key . "' and categories_id not in (" . $category_ids . ")");

           $check = tep_db_fetch_array($check_query);

           if ($check['total'] < '1') {

             $products_delete[$key] = $key;

           }

         }

 

// removing categories can be a lengthy process

         tep_set_time_limit(0);

         for ($i=0, $n=sizeof($categories); $i<$n; $i++) {

           tep_remove_category($categories[$i]['id']);

         }

 

         reset($products_delete);

         while (list($key) = each($products_delete)) {

           tep_remove_product($key);

         }

       }

 

       if (USE_CACHE == 'true') {

         tep_reset_cache_block('categories');

         tep_reset_cache_block('also_purchased');

       }

 

       tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));

       break;

     case 'delete_product_confirm':

       if (isset($HTTP_POST_VARS['products_id']) && isset($HTTP_POST_VARS['product_categories']) && is_array($HTTP_POST_VARS['product_categories'])) {

         $product_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);

         $product_categories = $HTTP_POST_VARS['product_categories'];

 

         for ($i=0, $n=sizeof($product_categories); $i<$n; $i++) {

           tep_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$product_id . "' and categories_id = '" . (int)$product_categories[$i] . "'");

         }

 

         $product_categories_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$product_id . "'");

         $product_categories = tep_db_fetch_array($product_categories_query);

 

         if ($product_categories['total'] == '0') {

           tep_remove_product($product_id);

         }

       }

 

       if (USE_CACHE == 'true') {

         tep_reset_cache_block('categories');

         tep_reset_cache_block('also_purchased');

       }

 

       tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));

       break;

     case 'move_category_confirm':

       if (isset($HTTP_POST_VARS['categories_id']) && ($HTTP_POST_VARS['categories_id'] != $HTTP_POST_VARS['move_to_category_id'])) {

         $categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);

         $new_parent_id = tep_db_prepare_input($HTTP_POST_VARS['move_to_category_id']);

 

         $path = explode('_', tep_get_generated_category_path_ids($new_parent_id));

 

         if (in_array($categories_id, $path)) {

           $messageStack->add_session(ERROR_CANNOT_MOVE_CATEGORY_TO_PARENT, 'error');

 

           tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories_id));

         } else {

           tep_db_query("update " . TABLE_CATEGORIES . " set parent_id = '" . (int)$new_parent_id . "', last_modified = now() where categories_id = '" . (int)$categories_id . "'");

 

           if (USE_CACHE == 'true') {

             tep_reset_cache_block('categories');

             tep_reset_cache_block('also_purchased');

           }

 

           tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $new_parent_id . '&cID=' . $categories_id));

         }

       }

 

       break;

     case 'move_product_confirm':

       $products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);

       $new_parent_id = tep_db_prepare_input($HTTP_POST_VARS['move_to_category_id']);

 

       $duplicate_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$products_id . "' and categories_id = '" . (int)$new_parent_id . "'");

       $duplicate_check = tep_db_fetch_array($duplicate_check_query);

       if ($duplicate_check['total'] < 1) tep_db_query("update " . TABLE_PRODUCTS_TO_CATEGORIES . " set categories_id = '" . (int)$new_parent_id . "' where products_id = '" . (int)$products_id . "' and categories_id = '" . (int)$current_category_id . "'");

 

       if (USE_CACHE == 'true') {

         tep_reset_cache_block('categories');

         tep_reset_cache_block('also_purchased');

       }

 

       tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $new_parent_id . '&pID=' . $products_id));

       break;

     case 'insert_product':

     case 'update_product':

       if (isset($HTTP_POST_VARS['edit_x']) || isset($HTTP_POST_VARS['edit_y'])) {

         $action = 'new_product';

       } else {

         if (isset($HTTP_GET_VARS['pID'])) $products_id = tep_db_prepare_input($HTTP_GET_VARS['pID']);

         $products_date_available = tep_db_prepare_input($HTTP_POST_VARS['products_date_available']);

 

         $products_date_available = (date('Y-m-d') < $products_date_available) ? $products_date_available : 'null';

 

         $sql_data_array = array('products_quantity' => tep_db_prepare_input($HTTP_POST_VARS['products_quantity']),

                                 'products_model' => tep_db_prepare_input($HTTP_POST_VARS['products_model']),

                                 'products_price' => tep_db_prepare_input($HTTP_POST_VARS['products_price']),

                                 'products_date_available' => $products_date_available,

                                 'products_weight' => tep_db_prepare_input($HTTP_POST_VARS['products_weight']),

                                 'products_status' => tep_db_prepare_input($HTTP_POST_VARS['products_status']),

                                 'products_tax_class_id' => tep_db_prepare_input($HTTP_POST_VARS['products_tax_class_id']),

                                 'manufacturers_id' => tep_db_prepare_input($HTTP_POST_VARS['manufacturers_id']));

 

         if (isset($HTTP_POST_VARS['products_image']) && tep_not_null($HTTP_POST_VARS['products_image']) && ($HTTP_POST_VARS['products_image'] != 'none')) {

           $sql_data_array['products_image'] = tep_db_prepare_input($HTTP_POST_VARS['products_image']);

         }

 

         if ($action == 'insert_product') {

           $insert_sql_data = array('products_date_added' => 'now()');

 

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

 

           tep_db_perform(TABLE_PRODUCTS, $sql_data_array);

           $products_id = tep_db_insert_id();

 

           tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$products_id . "', '" . (int)$current_category_id . "')");

         } elseif ($action == 'update_product') {

           $update_sql_data = array('products_last_modified' => 'now()');

 

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

 

           tep_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'");

         }

 

         $languages = tep_get_languages();

         for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

           $language_id = $languages[$i]['id'];

 

           $sql_data_array = array('products_name' => tep_db_prepare_input($HTTP_POST_VARS['products_name'][$language_id]),

                                   'products_description' => tep_db_prepare_input($HTTP_POST_VARS['products_description'][$language_id]),

                                   'products_url' => tep_db_prepare_input($HTTP_POST_VARS['products_url'][$language_id]));

 

           if ($action == 'insert_product') {

             $insert_sql_data = array('products_id' => $products_id,

                                      'language_id' => $language_id);

 

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

 

             tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);

           } elseif ($action == 'update_product') {

             tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "' and language_id = '" . (int)$language_id . "'");

           }

         }

 

         if (USE_CACHE == 'true') {

           tep_reset_cache_block('categories');

           tep_reset_cache_block('also_purchased');

         }

 

         tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id));

       }

       break;

     case 'copy_to_confirm':

       if (isset($HTTP_POST_VARS['products_id']) && isset($HTTP_POST_VARS['categories_id'])) {

         $products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);

         $categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);

 

         if ($HTTP_POST_VARS['copy_as'] == 'link') {

           if ($categories_id != $current_category_id) {

             $check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . (int)$products_id . "' and categories_id = '" . (int)$categories_id . "'");

             $check = tep_db_fetch_array($check_query);

             if ($check['total'] < '1') {

               tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$products_id . "', '" . (int)$categories_id . "')");

             }

           } else {

             $messageStack->add_session(ERROR_CANNOT_LINK_TO_SAME_CATEGORY, 'error');

           }

         } elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') {

           $product_query = tep_db_query("select products_quantity, products_model, products_image, products_price, products_date_available, products_weight, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");

           $product = tep_db_fetch_array($product_query);

 

           tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . tep_db_input($product['products_quantity']) . "', '" . tep_db_input($product['products_model']) . "', '" . tep_db_input($product['products_image']) . "', '" . tep_db_input($product['products_price']) . "',  now(), '" . tep_db_input($product['products_date_available']) . "', '" . tep_db_input($product['products_weight']) . "', '0', '" . (int)$product['products_tax_class_id'] . "', '" . (int)$product['manufacturers_id'] . "')");

           $dup_products_id = tep_db_insert_id();

 

           $description_query = tep_db_query("select language_id, products_name, products_description, products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$products_id . "'");

           while ($description = tep_db_fetch_array($description_query)) {

             tep_db_query("insert into " . TABLE_PRODUCTS_DESCRIPTION . " (products_id, language_id, products_name, products_description, products_url, products_viewed) values ('" . (int)$dup_products_id . "', '" . (int)$description['language_id'] . "', '" . tep_db_input($description['products_name']) . "', '" . tep_db_input($description['products_description']) . "', '" . tep_db_input($description['products_url']) . "', '0')");

           }

 

           tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . (int)$dup_products_id . "', '" . (int)$categories_id . "')");

           $products_id = $dup_products_id;

         }

 

         if (USE_CACHE == 'true') {

           tep_reset_cache_block('categories');

           tep_reset_cache_block('also_purchased');

         }

       }

 

       tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $categories_id . '&pID=' . $products_id));

       break;

     case 'new_product_preview':

       if (HTML_AREA_WYSIWYG_DISABLE == 'Disable') {

         // copy image only if modified

         $products_image = new upload('products_image');

         $products_image->set_destination(DIR_FS_CATALOG_IMAGES);

         if ($products_image->parse() && $products_image->save()) {

           $products_image_name = $products_image->filename;

         } else {

           $products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : '');

         }

       } else {

         if (isset($HTTP_POST_VARS['products_image']) && tep_not_null($HTTP_POST_VARS['products_image']) && ($HTTP_POST_VARS['products_image'] != 'none')) {

           $products_image_name = $HTTP_POST_VARS['products_image'];

         } else {

           $products_image_name = (isset($HTTP_POST_VARS['products_previous_image']) ? $HTTP_POST_VARS['products_previous_image'] : '');

         }

       }

       break;

   }

 }

 

// check if the catalog image directory exists

 if (is_dir(DIR_FS_CATALOG_IMAGES)) {

   if (!is_writeable(DIR_FS_CATALOG_IMAGES)) $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_NOT_WRITEABLE, 'error');

 } else {

   $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_DOES_NOT_EXIST, 'error');

 }

?>

<!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>

 

       <script language="Javascript1.2"><!-- // load htmlarea

// MaxiDVD Added WYSIWYG HTML Area Box + Admin Function v1.7 - 2.2 MS2 Products Description HTML - Head

       _editor_url = "<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_ADMIN; ?>htmlarea/";  // URL to htmlarea files

         var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);

          if (navigator.userAgent.indexOf('Mac')        >= 0) { win_ie_ver = 0; }

           if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }

            if (navigator.userAgent.indexOf('Opera')      >= 0) { win_ie_ver = 0; }

        <?php if (HTML_AREA_WYSIWYG_BASIC_PD == 'Basic'){ ?>  if (win_ie_ver >= 5.5) {

        document.write('<scr' + 'ipt src="' +_editor_url+ 'editor_basic.js"');

        document.write(' language="Javascript1.2"></scr' + 'ipt>');

           } else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }

        <?php } else{ ?> if (win_ie_ver >= 5.5) {

        document.write('<scr' + 'ipt src="' +_editor_url+ 'editor_advanced.js"');

        document.write(' language="Javascript1.2"></scr' + 'ipt>');

           } else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }

        <?php }?>

// --></script>

 

<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">

<script language="javascript" src="includes/general.js"></script>

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">

<div id="spiffycalendar" class="text"></div>

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="2" cellpadding="2">

 <tr>

   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

   </table></td>

<!-- body_text //-->

   <td width="100%" valign="top">

<?php

 if ($action == 'new_product') {

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

                      'products_description' => '',

                      'products_url' => '',

                      'products_id' => '',

                      'products_quantity' => '',

                      'products_model' => '',

                      'products_image' => '',

                      'products_price' => '',

                      'products_weight' => '',

                      'products_date_added' => '',

                      'products_last_modified' => '',

                      'products_date_available' => '',

                      'products_status' => '',

                          'products_tax_class_id' => '',

                      'manufacturers_id' => '');

 

   $pInfo = new objectInfo($parameters);

 

   if (isset($HTTP_GET_VARS['pID']) && empty($HTTP_POST_VARS)) {

     $product_query = tep_db_query("select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'");

     $product = tep_db_fetch_array($product_query);

 

     $pInfo->objectInfo($product);

   } elseif (tep_not_null($HTTP_POST_VARS)) {

     $pInfo->objectInfo($HTTP_POST_VARS);

     $products_name = $HTTP_POST_VARS['products_name'];

     $products_description = $HTTP_POST_VARS['products_description'];

     $products_url = $HTTP_POST_VARS['products_url'];

   }

 

   $manufacturers_array = array(array('id' => '', 'text' => TEXT_NONE));

   $manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");

   while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {

     $manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'],

                                    'text' => $manufacturers['manufacturers_name']);

   }

 

   $tax_class_array = array(array('id' => '0', 'text' => TEXT_NONE));

   $tax_class_query = tep_db_query("select tax_class_id, tax_class_title from " . TABLE_TAX_CLASS . " order by tax_class_title");

   while ($tax_class = tep_db_fetch_array($tax_class_query)) {

     $tax_class_array[] = array('id' => $tax_class['tax_class_id'],

                                'text' => $tax_class['tax_class_title']);

   }

 

   $languages = tep_get_languages();

 

   if (!isset($pInfo->products_status)) $pInfo->products_status = '1';

   switch ($pInfo->products_status) {

     case '0': $in_status = false; $out_status = true; break;

     case '1':

     default: $in_status = true; $out_status = false;

   }

?>

<link rel="stylesheet" type="text/css" href="includes/javascript/spiffyCal/spiffyCal_v2_1.css">

<script language="JavaScript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script>

<script language="javascript"><!--

 var dateAvailable = new ctlSpiffyCalendarBox("dateAvailable", "new_product", "products_date_available","btnDate1","<?php echo $pInfo->products_date_available; ?>",scBTNMODE_CUSTOMBLUE);

//--></script>

<script language="javascript"><!--

var tax_rates = new Array();

<?php

   for ($i=0, $n=sizeof($tax_class_array); $i<$n; $i++) {

     if ($tax_class_array[$i]['id'] > 0) {

       echo 'tax_rates["' . $tax_class_array[$i]['id'] . '"] = ' . tep_get_tax_rate_value($tax_class_array[$i]['id']) . ';' . "\n";

     }

   }

?>

 

function doRound(x, places) {

 return Math.round(x * Math.pow(10, places)) / Math.pow(10, places);

}

 

function getTaxRate() {

 var selected_value = document.forms["new_product"].products_tax_class_id.selectedIndex;

 var parameterVal = document.forms["new_product"].products_tax_class_id[selected_value].value;

 

 if ( (parameterVal > 0) && (tax_rates[parameterVal] > 0) ) {

   return tax_rates[parameterVal];

 } else {

   return 0;

 }

}

 

function updateGross() {

 var taxRate = getTaxRate();

 var grossValue = document.forms["new_product"].products_price.value;

 

 if (taxRate > 0) {

   grossValue = grossValue * ((taxRate / 100) + 1);

 }

 

 document.forms["new_product"].products_price_gross.value = doRound(grossValue, 4);

}

 

function updateNet() {

 var taxRate = getTaxRate();

 var netValue = document.forms["new_product"].products_price_gross.value;

 

 if (taxRate > 0) {

   netValue = netValue / ((taxRate / 100) + 1);

 }

 

 document.forms["new_product"].products_price.value = doRound(netValue, 4);

}

//--></script>

   <?php echo tep_draw_form('new_product', FILENAME_CATEGORIES, 'cPath=' . $cPath . (isset($HTTP_GET_VARS['pID']) ? '&pID=' . $HTTP_GET_VARS['pID'] : '') . '&action=new_product_preview', 'post', 'enctype="multipart/form-data"'); ?>

   <table border="0" width="100%" cellspacing="0" cellpadding="2">

     <tr>

       <td><table border="0" width="100%" cellspacing="0" cellpadding="0">

         <tr>

           <td class="pageHeading"><?php echo sprintf(TEXT_NEW_PRODUCT, tep_output_generated_category_path($current_category_id)); ?></td>

           <td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

         </tr>

       </table></td>

     </tr>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

     </tr>

     <tr>

       <td><table border="0" cellspacing="0" cellpadding="2">

         <tr>

           <td class="main"><?php echo TEXT_PRODUCTS_STATUS; ?></td>

           <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_radio_field('products_status', '1', $in_status) . ' ' . TEXT_PRODUCT_AVAILABLE . ' ' . tep_draw_radio_field('products_status', '0', $out_status) . ' ' . TEXT_PRODUCT_NOT_AVAILABLE; ?></td>

         </tr>

         <tr>

           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

         </tr>

         <tr>

           <td class="main"><?php echo TEXT_PRODUCTS_DATE_AVAILABLE; ?><br><small>(YYYY-MM-DD)</small></td>

           <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' '; ?><script language="javascript">dateAvailable.writeControl(); dateAvailable.dateFormat="yyyy-MM-dd";</script></td>

         </tr>

         <tr>

           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

         </tr>

         <tr>

           <td class="main"><?php echo TEXT_PRODUCTS_MANUFACTURER; ?></td>

           <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, $pInfo->manufacturers_id); ?></td>

         </tr>

         <tr>

           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

         </tr>

<?php

   for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

?>

         <tr>

           <td class="main"><?php if ($i == 0) echo TEXT_PRODUCTS_NAME; ?></td>

           <td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('products_name[' . $languages[$i]['id'] . ']', (isset($products_name[$languages[$i]['id']]) ? $products_name[$languages[$i]['id']] : tep_get_products_name($pInfo->products_id, $languages[$i]['id']))); ?></td>

         </tr>

<?php

   }

?>

         <tr>

           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

         </tr>

         <tr bgcolor="#ebebff">

           <td class="main"><?php echo TEXT_PRODUCTS_TAX_CLASS; ?></td>

           <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_pull_down_menu('products_tax_class_id', $tax_class_array, $pInfo->products_tax_class_id, 'onchange="updateGross()"'); ?></td>

         </tr>

         <tr bgcolor="#ebebff">

           <td class="main"><?php echo TEXT_PRODUCTS_PRICE_NET; ?></td>

           <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_price', $pInfo->products_price, 'onKeyUp="updateGross()"'); ?></td>

         </tr>

         <tr bgcolor="#ebebff">

           <td class="main"><?php echo TEXT_PRODUCTS_PRICE_GROSS; ?></td>

           <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_price_gross', $pInfo->products_price, 'OnKeyUp="updateNet()"'); ?></td>

         </tr>

         <tr>

           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

         </tr>

<script language="javascript"><!--

updateGross();

//--></script>

<?php

   for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

?>

         <tr>

           <td class="main" valign="top"><?php if ($i == 0) echo TEXT_PRODUCTS_DESCRIPTION; ?></td>

           <td><table border="0" cellspacing="0" cellpadding="0">

             <tr>

               <td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td>

               <td class="main"><?php echo tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (isset($products_description[$languages[$i]['id']]) ? $products_description[$languages[$i]['id']] : tep_get_products_description($pInfo->products_id, $languages[$i]['id']))); ?></td>

             </tr>

           </table></td>

         </tr>

<?php

   }

?>

         <tr>

           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

         </tr>

         <tr>

           <td class="main"><?php echo TEXT_PRODUCTS_QUANTITY; ?></td>

           <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_quantity', $pInfo->products_quantity); ?></td>

         </tr>

         <tr>

           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

         </tr>

         <tr>

           <td class="main"><?php echo TEXT_PRODUCTS_MODEL; ?></td>

           <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('products_model', $pInfo->products_model); ?></td>

         </tr>

         <tr>

           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

         </tr>

         <tr>

           <td class="main"><?php echo TEXT_PRODUCTS_IMAGE; ?></td>

       <?php if (HTML_AREA_WYSIWYG_DISABLE == 'Disable') { ?>

           <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_file_field('products_image') . '<br>' . tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . $pInfo->products_image . tep_draw_hidden_field('products_previous_image', $pInfo->products_image); ?></td>

       <?php }else{ ?>

           <td class="main"><?php echo '<table border="0" cellspacing="0" cellpadding="0"><tr><td class="main">' . tep_draw_separator('pixel_trans.gif', '24', '15') . '  </td><td class="main">' . tep_draw_textarea_field('products_image', 'soft', '70', '2', $pInfo->products_image) . tep_draw_hidden_field('products_previous_image', $pInfo->products_image) . '</td></tr></table>'; ?></td>

       <?php } ?>

         </tr>

         <tr>

           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

         </tr>

<?php

   for ($i=0, $n=sizeof($languages); $i<$n; $i++) {

?>

         <tr>

           <td class="main"><?php if ($i == 0) echo TEXT_PRODUCTS_URL . '<br><small>' . TEXT_PRODUCTS_URL_WITHOUT_HTTP . '</small>'; ?></td>

           <td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . tep_draw_input_field('products_url[' . $languages[$i]['id'] . ']', (isset($products_url[$languages[$i]['id']]) ? $products_url[$languages[$i]['id']] : tep_get_products_url($pInfo->products_id, $languages[$i]['id']))); ?></td>

         </tr>

<?php

   }

?>

         <tr>

           <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

         </tr>

         <tr>

           <td class="main"><?php echo TEXT_PRODUCTS_WEIGHT; ?></td>

           <td class="main"><?php echo tep_draw_separator('pixel_trans.gif'

Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...

I finally got this contrib working partially anyway on my shop

 

my prob is if i click on insert image icon

it brings up the image manager popup

but

cant do anything as there is an error message in the space where the file listing would be as follows:-

 

Invalid base directory: /home/admin/public_html/shop/htmlarea/plugins/ImageManager/shop/images/htmlarea

 

I have this set in my htmlarea.js

if (typeof _editor_url == "string") {

// Leave exactly one backslash at the end of _editor_url

_editor_url = _editor_url.replace(/\x2f*$/, '/');

} else {

alert("WARNING: _editor_url is not set! You should set this variable to the editor files path; it should preferably be an absolute path, like in '/htmlarea/', but it can be relative if you prefer. Further we will try to load the editor files correctly but we'll probably fail.");

_editor_url = '/home/admin/public_html/shop/htmlarea/';

}

 

I am using the latest version taken from the contrib i.e. the 24th Jan 2005 version

 

ANyone have any ideas ?

Link to comment
Share on other sites

just in case anyone has same problem, here is what i did to cure my problem

 

I opened up /htmlarea/plugins/ImageManager/config.inc.php

 

and changed the following:-

 

#$IMConfig['base_dir'] = 'c:/www/assets/';

$IMConfig['base_dir'] = '/home/admin/public_html/shop/images/htmlarea/';

 

#$IMConfig['base_url'] = 'http://127.0.0.1/assets/';

$IMConfig['base_url'] = 'http://www.mysiteurl.co.uk/shop/images/htmlarea/';

 

 

and that worked fine :)

 

It original had

$IMConfig['base_dir'] = DIR_FS_CATALOG . DIR_WS_IMAGES . 'htmlarea';;

 

and

 

$IMConfig['base_url'] = HTTP_SERVER . DIR_WS_HTTP_CATALOG . DIR_WS_IMAGES . 'htmlarea';

Link to comment
Share on other sites

  • 1 month later...

Thumnails Images showing as broken in Image POP UP

 

I've been using HTML Area for some weeks on another server and it was working fine. However, I've just moved the site and everything works except the thumbnails on the image pop in the admin area.

 

Has anyone encounted this and if so, how do i fix it

 

Cheers

 

Richard

Link to comment
Share on other sites

  • 1 month later...

I?ve successfully installed this great contribution, but for some reason if a page has two or more text areas, the second or so time the editor is not the same as the first text area.

 

Lighting it up, if in the first field has 20 buttons in the editor, the second has only 15, the third 13...

 

Does anyone know why this is happening?

 

 

Thank?s for help AND for the contribution!

 

Claudio

Link to comment
Share on other sites

  • 5 weeks later...

Ok, installed the latest version (25 jan 2005) and got everything to work. I fibbled around with the searchpath for the INSERT IMG plugin (located in plugins/imageManager/config.inc.php) to match where I want the defaultpath to be.

 

Everything seems to be working except one thing. The first character in the image name disapears after inserts. If the image is named image.jpg the result of the insert is mage.jpg.

 

If I write the imagename as iimage.jpg then it works. Any solution? anyone?

Link to comment
Share on other sites

  • 3 weeks later...
just in case anyone has same problem, here is what i did to cure my problem

 

I opened up /htmlarea/plugins/ImageManager/config.inc.php

 

and changed the following:-

 

#$IMConfig['base_dir'] = 'c:/www/assets/';

$IMConfig['base_dir'] = '/home/admin/public_html/shop/images/htmlarea/';

 

#$IMConfig['base_url'] = 'http://127.0.0.1/assets/';

$IMConfig['base_url'] = 'http://www.mysiteurl.co.uk/shop/images/htmlarea/';

and that worked fine :)

 

It original had

$IMConfig['base_dir'] = DIR_FS_CATALOG . DIR_WS_IMAGES . 'htmlarea';;

 

and

 

$IMConfig['base_url'] = HTTP_SERVER . DIR_WS_HTTP_CATALOG . DIR_WS_IMAGES . 'htmlarea';

 

i figured this out i. you dont need to change the config you just need to add a folder in the catalog/images folder called "htmlarea" and it should run fine

Link to comment
Share on other sites

  • 2 weeks later...

I just installed this add-on feature into my site, and found it is really helpful!! My greatest appreciation to all guys developing this add-on.

 

In addition to IE6.0, I'm using Mozilla 5.0 (or is it Firefox 1.0.2). With this browser, the display is not quite correct. For example, when font color is altered, the font size become small and fixed, and there are more abnormal operation under Firefox 1.0.2 browser.

 

Does anyone have idea to solve this problem???

 

Thanks!!!!

Link to comment
Share on other sites

  • 2 months later...

im having a problem with this contrib. everything seems to have been installed correctly but my admin/catagories.php is erroring.

 

im getting this error

 

Fatal error: Call to undefined function: tep_array_merge() in /home/my/website/catalog/admin/categories.php on line 712

 

heres my catagories.php file can someone help me out? i cant see any product catagories or anything

 

<?php

/*

$Id: categories.php,v 1.138 2002/11/18 21:38:22 dgw_ Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright (c) 2002 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

require(DIR_WS_CLASSES . 'currencies.php');

$currencies = new currencies();

 

if ($HTTP_GET_VARS['action']) {

switch ($HTTP_GET_VARS['action']) {

case 'setflag':

if ( ($HTTP_GET_VARS['flag'] == '0') || ($HTTP_GET_VARS['flag'] == '1') ) {

if ($HTTP_GET_VARS['pID']) {

tep_set_product_status($HTTP_GET_VARS['pID'], $HTTP_GET_VARS['flag']);

}

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('categories');

tep_reset_cache_block('also_purchased');

}

}

 

tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $HTTP_GET_VARS['cPath']));

break;

case 'insert_category':

case 'update_category':

$categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);

$sort_order = tep_db_prepare_input($HTTP_POST_VARS['sort_order']);

 

$sql_data_array = array('sort_order' => $sort_order);

 

if ($HTTP_GET_VARS['action'] == 'insert_category') {

$insert_sql_data = array('parent_id' => $current_category_id,

'date_added' => 'now()');

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

tep_db_perform(TABLE_CATEGORIES, $sql_data_array);

$categories_id = tep_db_insert_id();

} elseif ($HTTP_GET_VARS['action'] == 'update_category') {

$update_sql_data = array('last_modified' => 'now()');

$sql_data_array = tep_array_merge($sql_data_array, $update_sql_data);

tep_db_perform(TABLE_CATEGORIES, $sql_data_array, 'update', 'categories_id = \'' . $categories_id . '\'');

}

 

$languages = tep_get_languages();

for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {

$categories_name_array = $HTTP_POST_VARS['categories_name'];

$language_id = $languages[$i]['id'];

$sql_data_array = array('categories_name' => tep_db_prepare_input($categories_name_array[$language_id]));

if ($HTTP_GET_VARS['action'] == 'insert_category') {

$insert_sql_data = array('categories_id' => $categories_id,

'language_id' => $languages[$i]['id']);

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

tep_db_perform(TABLE_CATEGORIES_DESCRIPTION, $sql_data_array);

} elseif ($HTTP_GET_VARS['action'] == 'update_category') {

tep_db_perform(TABLE_CATEGORIES_DESCRIPTION, $sql_data_array, 'update', 'categories_id = \'' . $categories_id . '\' and language_id = \'' . $languages[$i]['id'] . '\'');

}

}

 

$categories_image = tep_get_uploaded_file('categories_image');

$image_directory = tep_get_local_path(DIR_FS_CATALOG_IMAGES);

 

if (is_uploaded_file($categories_image['tmp_name'])) {

tep_db_query("update " . TABLE_CATEGORIES . " set categories_image = '" . $categories_image['name'] . "' where categories_id = '" . tep_db_input($categories_id) . "'");

tep_copy_uploaded_file($categories_image, $image_directory);

}

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('categories');

tep_reset_cache_block('also_purchased');

}

 

tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories_id));

break;

case 'delete_category_confirm':

if ($HTTP_POST_VARS['categories_id']) {

$categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);

 

$categories = tep_get_category_tree($categories_id, '', '0', '', true);

$products = array();

$products_delete = array();

 

for ($i = 0, $n = sizeof($categories); $i < $n; $i++) {

$product_ids_query = tep_db_query("select products_id from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . $categories[$i]['id'] . "'");

while ($product_ids = tep_db_fetch_array($product_ids_query)) {

$products[$product_ids['products_id']]['categories'][] = $categories[$i]['id'];

}

}

 

reset($products);

while (list($key, $value) = each($products)) {

$category_ids = '';

for ($i = 0, $n = sizeof($value['categories']); $i < $n; $i++) {

$category_ids .= '\'' . $value['categories'][$i] . '\', ';

}

$category_ids = substr($category_ids, 0, -2);

 

$check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . $key . "' and categories_id not in (" . $category_ids . ")");

$check = tep_db_fetch_array($check_query);

if ($check['total'] < '1') {

$products_delete[$key] = $key;

}

}

 

// Removing categories can be a lengthy process

tep_set_time_limit(0);

for ($i = 0, $n = sizeof($categories); $i < $n; $i++) {

tep_remove_category($categories[$i]['id']);

}

 

reset($products_delete);

while (list($key) = each($products_delete)) {

tep_remove_product($key);

}

}

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('categories');

tep_reset_cache_block('also_purchased');

}

 

tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));

break;

case 'delete_product_confirm':

if ( ($HTTP_POST_VARS['products_id']) && (is_array($HTTP_POST_VARS['product_categories'])) ) {

$product_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);

$product_categories = $HTTP_POST_VARS['product_categories'];

 

for ($i = 0, $n = sizeof($product_categories); $i < $n; $i++) {

tep_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . tep_db_input($product_id) . "' and categories_id = '" . tep_db_input($product_categories[$i]) . "'");

}

 

$product_categories_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . tep_db_input($product_id) . "'");

$product_categories = tep_db_fetch_array($product_categories_query);

 

if ($product_categories['total'] == '0') {

tep_remove_product($product_id);

}

}

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('categories');

tep_reset_cache_block('also_purchased');

}

 

tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath));

break;

case 'move_category_confirm':

if ( ($HTTP_POST_VARS['categories_id']) && ($HTTP_POST_VARS['categories_id'] != $HTTP_POST_VARS['move_to_category_id']) ) {

$categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);

$new_parent_id = tep_db_prepare_input($HTTP_POST_VARS['move_to_category_id']);

tep_db_query("update " . TABLE_CATEGORIES . " set parent_id = '" . tep_db_input($new_parent_id) . "', last_modified = now() where categories_id = '" . tep_db_input($categories_id) . "'");

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('categories');

tep_reset_cache_block('also_purchased');

}

}

 

tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $new_parent_id . '&cID=' . $categories_id));

break;

case 'move_product_confirm':

$products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);

$new_parent_id = tep_db_prepare_input($HTTP_POST_VARS['move_to_category_id']);

 

$duplicate_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . tep_db_input($products_id) . "' and categories_id = '" . tep_db_input($new_parent_id) . "'");

$duplicate_check = tep_db_fetch_array($duplicate_check_query);

if ($duplicate_check['total'] < 1) tep_db_query("update " . TABLE_PRODUCTS_TO_CATEGORIES . " set categories_id = '" . tep_db_input($new_parent_id) . "' where products_id = '" . tep_db_input($products_id) . "' and categories_id = '" . $current_category_id . "'");

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('categories');

tep_reset_cache_block('also_purchased');

}

 

tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $new_parent_id . '&pID=' . $products_id));

break;

case 'insert_product':

case 'update_product':

if ( ($HTTP_POST_VARS['edit_x']) || ($HTTP_POST_VARS['edit_y']) ) {

$HTTP_GET_VARS['action'] = 'new_product';

} else {

$products_id = tep_db_prepare_input($HTTP_GET_VARS['pID']);

$products_date_available = tep_db_prepare_input($HTTP_POST_VARS['products_date_available']);

 

$products_date_available = (date('Y-m-d') < $products_date_available) ? $products_date_available : 'null';

 

$sql_data_array = array('products_quantity' => tep_db_prepare_input($HTTP_POST_VARS['products_quantity']),

'products_model' => tep_db_prepare_input($HTTP_POST_VARS['products_model']),

'products_image' => (($HTTP_POST_VARS['products_image'] == 'none') ? '' : tep_db_prepare_input($HTTP_POST_VARS['products_image'])),

'products_price' => tep_db_prepare_input($HTTP_POST_VARS['products_price']),

'products_date_available' => $products_date_available,

'products_weight' => tep_db_prepare_input($HTTP_POST_VARS['products_weight']),

'products_status' => tep_db_prepare_input($HTTP_POST_VARS['products_status']),

'products_tax_class_id' => tep_db_prepare_input($HTTP_POST_VARS['products_tax_class_id']),

'manufacturers_id' => tep_db_prepare_input($HTTP_POST_VARS['manufacturers_id']));

 

if ($HTTP_GET_VARS['action'] == 'insert_product') {

$insert_sql_data = array('products_date_added' => 'now()');

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

tep_db_perform(TABLE_PRODUCTS, $sql_data_array);

$products_id = tep_db_insert_id();

tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . $products_id . "', '" . $current_category_id . "')");

} elseif ($HTTP_GET_VARS['action'] == 'update_product') {

$update_sql_data = array('products_last_modified' => 'now()');

$sql_data_array = tep_array_merge($sql_data_array, $update_sql_data);

tep_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', 'products_id = \'' . tep_db_input($products_id) . '\'');

}

 

$languages = tep_get_languages();

for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {

$language_id = $languages[$i]['id'];

 

$sql_data_array = array('products_name' => tep_db_prepare_input($HTTP_POST_VARS['products_name'][$language_id]),

'products_description' => tep_db_prepare_input($HTTP_POST_VARS['products_description'][$language_id]),

'products_url' => tep_db_prepare_input($HTTP_POST_VARS['products_url'][$language_id]));

 

if ($HTTP_GET_VARS['action'] == 'insert_product') {

$insert_sql_data = array('products_id' => $products_id,

'language_id' => $language_id);

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

tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);

} elseif ($HTTP_GET_VARS['action'] == 'update_product') {

tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array, 'update', 'products_id = \'' . tep_db_input($products_id) . '\' and language_id = \'' . $language_id . '\'');

}

}

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('categories');

tep_reset_cache_block('also_purchased');

}

 

tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id));

}

break;

case 'copy_to_confirm':

if ( (tep_not_null($HTTP_POST_VARS['products_id'])) && (tep_not_null($HTTP_POST_VARS['categories_id'])) ) {

$products_id = tep_db_prepare_input($HTTP_POST_VARS['products_id']);

$categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);

 

if ($HTTP_POST_VARS['copy_as'] == 'link') {

if ($HTTP_POST_VARS['categories_id'] != $current_category_id) {

$check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . tep_db_input($products_id) . "' and categories_id = '" . tep_db_input($categories_id) . "'");

$check = tep_db_fetch_array($check_query);

if ($check['total'] < '1') {

tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . tep_db_input($products_id) . "', '" . tep_db_input($categories_id) . "')");

}

} else {

$messageStack->add_session(ERROR_CANNOT_LINK_TO_SAME_CATEGORY, 'error');

}

} elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') {

$product_query = tep_db_query("select products_quantity, products_model, products_image, products_price, products_date_available, products_weight, products_tax_class_id, manufacturers_id from " . TABLE_PRODUCTS . " where products_id = '" . tep_db_input($products_id) . "'");

$product = tep_db_fetch_array($product_query);

 

tep_db_query("insert into " . TABLE_PRODUCTS . " (products_quantity, products_model,products_image, products_price, products_date_added, products_date_available, products_weight, products_status, products_tax_class_id, manufacturers_id) values ('" . $product['products_quantity'] . "', '" . $product['products_model'] . "', '" . $product['products_image'] . "', '" . $product['products_price'] . "', now(), '" . $product['products_date_available'] . "', '" . $product['products_weight'] . "', '0', '" . $product['products_tax_class_id'] . "', '" . $product['manufacturers_id'] . "')");

$dup_products_id = tep_db_insert_id();

 

$description_query = tep_db_query("select language_id, products_name, products_description, products_url from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . tep_db_input($products_id) . "'");

while ($description = tep_db_fetch_array($description_query)) {

tep_db_query("insert into " . TABLE_PRODUCTS_DESCRIPTION . " (products_id, language_id, products_name, products_description, products_url, products_viewed) values ('" . $dup_products_id . "', '" . $description['language_id'] . "', '" . addslashes($description['products_name']) . "', '" . addslashes($description['products_description']) . "', '" . $description['products_url'] . "', '0')");

}

 

tep_db_query("insert into " . TABLE_PRODUCTS_TO_CATEGORIES . " (products_id, categories_id) values ('" . $dup_products_id . "', '" . tep_db_input($categories_id) . "')");

$products_id = $dup_products_id;

}

 

if (USE_CACHE == 'true') {

tep_reset_cache_block('categories');

tep_reset_cache_block('also_purchased');

}

}

 

tep_redirect(tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $categories_id . '&pID=' . $products_id));

break;

}

}

 

// check if the catalog image directory exists

if (is_dir(DIR_FS_CATALOG_IMAGES)) {

if (!is_writeable(DIR_FS_CATALOG_IMAGES)) $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_NOT_WRITEABLE, 'error');

} else {

$messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_DOES_NOT_EXIST, 'error');

}

?>

<!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 . ' - ' . HEADING_TITLE . ' - Mode: ' . HTML_AREA_WYSIWYG_BASIC_PD . ' - HTML Status: ' . HTML_AREA_WYSIWYG_DISABLE;?></title>

<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">

<script language="javascript" src="includes/general.js"></script>

 

 

<script language="Javascript1.2"><!-- // load htmlarea

//MaxiDVD Added WYSIWYG HTML Area Box + Admin Function v1.6.5 <head>

_editor_url = "<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_ADMIN; ?>htmlarea/"; // URL to htmlarea files

var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);

if (navigator.userAgent.indexOf('Mac') >= 0) { win_ie_ver = 0; }

if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }

if (navigator.userAgent.indexOf('Opera') >= 0) { win_ie_ver = 0; }

<?php if (HTML_AREA_WYSIWYG_BASIC_PD == 'Basic'){ ?> if (win_ie_ver >= 5.5) {

document.write('<scr' + 'ipt src="' +_editor_url+ 'editor_basic.js"');

document.write(' language="Javascript1.2"></scr' + 'ipt>');

} else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }

<?php } else{ ?> if (win_ie_ver >= 5.5) {

document.write('<scr' + 'ipt src="' +_editor_url+ 'editor_advanced.js"');

document.write(' language="Javascript1.2"></scr' + 'ipt>');

} else { document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>'); }

<?php }?>

// --></script>

 

 

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">

<div id="spiffycalendar" class="text"></div>

<!-- header //-->

<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

 

<!-- body //-->

<table border="0" width="100%" cellspacing="2" cellpadding="2">

<tr>

<td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">

<!-- left_navigation //-->

<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>

<!-- left_navigation_eof //-->

</table></td>

<!-- body_text //-->

<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2">

<?php

if ($HTTP_GET_VARS['action'] == 'new_product') {

if ( ($HTTP_GET_VARS['pID']) && (!$HTTP_POST_VARS) ) {

$product_query = tep_db_query("select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . $HTTP_GET_VARS['pID'] . "' and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "'");

$product = tep_db_fetch_array($product_query);

 

$pInfo = new objectInfo($product);

} elseif ($HTTP_POST_VARS) {

$pInfo = new objectInfo($HTTP_POST_VARS);

$products_name = $HTTP_POST_VARS['products_name'];

$products_description = $HTTP_POST_VARS['products_description'];

$products_url = $HTTP_POST_VARS['products_url'];

} else {

$pInfo = new objectInfo(array());

}

 

$manufacturers_array = array(array('id' => '', 'text' => TEXT_NONE));

$manufacturers_query = tep_db_query("select manufacturers_id, manufacturers_name from " . TABLE_MANUFACTURERS . " order by manufacturers_name");

while ($manufacturers = tep_db_fetch_array($manufacturers_query)) {

$manufacturers_array[] = array('id' => $manufacturers['manufacturers_id'],

'text' => $manufacturers['manufacturers_name']);

}

 

$tax_class_array = array(array('id' => '0', 'text' => TEXT_NONE));

$tax_class_query = tep_db_query("select tax_class_id, tax_class_title from " . TABLE_TAX_CLASS . " order by tax_class_title");

while ($tax_class = tep_db_fetch_array($tax_class_query)) {

$tax_class_array[] = array('id' => $tax_class['tax_class_id'],

'text' => $tax_class['tax_class_title']);

}

 

$languages = tep_get_languages();

 

switch ($pInfo->products_status) {

case '0': $in_status = false; $out_status = true; break;

case '1':

default: $in_status = true; $out_status = false;

}

?>

<link rel="stylesheet" type="text/css" href="includes/javascript/spiffyCal/spiffyCal_v2_1.css">

<script language="JavaScript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script>

<script language="javascript">

var dateAvailable = new ctlSpiffyCalendarBox("dateAvailable", "new_product", "products_date_available","btnDate1","<?php echo $pInfo->products_date_available; ?>",scBTNMODE_CUSTOMBLUE);

</script>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo sprintf(TEXT_NEW_PRODUCT, tep_output_generated_category_path($current_category_id)); ?></td>

<td class="pageHeading" align="right"><?php echo tep_draw_separator('pixel_trans.gif', HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr><?php echo tep_draw_form('new_product', FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $HTTP_GET_VARS['pID'] . '&action=new_product_preview', 'post', 'enctype="multipart/form-data"'); ?>

<td><table border="0" cellspacing="0" cellpadding="2">

<tr>

<td class="main"><?php echo TEXT_PRODUCTS_STATUS; ?></td>

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '?' . tep_draw_radio_field('products_status', '1', $in_status) . '?' . TEXT_PRODUCT_AVAILABLE . '?' . tep_draw_radio_field('products_status', '0', $out_status) . '?' . TEXT_PRODUCT_NOT_AVAILABLE; ?></td>

</tr>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td class="main"><?php echo TEXT_PRODUCTS_DATE_AVAILABLE; ?><br><small>(YYYY-MM-DD)</small></td>

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '?'; ?><script language="javascript">dateAvailable.writeControl(); dateAvailable.dateFormat="yyyy-MM-dd";</script></td>

</tr>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td class="main"><?php echo TEXT_PRODUCTS_MANUFACTURER; ?></td>

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '?' . tep_draw_pull_down_menu('manufacturers_id', $manufacturers_array, $pInfo->manufacturers_id); ?></td>

</tr>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<?php

for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {

?>

<tr>

<td class="main"><?php if ($i == 0) echo TEXT_PRODUCTS_NAME; ?></td>

<td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '?' . tep_draw_input_field('products_name[' . $languages[$i]['id'] . ']', (($products_name[$languages[$i]['id']]) ? stripslashes($products_name[$languages[$i]['id']]) : tep_get_products_name($pInfo->products_id, $languages[$i]['id']))); ?></td>

</tr>

<?php

}

?>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<?php

for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {

?>

<tr>

<td class="main" valign="top"><?php if ($i == 0) echo TEXT_PRODUCTS_DESCRIPTION; ?></td>

<td><table border="0" cellspacing="0" cellpadding="0">

<tr>

<td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?>?</td>

<td class="main"><?php echo tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']', 'soft', '70', '15', (($products_description[$languages[$i]['id']]) ? stripslashes($products_description[$languages[$i]['id']]) : tep_get_products_description($pInfo->products_id, $languages[$i]['id']))); ?></td>

</tr>

</table></td>

</tr>

<?php

}

?>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td class="main"><?php echo TEXT_PRODUCTS_QUANTITY; ?></td>

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '?' . tep_draw_input_field('products_quantity', $pInfo->products_quantity); ?></td>

</tr>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td class="main"><?php echo TEXT_PRODUCTS_MODEL; ?></td>

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '?' . tep_draw_input_field('products_model', $pInfo->products_model); ?></td>

</tr>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td class="main"><?php echo TEXT_PRODUCTS_IMAGE; ?></td>

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '?' . tep_draw_file_field('products_image') . '<br>' . tep_draw_separator('pixel_trans.gif', '24', '15') . '?' . $pInfo->products_image . tep_draw_hidden_field('products_previous_image', $pInfo->products_image); ?></td>

</tr>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<?php

for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {

?>

<tr>

<td class="main"><?php if ($i == 0) echo TEXT_PRODUCTS_URL . '<br><small>' . TEXT_PRODUCTS_URL_WITHOUT_HTTP . '</small>'; ?></td>

<td class="main"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '?' . tep_draw_input_field('products_url[' . $languages[$i]['id'] . ']', (($products_url[$languages[$i]['id']]) ? stripslashes($products_url[$languages[$i]['id']]) : tep_get_products_url($pInfo->products_id, $languages[$i]['id']))); ?></td>

</tr>

<?php

}

?>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td class="main"><?php echo TEXT_PRODUCTS_PRICE; ?></td>

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '?' . tep_draw_input_field('products_price', $pInfo->products_price); ?></td>

</tr>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td class="main"><?php echo TEXT_PRODUCTS_TAX_CLASS; ?></td>

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '?' . tep_draw_pull_down_menu('products_tax_class_id', $tax_class_array, $pInfo->products_tax_class_id); ?></td>

</tr>

<tr>

<td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td class="main"><?php echo TEXT_PRODUCTS_WEIGHT; ?></td>

<td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . '?' . tep_draw_input_field('products_weight', $pInfo->products_weight); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td class="main" align="right"><?php echo tep_draw_hidden_field('products_date_added', (($pInfo->products_date_added) ? $pInfo->products_date_added : date('Y-m-d'))) . tep_image_submit('button_preview.gif', IMAGE_PREVIEW) . '??<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $HTTP_GET_VARS['pID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>'; ?></td>

</form></tr>

 

 

<?php if (HTML_AREA_WYSIWYG_DISABLE == 'Disable') {} else { ?>

<script language="JavaScript1.2" defer>

// MaxiDVD Added WYSIWYG HTML Area Box + Admin Function v1.6.5 Products Description

var config = new Object(); // create new config object

config.width = "<?php echo HTML_AREA_WYSIWYG_WIDTH; ?>px";

config.height = "<?php echo HTML_AREA_WYSIWYG_HEIGHT; ?>px";

config.bodyStyle = 'background-color: <?php echo HTML_AREA_WYSIWYG_BG_COLOUR; ?>; font-family: "<?php echo HTML_AREA_WYSIWYG_FONT_TYPE; ?>"; color: <?php echo HTML_AREA_WYSIWYG_FONT_COLOUR; ?>; font-size: <?php echo HTML_AREA_WYSIWYG_FONT_SIZE; ?>pt;';

config.debug = <?php echo HTML_AREA_WYSIWYG_DEBUG; ?>;

// More Configs can added here:

// Dreamscape added Dynamic Language Function

<?php for ($i = 0, $n = sizeof($languages); $i < $n; $i++) { ?>

editor_generate('products_description[<?php echo $languages[$i]['id']; ?>]',config);

<?php } } ?>

</script>

 

 

<?php

} elseif ($HTTP_GET_VARS['action'] == 'new_product_preview') {

if ($HTTP_POST_VARS) {

$pInfo = new objectInfo($HTTP_POST_VARS);

$products_name = $HTTP_POST_VARS['products_name'];

$products_description = $HTTP_POST_VARS['products_description'];

$products_url = $HTTP_POST_VARS['products_url'];

 

// copy image only if modified

$products_image = tep_get_uploaded_file('products_image');

$image_directory = tep_get_local_path(DIR_FS_CATALOG_IMAGES);

 

if (is_uploaded_file($products_image['tmp_name'])) {

tep_copy_uploaded_file($products_image, $image_directory);

$products_image_name = $products_image['name'];

} else {

$products_image_name = $HTTP_POST_VARS['products_previous_image'];

}

} else {

$product_query = tep_db_query("select p.products_id, pd.language_id, pd.products_name, pd.products_description, pd.products_url, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = pd.products_id and p.products_id = '" . $HTTP_GET_VARS['pID'] . "'");

$product = tep_db_fetch_array($product_query);

 

$pInfo = new objectInfo($product);

$products_image_name = $pInfo->products_image;

}

 

$form_action = ($HTTP_GET_VARS['pID']) ? 'update_product' : 'insert_product';

 

echo tep_draw_form($form_action, FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $HTTP_GET_VARS['pID'] . '&action=' . $form_action, 'post', 'enctype="multipart/form-data"');

 

$languages = tep_get_languages();

for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {

if ($HTTP_GET_VARS['read'] == 'only') {

$pInfo->products_name = tep_get_products_name($pInfo->products_id, $languages[$i]['id']);

$pInfo->products_description = tep_get_products_description($pInfo->products_id, $languages[$i]['id']);

$pInfo->products_url = tep_get_products_url($pInfo->products_id, $languages[$i]['id']);

} else {

$pInfo->products_name = tep_db_prepare_input($products_name[$languages[$i]['id']]);

$pInfo->products_description = tep_db_prepare_input($products_description[$languages[$i]['id']]);

$pInfo->products_url = tep_db_prepare_input($products_url[$languages[$i]['id']]);

}

?>

<tr>

<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr>

<td class="pageHeading"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . '?' . $pInfo->products_name; ?></td>

<td class="pageHeading" align="right"><?php echo $currencies->format($pInfo->products_price); ?></td>

</tr>

</table></td>

</tr>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td class="main"><?php echo tep_image(DIR_WS_CATALOG_IMAGES . $products_image_name, $pInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'align="right" hspace="5" vspace="5"') . $pInfo->products_description; ?></td>

</tr>

<?php

if ($pInfo->products_url) {

?>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<tr>

<td class="main"><?php echo sprintf(TEXT_PRODUCT_MORE_INFORMATION, $pInfo->products_url); ?></td>

</tr>

<?php

}

?>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<?php

if ($pInfo->products_date_available > date('Y-m-d')) {

?>

<tr>

<td align="center" class="smallText"><?php echo sprintf(TEXT_PRODUCT_DATE_AVAILABLE, tep_date_long($pInfo->products_date_available)); ?></td>

</tr>

<?php

} else {

?>

<tr>

<td align="center" class="smallText"><?php echo sprintf(TEXT_PRODUCT_DATE_ADDED, tep_date_long($pInfo->products_date_added)); ?></td>

</tr>

<?php

}

?>

<tr>

<td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td>

</tr>

<?php

}

 

if ($HTTP_GET_VARS['read'] == 'only') {

if ($HTTP_GET_VARS['origin']) {

$pos_params = strpos($HTTP_GET_VARS['origin'], '?', 0);

if ($pos_params != false) {

$back_url = substr($HTTP_GET_VARS['origin'], 0, $pos_params);

$back_url_params = substr($HTTP_GET_VARS['origin'], $pos_params + 1);

} else {

$back_url = $HTTP_GET_VARS['origin'];

$back_url_params = '';

}

} else {

$back_url = FILENAME_CATEGORIES;

$back_url_params = 'cPath=' . $cPath . '&pID=' . $pInfo->products_id;

}

?>

<tr>

<td align="right"><?php echo '<a href="' . tep_href_link($back_url, $back_url_params, 'NONSSL') . '">' . tep_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>

</tr>

<?php

} else {

?>

<tr>

<td align="right" class="smallText">

<?php

/* Re-Post all POST'ed variables */

reset($HTTP_POST_VARS);

while (list($key, $value) = each($HTTP_POST_VARS)) {

if (!is_array($HTTP_POST_VARS[$key])) {

echo tep_draw_hidden_field($key, htmlspecialchars(stripslashes($value)));

}

}

$languages = tep_get_languages();

for ($i = 0, $n = sizeof($languages); $i < $n; $i++) {

echo tep_draw_hidden_field('products_name[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_name[$languages[$i]['id']])));

echo tep_draw_hidden_field('products_description[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_description[$languages[$i]['id']])));

echo tep_draw_hidden_field('products_url[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_url[$languages[$i]['id']])));

}

echo tep_draw_hidden_field('products_image', stripslashes($products_image_name));

 

echo tep_image_submit('button_back.gif', IMAGE_BACK, 'name="edit"') . '??';

 

if ($HTTP_GET_VARS['pID']) {

echo tep_image_submit('button_update.gif', IMAGE_UPDATE);

} else {

echo tep_image_submit('button_insert.gif', IMAGE_INSERT);

}

echo '??<a href="' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $HTTP_GET_VARS['pID']) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>';

?></td>

</form></tr>

<?php

}

} else {

?>

<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 tep_draw_separator('pixel_trans.gif', 1, HEADING_IMAGE_HEIGHT); ?></td>

<td align="right"><table border="0" width="100%" cellspacing="0" cellpadding="0">

<tr><?php echo tep_draw_form('search', FILENAME_CATEGORIES, '', 'get'); ?>

<td class="smallText" align="right"><?php echo HEADING_TITLE_SEARCH . ' ' . tep_draw_input_field('search', $HTTP_GET_VARS['search']); ?></td>

</form></tr>

<tr><?php echo tep_draw_form('goto', FILENAME_CATEGORIES, '', 'get'); ?>

<td class="smallText" align="right"><?php echo HEADING_TITLE_GOTO . ' ' . tep_draw_pull_down_menu('cPath', tep_get_category_tree(), $current_category_id, 'onChange="this.form.submit();"'); ?></td>

</form></tr>

</table></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_CATEGORIES_PRODUCTS; ?></td>

<td class="dataTableHeadingContent" align="center"><?php echo TABLE_HEADING_STATUS; ?></td>

<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_ACTION; ?>?</td>

</tr>

<?php

$categories_count = 0;

$rows = 0;

if ($HTTP_GET_VARS['search']) {

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . $languages_id . "' and cd.categories_name like '%" . $HTTP_GET_VARS['search'] . "%' order by c.sort_order, cd.categories_name");

} else {

$categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . $current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . $languages_id . "' order by c.sort_order, cd.categories_name");

}

while ($categories = tep_db_fetch_array($categories_query)) {

$categories_count++;

$rows++;

 

// Get parent_id for subcategories if search

if ($HTTP_GET_VARS['search']) $cPath= $categories['parent_id'];

 

if ( ((!$HTTP_GET_VARS['cID']) && (!$HTTP_GET_VARS['pID']) || (@$HTTP_GET_VARS['cID'] == $categories['categories_id'])) && (!$cInfo) && (substr($HTTP_GET_VARS['action'], 0, 4) != 'new_') ) {

$category_childs = array('childs_count' => tep_childs_in_category_count($categories['categories_id']));

$category_products = array('products_count' => tep_products_in_category_count($categories['categories_id']));

 

$cInfo_array = tep_array_merge($categories, $category_childs, $category_products);

$cInfo = new objectInfo($cInfo_array);

}

 

if ( (is_object($cInfo)) && ($categories['categories_id'] == $cInfo->categories_id) ) {

echo ' <tr class="dataTableRowSelected" onmouseover="this.style.cursor=\'hand\'" onclick="document.location.href=\'' . tep_href_link(FILENAME_CATEGORIES, tep_get_path($categories['categories_id'])) . '\'">' . "\n";

} else {

echo ' <tr class="dataTableRow" onmouseover="this.className=\'dataTableRowOver\';this.style.cursor=\'hand\'" onmouseout="this.className=\'dataTableRow\'" onclick="document.location.href=\'' . tep_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . '&cID=' . $categories['categories_id']) . '\'">' . "\n";

}

?>

<td class="dataTableContent"><?php echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, tep_get_path($categories['categories_id'])) . '">' . tep_image(DIR_WS_ICONS . 'folder.gif',

Link to comment
Share on other sites

  • 1 month later...

Hi

i have readed all 6 page of post and nothing work..

Now i spend one day to make this work...

 

Whi the creator dont make a flise changes in the contributio, whi dont put the categories.php an other file modded????

 

Becouse not all are programmers

 

And because it does not explain better like step 1 open categories.php and bla bla blab..

 

 

I repeat not all are programmers if to be able to help I am thankful

Link to comment
Share on other sites

  • 1 month later...
OK, that explains it. I had to put it in the root directory and it's fine now.

 

BUT here's the new problem. Because I have the header tags controller installed, the 3 text boxes for <TITLE>, meta description, and meta keywords show the html area buttons.

 

How can I have those 3 text boxes revert back to normal text so the buttons aren't displayed?

-George

[email protected]

732-794-6225

Hi George, do you still remember how to fix this problem?

Link to comment
Share on other sites

  • 2 weeks later...

_editor_url_is not set ....

 

This is the error I get when loading the catalog page. I want to be able to use the wysiwug editor mainly in the text area when adding new products. It does show up when going to edit a product and i can use it but this error pops up every time i go to a new screen in catagories.php. Where do i alter these settings? I will paste the code from my catagories.php page, please HELP. Thanks for the help, greatly appreciated. Also how do I add fonts? I put the htmlarea in the root of my site, which is the catalog root.

 

......

<!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">

<script language="javascript" src="includes/general.js"></script>

<!-- DWD Modify -> Add: HTMLArea v3.0 !-->

<!-- Load HTMLArea Core Files. !-->

<script type="text/javascript" src="/htmlarea/htmlarea.js"></script>

<script type="text/javascript" src="/htmlarea/dialog.js"></script>

<script type="text/javascript" src="/htmlarea/lang/en.js"></script>

 

<!-- Load HTMLArea Plugins. !-->

<script type="text/javascript">

HTMLArea.loadPlugin("TableOperations");

HTMLArea.loadPlugin("SpellChecker");

</script>

 

<!-- Load HTMLArea StyleSheet. !-->

<style type="text/css">

@import url(/htmlarea/htmlarea.css);

</style>

<!-- DWD Modify End. !-->

</head>

.......

 

.......

?>

<tr>

<td class="main" valign="top"><?php if ($i == 0) echo TEXT_PRODUCTS_DESCRIPTION; ?></td>

<td><table border="0" cellspacing="0" cellpadding="0">

<tr>

<td class="main" valign="top"><?php echo tep_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td>

<td class="main"><?php echo tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']', 'soft', '100%', '500', (isset($products_description[$languages[$i]['id']]) ? $products_description[$languages[$i]['id']] : tep_get_products_description($pInfo->products_id, $languages[$i]['id']))); ?></td>

</tr>

</table></td>

</tr>

<?php

 

.......

Link to comment
Share on other sites

  • 1 month later...

Download contribution: HTMLArea (htmlarea_1_2_3_4_5.zip)

Version: 3.0

osCommerce: 2.2-MS1, 2.2-MS2

 

I doesn?t work

What I did:

coppied htmlarea to the following folders (I know one folder is enough):

/shop/catalog/htmlarea/

and

/shop/catalog/admin/htmlarea/

 

I made all this changes in:

categories.php

(Iknow I must changes some other files (tell_a_friend.php, contact_us.php, mail.php, manufacturers.php, newsletters.php), but I first want to test it for edititing categories)

 

------- FIND -------

<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">

...

</head>

 

--- BETWEEN ADD ----

<!-- DWD Modify -> Add: HTMLArea v3.0 !-->

<!-- Load HTMLArea Core Files. !-->

<script type="text/javascript" src="/htmlarea/htmlarea.js"></script>

<script type="text/javascript" src="/htmlarea/dialog.js"></script>

<script type="text/javascript" src="/htmlarea/lang/en.js"></script>

 

<!-- Load HTMLArea Plugins. !-->

<script type="text/javascript">

HTMLArea.loadPlugin("TableOperations");

HTMLArea.loadPlugin("SpellChecker");

</script>

 

<!-- Load HTMLArea StyleSheet. !-->

<style type="text/css">

@import url(/htmlarea/htmlarea.css);

</style>

<!-- DWD Modify End. !-->

-------------------------------------------------------------------------------

 

I did a little bit more (I used htmlarea and /htmlarea):

 

******

<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">

 

<!-- DWD Modify -> Add: HTMLArea v3.0 !-->

<!-- Load HTMLArea Core Files. !-->

<?php include(DIR_FS_CATALOG . 'htmlarea/htmlarea.php'); ?>

 

<script type="text/javascript" src="htmlarea/htmlarea.js"></script>

<script type="text/javascript" src="htmlarea/dialog.js"></script>

<script type="text/javascript" src="htmlarea/lang/en.js"></script>

 

<!-- Load HTMLArea Plugins. !-->

<script type="text/javascript">

HTMLArea.loadPlugin("TableOperations");

HTMLArea.loadPlugin("SpellChecker");

</script>

 

<!-- Load HTMLArea StyleSheet. !-->

<style type="text/css">

@import url(htmlarea/htmlarea.css);

</style>

<!-- DWD Modify End. !-->

<script language="javascript" src="includes/general.js"></script>

 

 

</head>

 

******

 

 

2. Set HTMLArea to replace all TextArea

------- FIND -------

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" ...>

 

--- REPLACE WITH ---

</head>

<!-- DWD Modify -> Replace: HTMLArea v3.0 !-->

<!-- <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" ...> !-->

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" ... onload="HTMLArea.replaceAll(config)">

<!-- DWD Modify End. !-->

 

My changes:

*****

</head>

<!-- DWD Modify -> Replace: HTMLArea v3.0 !-->

<!-- <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();"> !-->

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus(); onload="HTMLArea.replaceAll()">

<!-- DWD Modify End. !-->

*****

 

-------------------------------------------------------------------------------

3. Enlarge previous TextArea size

------- FIND -------

<?php echo tep_draw_textarea_field('...', 'soft', '60', '15'); ?>

 

--- REPLACE WITH ---

<!-- DWD Modify -> Replace: HTMLArea v3.0 !-->

<?php echo tep_draw_textarea_field('...', 'soft', '100%', '20'); ?>

<!-- DWD Modify End. !-->

-------------------------------------------------------------------------------

 

What I did:

 

*****

<td class="main"><?php echo tep_draw_textarea_field('products_description[' . $languages[$i]['id'] . ']', 'soft', '100%', '20', (isset($products_description[$languages[$i]['id']]) ? stripslashes($products_description[$languages[$i]['id']]) : tep_get_products_description($pInfo->products_id, $languages[$i]['id']))); ?></td>

*****

 

 

============================================

Link to comment
Share on other sites

  • 2 months later...

Hi everyone this mod is great and works well but I have 2 issues i cant figure out..

 

I have setup a switch to turn the editor on and off but it doesnt work

 

I have:

 

<?php

if (HTML_AREA_WYSIWYG_DISABLE == 'Enable') {

?>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="HTMLArea.replaceAll(configb)">

<?php

} else {

?>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF"b>

<?php

}

?>[code]

 

i would have thought this should work to turn the editor on and off but it doesnt

 

anyone know i way i can achieve this?

 

 

[b]The second issue[/b]

 

I have header tags installed and i only want the html editor on the products description field (oh and on a short secription box) but it displays on all area fields

 

how can i stop this?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...