Guest Posted May 31, 2005 Posted May 31, 2005 In admin/categories.php find this code: <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> <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();"> ...and change it to this: <!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> <? switch($_GET['action']){ case 'new_product_preview': $onload = isset($_GET['pID']) ? 'document.update_product.submit();' : 'document.insert_product.submit();'; break; default: $onload = 'SetFocus();'; break; } ?> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="<? echo $onload; ?>"> ...all done. Now on new product insert or existing product update it will skip the preview page completely (actually, auto submit instantly on page load). Enjoy! Bobby
spr1nt Posted June 4, 2005 Posted June 4, 2005 chemo....thaaaaaank you. ive been trying to do this but with my limited php knowledge the only results ive been getting are error messages. im sure this will help many others !
kitchenniche Posted June 9, 2005 Posted June 9, 2005 Great! this saves a lot of time! HIM - Dark Light - Out on 26/09/05
bibleman Posted July 23, 2005 Posted July 23, 2005 In admin/categories.php find this code: <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> <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();"> ...and change it to this: <!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> <? switch($_GET['action']){ case 'new_product_preview': $onload = isset($_GET['pID']) ? 'document.update_product.submit();' : 'document.insert_product.submit();'; break; default: $onload = 'SetFocus();'; break; } ?> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="<? echo $onload; ?>"> ...all done. Now on new product insert or existing product update it will skip the preview page completely (actually, auto submit instantly on page load). Enjoy! Bobby <{POST_SNAPBACK}> Hi Bobby, GREAT hack BUT..... It all worked great but when you double click on a product in the products list under it's catagory then the product gets deleted! Did anyone else experience this? I'm having a great Day - hope you are too! Leon
Guest Posted July 24, 2005 Posted July 24, 2005 Hi Bobby, GREAT hack BUT..... It all worked great but when you double click on a product in the products list under it's catagory then the product gets deleted! Did anyone else experience this? <{POST_SNAPBACK}> Yep. I have the same problem
PVK Posted July 24, 2005 Posted July 24, 2005 Hmmm this was exactly what i was searching for, but the last 2 posts are a bit worrysome, which make me a bit unsure if it is wise to implement this great modification since it is a bit scary that you can actually delete products so easy (which sooner or later is bound to happen!) Anybody figured it out yet?
Guest Posted July 27, 2005 Posted July 27, 2005 Hmmm this was exactly what i was searching for, but the last 2 posts are a bit worrysome, which make me a bit unsure if it is wise to implement this great modification since it is a bit scary that you can actually delete products so easy (which sooner or later is bound to happen!)Anybody figured it out yet? <{POST_SNAPBACK}> Anyone Fixed this yet???
Guest Posted July 31, 2005 Posted July 31, 2005 Anyone Fixed this yet??? <{POST_SNAPBACK}> Yup I also have the same problem. Mod uninstalled.
pulsecheck Posted August 1, 2005 Posted August 1, 2005 I had to uninstall the mode cause I experienced the same problem
rbartz Posted August 24, 2005 Posted August 24, 2005 Here is the fix for the problem where the product is "deleted" (actually emptied of data...) when you click the product line to preview it: Between the </head> and <body....... lines make it like this: </head> <? if ($_GET['read'] != "only") { switch($_GET['action']){ case 'new_product_preview': $onload = isset($_GET['pID']) ? 'document.update_product.submit();' : 'document.insert_product.submit();'; break; case 'new_master_preview': $onload = isset($_GET['pID']) ? 'document.update_master.submit();' : 'document.insert_master.submit();'; break; default: $onload = 'SetFocus();'; break; } } else { $onload = 'SetFocus();'; } ?> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="<? echo $onload; ?>"> There! You might want to change the Preview Button to Save.... SORRY about the tabbing and spacing, for some reason I cannot get the input to do it.... I edited it three times trying, I am done. duhhhhh
akvario Posted November 25, 2007 Posted November 25, 2007 Thanks, just what i was looking for, confirmed working.
Guest Posted March 23, 2008 Posted March 23, 2008 Hi I really want this, but I already have an onload in my body from ajax attribute manager. Any idea how to get this anyway?
Stevio Posted June 24, 2008 Posted June 24, 2008 HiI really want this, but I already have an onload in my body from ajax attribute manager. Any idea how to get this anyway? You can use this (if you're using rbartz fix): <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="goOnLoad();<? echo $onload; ?>">
lviera Posted July 5, 2008 Posted July 5, 2008 I added this code to my file but I still have to preview the items then update. Here is what my code looks like now. Do you see anything missing? <!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> <? if ($_GET['read'] != "only") {switch($_GET['action']){case 'new_product_preview':$onload = isset($_GET['pID']) ? 'document.update_product.submit();' : 'document.insert_product.submit();';break;case 'new_master_preview':$onload = isset($_GET['pID']) ? 'document.update_master.submit();' : 'document.insert_master.submit();';break;default:$onload = 'SetFocus();';break;}} else {$onload = 'SetFocus();';}?> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();">
Guest Posted December 3, 2008 Posted December 3, 2008 HiI really want this, but I already have an onload in my body from ajax attribute manager. Any idea how to get this anyway? You can have more than one statement in an onLoad statement- Just separate them with a semicolon...HTH
spooks Posted December 3, 2008 Posted December 3, 2008 A different method I use that gives the option of instant update instead (adds a tick box) after (18) $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : ''); add: if ($_POST['instant_update'] == 'on') { $products_image = new upload('products_image'); $products_image->set_destination(DIR_FS_CATALOG_IMAGES); if ($products_image->parse() && $products_image->save()) { $_POST['products_image'] = $products_image->filename; } else { $_POST['products_image'] = (isset($_POST['products_previous_image']) ? $_POST['products_previous_image'] : ''); } $action = 'update_product'; } after (596) <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> add: <tr> <td class="main" align="right">Update without preview <?php echo tep_draw_checkbox_field('instant_update', '', false); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> simple as that!! B) Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al.
spooks Posted December 3, 2008 Posted December 3, 2008 Minor Addendum: I missed something: if ($_POST['instant_update'] == 'on') { $products_image = new upload('products_image'); $products_image->set_destination(DIR_FS_CATALOG_IMAGES); if ($products_image->parse() && $products_image->save()) { $_POST['products_image'] = $products_image->filename; } else { $_POST['products_image'] = (isset($_POST['products_previous_image']) ? $_POST['products_previous_image'] : ''); } $action = 'update_product'; } Should be: if ($_POST['instant_update'] == 'on') { $products_image = new upload('products_image'); $products_image->set_destination(DIR_FS_CATALOG_IMAGES); if ($products_image->parse() && $products_image->save()) { $_POST['products_image'] = $products_image->filename; } else { $_POST['products_image'] = (isset($_POST['products_previous_image']) ? $_POST['products_previous_image'] : ''); } $action = (isset($_GET['pID'])) ? 'update_product' : 'insert_product'; } Oops. :blush: Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al.
LED-Store Posted December 22, 2008 Posted December 22, 2008 @ spooks Great code, better than the previous solution. But now the product_image doesnt get updated. Did anyone else get this error too? Thanks and regards!
AndreD Posted March 25, 2009 Posted March 25, 2009 Sam, I like your solution, but can you please add "before/after" instructions on where to modify ? - my line numbers are not the same as yours. also, what's with the picture -updating ?
edealer Posted September 12, 2009 Posted September 12, 2009 HiI really want this, but I already have an onload in my body from ajax attribute manager. Any idea how to get this anyway? You can make this work with your AJAX Attribute module by changing rbarts code as follows: FIND THIS: $onload = 'SetFocus();'; break; } } else { $onload = 'SetFocus();'; } CHANGE TO THIS: $onload = 'goOnLoad();'; break; } } else { $onload = 'goOnLoad();'; } That way when your not submitting an update or insert, the onLoad is set to what you need for AJAX. :o) David McGuffin - Website Developer New Look Web Design www.newlookwebdesign.com --------------------------------------------------------------------- "I never memorize anything I can simply look up. . ." ~Albert Einstien
spooks Posted September 13, 2009 Posted September 13, 2009 I forgot this, this is my latest code: Open Admin/categories.php find (18) $action = (isset($HTTP_GET_VARS['action']) ? $HTTP_GET_VARS['action'] : ''); Add After: // instant update if ($action == 'new_product_preview') { // 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'] : ''); } if ($_POST['instant_update'] == 'on') { $_POST['products_image'] = stripslashes($products_image_name); $action = (isset($_GET['pID']) ? 'update_product' : 'insert_product'); } } // EOF instant update Find(366) case 'new_product_preview': // 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'] : ''); } break; Replace with: // section moved, instant update Find (596) <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> add after: <tr> <td class="main" align="right">Update without preview <?php echo tep_draw_checkbox_field('instant_update', '', false); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> Sam Remember, What you think I ment may not be what I thought I ment when I said it. Contributions: Auto Backup your Database, Easy way Multi Images with Fancy Pop-ups, Easy way Products in columns with multi buy etc etc Disable any Category or Product, Easy way Secure & Improve your account pages et al.
LED-Store Posted September 19, 2009 Posted September 19, 2009 I forgot this, this is my latest code: Same thing, if you select a new picture, with the skip preview it doesnt get updated. The rest works fine...
blr044 Posted September 21, 2009 Posted September 21, 2009 Find(366) case 'new_product_preview': // 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'] : ''); } break; Replace with: // section moved, instant update [/font] Sam, your tip sure is a step savings. I have mod - // BOF: [TiM's osC Solutions] - Better image upload features and the code you are referring to for line 366 is commented out. so is there a way I can incorapte your code into this or do i need to go Tims osc solutions for an answere? this is Tims code: case 'new_product_preview': // copy image only if modified // BOF: [TiM's osC Solutions] - Better image upload features /* * osCommerce is lacking a way to resample and reduce large uploaded photos. * Additionally it's lacking a way to mark the uploaded files as temporary * until admin presses the confirm button. This fixes that. */ // check if uploaded file if (is_uploaded_file($HTTP_POST_FILES['products_image']['tmp_name'])) { // check if image directory exists and is writeable if (!is_dir(DIR_FS_CATALOG_IMAGES)) mkdir(DIR_FS_CATALOG_IMAGES, 0777); if (is_dir(DIR_FS_CATALOG_IMAGES)) { if (!is_writeable(DIR_FS_CATALOG_IMAGES)) { $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_NOT_WRITEABLE, 'error'); break; } } else { $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_DOES_NOT_EXIST, 'error'); break; } // check if products subdirectory exists and is writeable if (!is_dir(DIR_FS_CATALOG_IMAGES . 'products/')) mkdir(DIR_FS_CATALOG_IMAGES . 'products/', 0777); if (is_dir(DIR_FS_CATALOG_IMAGES . 'products/')) { if (!is_writeable(DIR_FS_CATALOG_IMAGES . 'products/')) { $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_NOT_WRITEABLE, 'error'); break; } } else { $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_DOES_NOT_EXIST, 'error'); break; } // require necessary files require_once(DIR_FS_ADMIN . DIR_WS_CLASSES . 'images.php'); // create image object $oImage = new TiM_image($HTTP_POST_FILES['products_image']['tmp_name']); // resample image $oImage->resample(400, 400, 'FIT_ONLY_BIGGER'); // watermark image // uncomment the line below and enter a valid path to an alpha transparent png file //$oImage->watermark('images/watermark.png', 'BOTTOM', 'RIGHT'); // set basename $products_image_name = 'products/_tmp' . mktime() . '.jpg'; // temporary name for automatic renaming //$products_image_name = 'products/' . $HTTP_POST_FILES['products_image']['name']; // keep original name // save image $oImage->write(DIR_FS_CATALOG_IMAGES . $products_image_name); // EOF: [TiM's osC Solutions] - Better image upload features Thanks. Bennett
Recommended Posts
Archived
This topic is now archived and is closed to further replies.