Juto Posted January 23, 2013 Share Posted January 23, 2013 Hi, I have tried to write a script to avoid product preview when the products id is set. So far I have this: <?php //Avoid preview: //Bobby Easland (RIP) //http://www.oscommerce.com/forums/topic/153391-skip-preview-on-product-insert-or-update/ //Add before the body tag: switch($_GET['action']){ case 'new_product_preview': $onload = isset($_GET['pID']) ? 'document.update_product.submit();' : 'document.insert_product.submit();'; break; default: $onload = 'SetFocus();'; break; } ?> Which I have changed to include ajax attribute manager, like so: <?php if ($current_page == FILENAME_CATEGORIES) { //Avoid preview, update instantly: if ( (isset($_GET['read']) && ($_GET['read'] != 'only')) && ( isset($_GET['action']) == 'new_product_preview') ) { $onload = isset($_GET['pID']) ? 'document.update_product.submit();' : 'document.insert_product.submit();'; } else { //ajax attribute manager $onload = 'goonload();'; require_once( 'attributeManager/includes/attributeManagerHeader.inc.php' ); echo '</head>'."\n".'<body onload="'. $onload .'">'; } } else { echo '</head>'."\n".'<body onload="SetFocus();">'; } ?> Sorry to say I still get the preview, not instant update (clicking the preview button) So anybody have a suggestion, please comment. I would love to have this working Many Thanks Sara Contributions: http://addons.oscommerce.com/info/8010 http://addons.oscommerce.com/info/8204 http://addons.oscommerce.com/info/8681 Link to comment Share on other sites More sharing options...
♥ecartz Posted January 23, 2013 Share Posted January 23, 2013 Try changing } else { //ajax attribute manager $onload = 'goonload();'; require_once( 'attributeManager/includes/attributeManagerHeader.inc.php' ); echo '</head>'."\n".'<body onload="'. $onload .'">'; } to } else { //ajax attribute manager $onload = 'goonload();'; require_once( 'attributeManager/includes/attributeManagerHeader.inc.php' ); } echo '</head>'."\n".'<body onload="'. $onload .'">'; Always back up before making changes. Link to comment Share on other sites More sharing options...
Juto Posted January 23, 2013 Author Share Posted January 23, 2013 @@ecartz Hi Matt! Thanks for your answer. I have just tested your suggestion, which gave the same result... no instant update... If you have a site with AMA installed, Could you please test the snippet? I am totally lost... Thanks Sara Contributions: http://addons.oscommerce.com/info/8010 http://addons.oscommerce.com/info/8204 http://addons.oscommerce.com/info/8681 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.