Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Additional Images Module


Parikesit

Recommended Posts

Unfortunatly, I'm still not able to fix the following, could anybody help?

 

Thanks to fredfillah, I was able to correct some bugs for my MS2 version. But. It still doesn't work at my webshop. There are two problems:

 

1. The pictures I had allready attatched to products appear twice now. The upper one is a bit rescaled. Should I delete the image that is attatched to the product before installing this contribution?

 

2. I can't add images. There are no errors, but if I push the 'add image' button, the 'Image description', 'new image' and 'popup image' form comes up, but if I enter the information and click 'save' nothing happens and I just am redirected to the normal Categories / Products page. Also no green bar appears at the top with 'image uploaded' or so, although I don't know if to expect this.

Link to comment
Share on other sites

My popup image was added even though it gave no 'green bar' notification.

 

It didn't show the new image on the admin panel

 

and on product_info.php the HTML path to the 'new images' has issues,

 

but it worked ok in the popup.

 

 

So, I changed the code in the additional_images modual and product_info to only show the new popup image when the original 'Click to enlarge' is pressed...

 

 

I think the broken path to the image files on the profuct_info page can be fixed by putting a copy of the new images in both the HTTP and HTTPS folders.

 

But I agree, it needs the green bar notification - not enough time in the day for these things...

 

Also it would be nice to be able to visually identify the new images on the Categories / Products page and the delete page...

Link to comment
Share on other sites

The MOD works great but the additional images show twice, once below the main image and once again a little lower under the "This product was added to our catalog on Friday 15 August, 2003." text.

 

Can I somehow fix this ?

 

Thanks to anybody

 

Ed

 

-----

If information was gold, we all be rich.

Link to comment
Share on other sites

Can anyone show me a working site using this contribution? I'm about to start a new shop with ms2 and want to get a good solution for the images.

 

cheers

K

K

.....................................................................

When the going get's tough,

the tough get going.

Link to comment
Share on other sites

I have updated this contribution to work with MS2 and will be releasing it later on today once I have run through my installation instructions to check everything. I may also post a URL where you can see it in action if I have time to setup a demo site :D

tobz

 

osCommerce Links

osCommerce Templates

osCommerce UK <-- This site is for sale!

Link to comment
Share on other sites

  • 3 weeks later...

Just found another typo that may help some one.

 

Once I installed this Additional Images Mod, and corrected any typos listed in this thread here.... I had another error message, and found another typo...

 

Mine was around line 353 in file:

admin/categories.php

 

was:

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

 

I changed to:

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

 

Once I then corrected this, it worked great!

 

cheers

Rip

Link to comment
Share on other sites

Nice mod, just thought I'd bring up one or two issues...

 

1) Popup image for the default image (top right of product info page) no longer works, just get a white page - I'm looking into this though.

 

2) Typo in the distribution ZIP file for the contribution. In admin\categories_changes file, at the bottom of the file...

 

 ? ?
for ($i=0; $i<[B]si[/B]($additional_images_id); $i++) {
? ? ? ? ? ? tep_db_query("[B]te[/B] from " . TABLE_ADDITIONAL_IMAGES . " where additional_images_id = '" . tep_db_input($additional_images_id[$i]) . "'");
? ? ? ? ? } ? ? ? ? ? ? ? 
? ? ? ? } ? ? ? ? ? ? ? ? 
? ? ? ? //tep_db_query("[B]de[/B] from " . TABLE_ADDITIONAL_IMAGES . " where additional_images_id = '" . $HTTP_POST_VARS['additional_images_id'] . "'");
? ? ? ? tep_redirect([B]tep_hlink[/B](FILENAME_CATEGORIES, 'cPath=' . $cPath . '&pID=' . $products_id));

 

bold bits are invalid... a search / replace gone wrong perhaps? The code is correct in the Categories.php file though :D

 

edit... ok, the bolding didn't work, but the bits between the bold brackets are the bits that are wrong!

Edited by MGSteve
Link to comment
Share on other sites

I've got a few contributions to make for this contribution! - How do I submit them. I've added routines in to delete the images from the server if the images are removed from the product - but only if they are not used in other products.

 

Also fixed one omission - when products are deleted, the additional images are not (from the DB or file).

 

So, the contribution would:

 

Delete additional photos if the additional photos were deleted against a product

Delete additional photos if the product was deleted

Delete default photo if the default photo was changed (currently doesn't delete it)

 

All of these will not delete an image that is used on other products as either the default image or additional images.

 

About an hour or twos work there :D

 

Where'd I send it then?

Link to comment
Share on other sites

  • 3 weeks later...

I just installed the additional images mod and so far the catalog looks fine, however I'm haveing problems in the admin section. I get the following error on admin/categories.php

 

parse error in /home/decorato/public_html/catalog/admin/categories.php on line 324.

 

Here is the code on that line. Any help with this would be appreiciated.

 

 

 case 'add_images':

 

 

I can't see the problem

 

M.D'Souza

Can't see the forest for the trees

Sinbad

"Mine is not the only way, mine is just another way

Link to comment
Share on other sites

  • 4 weeks later...

OKay again with the dead thread post...lol Seriously folks I fnally managed to get this thing to work now the question I have is does any one actually have the button images that were supposed to be with this mod? It would be of great help so that I don't have to listen to the person inputing my catalog gripe about how ugly it is.

 

Thanks

 

Ron

Ron

If we knew it all we wouldn't be here would we?

Link to comment
Share on other sites

I just tried installing this mod and I get the following error. Don't know what to make of it. I'm on MS1 and used the latest version for that level.

 

Warning: copy(/home/virtual/site19/fst/var/www/html/catalog/images/ah-nklc-005.jpg) [function.copy]: failed to create stream: Permission denied in /home/virtual/site19/fst/var/www/html/catalog/admin/categories.php on line 298

 

Warning: Cannot modify header information - headers already sent by (output started at /home/virtual/site19/fst/var/www/html/catalog/admin/categories.php:298) in /home/virtual/site19/fst/var/www/html/catalog/admin/includes/functions/general.php on line 18

Link to comment
Share on other sites

  • 1 month later...

Hi guys, which of the patches, upgrades, installs, fixes etc is the correct link to click on for the latest, and most ironed out "additional image contribution"? I am still using 2.2MS1. Any pointers in this regard would be appreciated. I really need this contribution and hope that it would be part of the final release. A BIG thanx to everybody that obviously has more brains than myself for sorting out all the error msgs.

 

;)

From all the things I lost, I miss my mind the most - Ozzy Ozborne

Link to comment
Share on other sites

  • 1 month later...

in admin part everything is ok but when i've tried to add photo i've got some erorrs in my shop

 

Parse error: parse error, expecting `T_OLD_FUNCTION' or `T_FUNCTION' or `T_VAR' or `'}'' in /home/httpd/vhosts/sklep.deska.pl/httpdocs/includes/classes/boxes.php on line 99

 

and

 

Fatal error: Cannot instantiate non-existent class: infoboxheading in /home/httpd/vhosts/sklep.deska.pl/httpdocs/includes/boxes/categories.php on line 68

 

pleas help me ;]

 

cheers

 

marcin

Link to comment
Share on other sites

  • 4 weeks later...
  • 4 weeks later...

can anyone just send me all the files they have generated, im useing version MS1, so i get an error, all i need is the categories.php file.. Thanks alot (mail [email protected])

 

This is my categories.php file.

 

This is the error it gives me:

Parse error: parse error in /usr/local/psa/home/vhosts/tord.no/httpdocs/shop3/admin/categories.php on line 547

 

The thing that would be easiest is if someone just could send me an categories.php file that works.. ;) thanks

 

<?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++) {

$delimg_query = tep_db_query("select medium_images, popup_images from " . TABLE_ADDITIONAL_IMAGES . " where products_id = '" . (int)$product_id . "'");

           while ($delimg = tep_db_fetch_array($delimg_query)){

              if (tep_not_null($delimg['medium_images']) && file_exists(DIR_FS_CATALOG_IMAGES.$delimg['medium_images']) )

                 if (!unlink (DIR_FS_CATALOG_IMAGES.$delimg['medium_images']))

                    $messageStack->add_session(ERROR_DEL_IMG_XTRA.$delimg['medium_images'], 'error');

                 else

                    $messageStack->add_session(SUCCESS_DEL_IMG_XTRA.$delimg['medium_images'], 'success');

              if (tep_not_null($delimg['popup_images']) && file_exists(DIR_FS_CATALOG_IMAGES.$delimg['popup_images']) )

                 if (!unlink (DIR_FS_CATALOG_IMAGES.$delimg['popup_images']))

                    $messageStack->add_session(ERROR_DEL_IMG_XTRA.$delimg['popup_images'], 'error');

                 else

                    $messageStack->add_session(SUCCESS_DEL_IMG_XTRA.$delimg['popup_images'], 'success');

           }

           tep_db_query("delete from " . TABLE_ADDITIONAL_IMAGES . " where products_id = '" . (int)$product_id . "'");

           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) . '\'');

         }

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

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

         }

 

         $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; ?></title>

<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"><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 class="main"><?php echo TEXT_PRODUCTS_IMAGE_POP; ?></td>

           <td class="main"><?php echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_file_field('products_image_pop') . '<br>' . tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . $pInfo->products_image_pop . tep_draw_hidden_field('products_previous_image_pop', $pInfo->products_image_pop); ?></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

 } 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'];

       $products_image_name_pop = $pInfo->products_image_pop;

     } 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']]);

     }

case 'add_images':

       $products_id = $HTTP_GET_VARS['pID'];

       $add_images_error = true;

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

         $add_images_error = false;

         $sql_data_array = array('products_id' => tep_db_prepare_input($products_id),

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

                                 'medium_images' => tep_db_prepare_input($medium_images->filename));

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

           $add_data_array = array('popup_images' => tep_db_prepare_input($popup_images->filename));

         } else {

           $add_data_array = array('popup_images' => tep_db_prepare_input($medium_images->filename));          

         }

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

       }

 

       if ($add_images_error == false) {

         tep_db_perform(TABLE_ADDITIONAL_IMAGES, $sql_data_array);

       } else {

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

       }

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

       break;

     case 'del_images':

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

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

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

         for ($i=0; $i<sizeof($additional_images_id); $i++) {

//SECTION DELETE POPUP IMAGES

           $delimg_query = tep_db_query("select medium_images, popup_images from " . TABLE_ADDITIONAL_IMAGES . " where additional_images_id = '" . tep_db_input($additional_images_id[$i]) . "'");

           $delimg = tep_db_fetch_array($delimg_query);

Edited by tordeman
Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...

Great idea for this MOD... however when I log into my admin area, this is what I see in the area that I am supposed to be able to admin the images. ? ⠯誱嫿?﫻⠾?ల譮ꮠī?থ 㨭ૼ 尮⬠ࢼ ﳱ

 

I know what I did SOMETHING wrong I just do not know what it is. I thought that I had followed the directions. But apparently I didn't. Any ideas of what went wrong.

Link to comment
Share on other sites

Images

 

Title Value Action

Small Image Width 100

Small Image Height 150

Heading Image Width 57

Heading Image Height 40

Subcategory Image Width 100

Subcategory Image Height 150

Calculate Image Size true

Image Required true

Display Image Width 0

ب ᰠ栥쮩 ꠰輯td> 150

Display Image Height 120

? ᰠ栥쮩 ꠰輯td> 120

Popup Image Width

ب Ɐ뻢ྐྵ婠꠰輯td>

Popup Image Height

? Ɐ뻢ྐྵ婠꠰輯td>

Small Image Width

 

 

The pixel width of small images

 

Date Added: 05/12/2004

 

 

THis is what I get in my images sections.

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