Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12
  1. #11
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,571
    Plugin Contributions
    30

    Default Re: Editing a product - Skip the preview, and update immediately

    Thanks. Easy when you know how!

  2. #12
    Join Date
    Aug 2007
    Location
    Gijón, Asturias, Spain
    Posts
    2,571
    Plugin Contributions
    30

    Default Re: Editing a product - Skip the preview, and update immediately

    I updated to this
    Code:
    <script type="text/javascript">
    document.forms['<?php echo $form_action;?>'].submit();auto submit form
    document.title = "Preview:" + document.title;//prefix title so it shows up in browser Back button/history as distinct to product data entry page
    </script>
    and for belt and braces,
    in ADMIN/product.php
    case 'new_product_preview':
    if (isset($_POST) && $_POST['master_categories_id'] !='' ) {//steve added next line and clause to prevent empty POST overwriting product info
    if
    (file_exists(DIR_WS_MODULES . $zc_products->get_handler($product_type) . '/new_product_preview.php')) {
    require(DIR_WS_MODULES . $zc_products->get_handler($product_type) . '/new_product_preview.php');
    } else {
    require(DIR_WS_MODULES . 'new_product_preview.php');
    }
    } else {//steve bof, bail out to categories root
    zen_redirect(zen_href_link(FILENAME_CATEGORIES));
    }//eof
    break;
    Why?
    Now and again I would find a product with an empty master_categories id.
    https://www.zen-cart.com/showthread...._category_id-0

    If after editing and saving a product, I did some other admin stuff then used the navigator Back/history button to go back to Edit Product BUT instead went back to the Preview page by mistake, there was no POST info set.
    This variable contains all the product info (including its master category) but now it is empty. The page then autosubmits/saves the product with all its fields empty effectively wiping out the product.
    Last edited by torvista; 25 Sep 2016 at 10:57 PM.
    Steve
    github.com/torvista: Spanish Language Pack, Google reCaptcha, Structured Data, Multiple Copy-Move-Delete, Image Checker, BackupMySQL Admin/Auto...

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. v139h How to update the facebook page when just editing the product in zencart?
    By lina0962 in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 22 Jan 2014, 06:37 AM
  2. Is it possible to hide the product preview while adding and editing them?
    By scaleachiocciola in forum Customization from the Admin
    Replies: 0
    Last Post: 3 May 2012, 02:54 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR