Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Skip/Bypass Product Preview?


AdamPGT

Recommended Posts

Alright, I've been searching the last hour or so with no answer.

 

How do you skip the preview page when you add or update a product?

 

The preview page serves no purpose for me since that's not what my page is going to look like.

 

I would appreciate any help!

 

--Adam

Link to comment
Share on other sites

Adam,

 

You are going to get no responses to your questions if you keep bumping posts.

 

Sorry I dont know the answer to your problem.

 

Mark

Lifes a bitch, then you marry one, then you die!

Link to comment
Share on other sites

Adam,

 

You are going to get no responses to your questions if you keep bumping posts.

 

Sorry I dont know the answer to your problem.

 

Mark

So it would be better for me to post multiple topics? I don't understand what it takes to get help on this board. I have searched for hours on end without any answers, and I don't like posting here for the simple fact I rarely get any answers that way either.

 

--Adam

Link to comment
Share on other sites

Patientce is the key.

 

You have to remember that people on this forum are also trying to run their own businesses.

 

If someone can help you then they will, not one person has all the answers to all the questions/prolems people have with osc.

 

To be quite honest why remove the product preview, why not just use easypopulate to upload your products and then you wont have to go through the preview.

 

Mark

Lifes a bitch, then you marry one, then you die!

Link to comment
Share on other sites

I don't like the easy populate contribution, because I have to type the HTML by hand which takes me just as long as it does doing it with the osC Admin panel. But since I use the WYSIWYG editor for the descriptions, it seems to work a little more quickly.

 

I just want to be able to bypass the preview which will speed up the process a little bit.

 

--Adam

Link to comment
Share on other sites

Come on Adam...it's a simple answer on how to skip product/category preview in the admin control panel.

 

* USE OUTPUT BUFFERS AND PHP HEADER REDIRECTS *

 

What? You don't know what those are? Check PHP's website for output buffering and headers.

 

Go read and learn...then the actual coding will be easier once understand how to do it.

Link to comment
Share on other sites

Come on Adam...it's a simple answer on how to skip product/category preview in the admin control panel.

 

* USE OUTPUT BUFFERS AND PHP HEADER REDIRECTS *

 

What?  You don't know what those are?  Check PHP's website for output buffering and headers.

 

Go read and learn...then the actual coding will be easier once understand how to do it.

 

Right, so much help

Link to comment
Share on other sites

Is that sarcasm? :)  The point is that you currently don't know how to do it but I've pointed you in the right direction so that you have the tools in your arsenal to get it done.

Good call. Okay but here's my problem, I'm somewhat proficient in PHP, not a genius or anything, but I can't even figure out the right place to edit the admin/categories.php file

 

--Adam

Link to comment
Share on other sites

OK...here's a general outlay:

 

Find:

case 'new_product_preview':

This is the beginning of the preview page. Set your output buffer here. I'd use something like:

      case 'new_product_preview':
# Buffer output
ob_start('ob_gzhandler');

This way you also have some compression :)

 

Then, find the code near the bottom where it reposts all the variables and enter them into session. Also, it has several hidden fields. Enter these into session as well.

 

So, it'll look something like this:

      reset($HTTP_POST_VARS);
     while (list($key, $value) = each($HTTP_POST_VARS)) {
       if (is_array($value)) {
         while (list($k, $v) = each($value)) {
           echo tep_draw_hidden_field($key . '[' . $k . ']', htmlspecialchars(stripslashes($v)));
	 # Enter the passed variables into session
	 $_SESSION['post'][$key][$k] = htmlspecialchars(stripslashes($v));
	 #$_SESSION['repost'][$key][$k] = htmlspecialchars(stripslashes($v));
         }
       } else {
         echo tep_draw_hidden_field($key, htmlspecialchars(stripslashes($value)));
   # Enter the passed variables into session
  $_SESSION['post'][$key] = htmlspecialchars(stripslashes($value));
       }
     }

and

        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_notes[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_notes[$languages[$i]['id']])));
 echo tep_draw_hidden_field('products_head_title_tag[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_head_title_tag[$languages[$i]['id']])));
       echo tep_draw_hidden_field('products_head_desc_tag[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_head_desc_tag[$languages[$i]['id']])));
       echo tep_draw_hidden_field('products_head_keywords_tag[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_head_keywords_tag[$languages[$i]['id']])));
       echo tep_draw_hidden_field('products_url[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_url[$languages[$i]['id']])));
     
       $_SESSION['post']['products_name'][$languages[$i]['id']] = stripslashes($products_name[$languages[$i]['id']]);
       $_SESSION['post']['products_description'][$languages[$i]['id']] = stripslashes($products_description[$languages[$i]['id']]);
       $_SESSION['post']['products_notes'][$languages[$i]['id']] = stripslashes($products_notes[$languages[$i]['id']]);
 $_SESSION['post']['products_head_title_tag'][$languages[$i]['id']] = stripslashes($products_head_title_tag[$languages[$i]['id']]);
       $_SESSION['post']['products_head_desc_tag'][$languages[$i]['id']] = stripslashes($products_head_desc_tag[$languages[$i]['id']]);
       $_SESSION['post']['products_head_keywords_tag'][$languages[$i]['id']] = stripslashes($products_head_keywords_tag[$languages[$i]['id']]);
       $_SESSION['post']['products_url'][$languages[$i]['id']] = stripslashes($products_url[$languages[$i]['id']]);

Use that as a guide...your code will be different so don't just copy-n-paste.

 

Then at the top of the categories page use this:

  require('includes/application_top.php');
if (isset($_SESSION['post'])) {
$HTTP_POST_VARS = $_SESSION['post'];
unset($_SESSION['post']);
}

Which then takes the session post and populates the HTTP_POST_VARS.

 

Once again, use that as a guide and not a copy-n-paste.

Link to comment
Share on other sites

  • 2 months later...

Thanks again to Chemo for his consistent contribs and help on the oscommerce project....however, it's sometimes to "advanced" for dumies.

 

I'm trying to bypass the preview screen using Chemo's instruction but I can't make it work. I keep going through the preview page

 

Here is what I did :

 

At the top of the file, I added :

if (isset($_SESSION['post'])) {
$HTTP_POST_VARS = $_SESSION['post'];
unset($_SESSION['post']);
}

 

in the : case 'new_product_preview':

To make it simple, I haven't added the compression function (as I wasn't sure where to close it)

 

To make the update button appear, I added to the "new product form" :

 ? ? ? ? <td class="main" align="right"><?php 
? ? ? if (isset($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 . (isset($HTTP_GET_VARS['pID']) ? '&pID=' . $HTTP_GET_VARS['pID'] : '')) . '"></a>';
? 
?
?></td> ?

 

 

Finally, the var re-post :

/////////////////////////////////////////////////////////////////////
// BOF: WebMakers.com Added: Modified to include Attributes Code
/* Re-Post all POST'ed variables */
     reset($HTTP_POST_VARS);
     while (list($key, $value) = each($HTTP_POST_VARS)) {
       if (is_array($value)) {
         while (list($k, $v) = each($value)) {
           echo tep_draw_hidden_field($key . '[' . $k . ']', htmlspecialchars(stripslashes($v)));
	 
    # Enter the passed variables into session (pour avoir le insert button sans preview
    $_SESSION['post'][$key][$k] = htmlspecialchars(stripslashes($v));
    #$_SESSION['repost'][$key][$k] = htmlspecialchars(stripslashes($v));

         }
       } else {
         echo tep_draw_hidden_field($key, htmlspecialchars(stripslashes($value)));
      # Enter the passed variables into session
   $_SESSION['post'][$key] = htmlspecialchars(stripslashes($value));

       }
     }
  
// EOF: WebMakers.com Added: Modified to include Attributes Code
/////////////////////////////////////////////////////////////////////

$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('technical_description[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($technical_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));
  // Big Image Start
     echo tep_draw_hidden_field('products_mediumimage', stripslashes($products_mediumimage_name));
     echo tep_draw_hidden_field('products_largeimage', stripslashes($products_largeimage_name));
// Big Image End

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

      $_SESSION['post']['products_name'][$languages[$i]['id']] = stripslashes($products_name[$languages[$i]['id']]);
      $_SESSION['post']['products_description'][$languages[$i]['id']] = stripslashes($products_description[$languages[$i]['id']]);
      $_SESSION['post']['technical_description'][$languages[$i]['id']] = stripslashes($technical_description[$languages[$i]['id']]);
   $_SESSION['post']['products_url'][$languages[$i]['id']] = stripslashes($products_url[$languages[$i]['id']]);
  
  }
       $_SESSION['post']['products_image']= stripslashes($products_image);  
       $_SESSION['post']['products_mediumimage']= stripslashes($products_mediumimage);  
       $_SESSION['post']['products_largeimage'] = stripslashes($products_largeimage);  

 

 

I've been trying to find the answer for the past 3 hours, it's driving me nut...could somebody explain me what I'm doing wrong ?

 

 

Thanks

Pat :(

Link to comment
Share on other sites

Sorry to knock again, but could somebody who used Chemo's solution help me.

 

 

Could AdamPGT, for instance, explain us in detail how did he apply Chemo's solution ?

 

Thanks Patrice

 

 

Thanks again to Chemo for his consistent contribs and help on the oscommerce project....however, it's sometimes to "advanced" for dumies.

 

I'm trying to bypass the preview screen using Chemo's instruction but I can't make it work. I keep going through the preview page

 

Here is what I did :

 

At the top of the file, I added :

if (isset($_SESSION['post'])) {
$HTTP_POST_VARS = $_SESSION['post'];
unset($_SESSION['post']);
}

 

in the :  case 'new_product_preview':

To make it simple, I haven't added the compression function (as I wasn't sure where to close it)

 

To make the update button appear, I added to the "new product form" :

 ? ? ? ? <td class="main" align="right"><?php 
? ? ? if (isset($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 . (isset($HTTP_GET_VARS['pID']) ? '&pID=' . $HTTP_GET_VARS['pID'] : '')) . '"></a>';
? 
?
?></td> ?

Finally, the var re-post :

/////////////////////////////////////////////////////////////////////
// BOF: WebMakers.com Added: Modified to include Attributes Code
/* Re-Post all POST'ed variables */
? ? ?reset($HTTP_POST_VARS);
? ? ?while (list($key, $value) = each($HTTP_POST_VARS)) {
? ? ? ?if (is_array($value)) {
? ? ? ? ?while (list($k, $v) = each($value)) {
? ? ? ? ? ?echo tep_draw_hidden_field($key . '[' . $k . ']', htmlspecialchars(stripslashes($v)));
?	
? ? # Enter the passed variables into session (pour avoir le insert button sans preview
? ? $_SESSION['post'][$key][$k] = htmlspecialchars(stripslashes($v));
? ? #$_SESSION['repost'][$key][$k] = htmlspecialchars(stripslashes($v));

? ? ? ? ?}
? ? ? ?} else {
? ? ? ? ?echo tep_draw_hidden_field($key, htmlspecialchars(stripslashes($value)));
? ? ? # Enter the passed variables into session
? ?$_SESSION['post'][$key] = htmlspecialchars(stripslashes($value));

? ? ? ?}
? ? ?}
? 
// EOF: WebMakers.com Added: Modified to include Attributes Code
/////////////////////////////////////////////////////////////////////

$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('technical_description[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($technical_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));
? // Big Image Start
? ? ?echo tep_draw_hidden_field('products_mediumimage', stripslashes($products_mediumimage_name));
? ? ?echo tep_draw_hidden_field('products_largeimage', stripslashes($products_largeimage_name));
// Big Image End

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

? ? ? $_SESSION['post']['products_name'][$languages[$i]['id']] = stripslashes($products_name[$languages[$i]['id']]);
? ? ? $_SESSION['post']['products_description'][$languages[$i]['id']] = stripslashes($products_description[$languages[$i]['id']]);
? ? ? $_SESSION['post']['technical_description'][$languages[$i]['id']] = stripslashes($technical_description[$languages[$i]['id']]);
? ?$_SESSION['post']['products_url'][$languages[$i]['id']] = stripslashes($products_url[$languages[$i]['id']]);
? 
? }
? ? ? ?$_SESSION['post']['products_image']= stripslashes($products_image); ?
? ? ? ?$_SESSION['post']['products_mediumimage']= stripslashes($products_mediumimage); ?
? ? ? ?$_SESSION['post']['products_largeimage'] = stripslashes($products_largeimage); ?

I've been trying to find the answer for the past 3 hours, it's driving me nut...could somebody explain me what I'm doing wrong ?

Thanks

Pat :(

Link to comment
Share on other sites

Knock again....

the point of this forum is not only reading other people answer, it's there to help each other....so please, please help me please..

 

Patrice :blush:

 

Sorry to knock again, but could somebody who used Chemo's solution help me.

Could AdamPGT, for instance, explain us in detail how did he apply Chemo's solution ?

 

Thanks Patrice

Link to comment
Share on other sites

Knock again....

the point of this forum is not only reading other people answer, it's there to help each other....so please, please help me please..

 

Patrice :blush:

Well I'm not PHP expert, and to this day I have not tried Chemo's fix.....but let me give it a shot at some point today and I'll get back to you if I figure it out :D

 

--Adam

Link to comment
Share on other sites

Patrice,

 

Wow...this post is a blast from the past! :)

 

The most likely reason you are still hitting the preview page is that you did not start the buffer. To do that use ob_start() instead of the gz compression as was given earlier.

 

Then, somewhere near the bottom of the page ob_end_clean() to kill the buffer and use a header() to send to the correct page.

 

Bobby

Link to comment
Share on other sites

Hi Bobby

 

Thanks as usual for your help

I will give it a try this evening (it 1200 for me now)

 

See you

Patrice,

 

Wow...this post is a blast from the past! :)

 

The most likely reason you are still hitting the preview page is that you did not start the buffer.  To do that use ob_start() instead of the gz compression as was given earlier.

 

Then, somewhere near the bottom of the page ob_end_clean() to kill the buffer and use a header() to send to the correct page.

 

Bobby

Link to comment
Share on other sites

Hi Bobby,

 

sorry to bother you with my small prob

after trying and trying again, I can't make it work....

 

I added the following before the case new product :

ob_start

at the end of the file I added :

<?php ob_end_clean() ?>

 

In the product edit page, I added (to obtain the insert/update button) :

<?php

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

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

} else {

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

 

}

 

 

 

Finally, I added the "session post" in the reset($HTTP_post_vars) as follow

/////////////////////////////////////////////////////////////////////
// BOF: WebMakers.com Added: Modified to include Attributes Code
/* Re-Post all POST'ed variables */
     reset($HTTP_POST_VARS);
     while (list($key, $value) = each($HTTP_POST_VARS)) {
       if (is_array($value)) {
         while (list($k, $v) = each($value)) {
           echo tep_draw_hidden_field($key . '[' . $k . ']', htmlspecialchars(stripslashes($v)));
   # Enter the passed variables into session
   $_SESSION['post'][$key][$k] = htmlspecialchars(stripslashes($v));
   #$_SESSION['repost'][$key][$k] = htmlspecialchars(stripslashes($v));
         }
       } else {
         echo tep_draw_hidden_field($key, htmlspecialchars(stripslashes($value)));
 # Enter the passed variables into session
    $_SESSION['post'][$key] = htmlspecialchars(stripslashes($value));
       }
     }
// EOF: WebMakers.com Added: Modified to include Attributes Code
/////////////////////////////////////////////////////////////////////
      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));
  // Big Image Start
     echo tep_draw_hidden_field('products_mediumimage', stripslashes($products_mediumimage_name));
     echo tep_draw_hidden_field('products_largeimage', stripslashes($products_largeimage_name));
// Big Image End

    
      $_SESSION['post']['products_name'][$languages[$i]['id']] = stripslashes($products_name[$languages[$i]['id']]);
      $_SESSION['post']['products_description'][$languages[$i]['id']] = stripslashes($products_description[$languages[$i]['id']]);
   $_SESSION['post']['products_image'] = stripslashes($products_image_name);
      $_SESSION['post']['products_mediumimage'] = stripslashes($products_mediumimage_name);
      $_SESSION['post']['products_largeimage'] = stripslashes($products_largeimage_name);
//       $_SESSION['post']['products_url'][$languages[$i]['id']] = stripslashes($products_url[$languages[$i]['id']]);









     echo tep_draw_hidden_field('products_image', stripslashes($products_image_name));
  // Big Image Start
     echo tep_draw_hidden_field('products_mediumimage', stripslashes($products_mediumimage_name));
     echo tep_draw_hidden_field('products_largeimage', stripslashes($products_largeimage_name));
// Big Image End

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

     if (isset($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 . (isset($HTTP_GET_VARS['pID']) ? '&pID=' . $HTTP_GET_VARS['pID'] : '')) . '">' . tep_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>';
?></td>
     </tr>
   </table></form>
<?php
   }
 } else {
?>
   <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 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>
               <td class="smallText" align="right">
<?php
   echo tep_draw_form('search', FILENAME_CATEGORIES, '', 'get');
   echo HEADING_TITLE_SEARCH . ' ' . tep_draw_input_field('search');
   echo '</form>';
?>

 

 

I keep going through the preview page, could you help me a bit more.

 

By the way, I don't understand what you mean by "and use a header() to send to the correct page."

 

 

Thanks for your help

Patrice

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...