Zen Cart Logo
Forums / Basic Configuration / admin preview shows code not what site will show

admin preview shows code not what site will show

Views: 1,338

Results 1 to 10 of 10
21 Feb 2013, 3:59 PM
#1
marvin avatar

marvin

Zen Follower

Join Date:
Feb 2006
Posts:
222
Plugin Contributions:
0

admin preview shows code not what site will show

When I am in my Admin and I make a change in a product (in html or source), click on preview, the preview shows source code not html as it would appear on my site.
How can I change this to show preview in HTML before uploading changed product info??

Thanks

Have searched all forums and nothing fits my question.

21 Feb 2013, 5:46 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: admin preview shows code not what site will show

When you reply - scroll up - Read posting tips and provide the information

21 Feb 2013, 7:11 PM
#3
marvin avatar

marvin

Zen Follower

Join Date:
Feb 2006
Posts:
222
Plugin Contributions:
0

Re: admin preview shows code not what site will show

Zen 1.3.8a.

Don't know what else would be relevant to a basic question about the admin. No addons that would affect the Admin.
No error messages involved.

Here's a sample of the "preview" (nothing about it that is, I think, relevant to my question):

English Yao Tong Pian - Plum Flower $12.90
Yao Tong Pian - Plum Flower<b><font size="3">Our Discount Prices </font></b><b><font size="3">$12.90 ea. 3 or more $12.25 ea. 6 or more $11.50 ea.<br /></font></b><p><font size="2">Yao Tong Pian traditional formula is made from Sulfur free herbs. <br />It's GMP certified.<br />Heavy metals tested. <br />Contains no pharmaceuticals, preservatives, sugar or coloring.</font></p><font size="2"><b>Ingredients: </b>Yao Tong Pian contains Angelica sinensis root, Eucommia ulmoides bark, Dipsacus asper root, Cibotium barometz rhizome, Angelica dahurica root, Psoralea corylifolia fruit, Achyranthes bidentata root. -Dang gui, Du zhong, Xu duan, Gou ji, Bai zhu, Bu gu zhi, Huai niu xi.<br /><br /><b>Contains:</b> 126 tablets of Yao Tong Pian<br /><br /><b>Recommended: </b>Take 6 pills, 3x a day of Yao Tong Pian </font><b><font size="3"><br /><br />Item# 3930 $12.90 ea. 3 or more $12.25 ea. 6 or more $11.50 ea.</font></b>
This product was added to our catalog on Sunday 05 March, 2006.
Cancel
Zen Cart:: the art of e-commerce

21 Feb 2013, 9:25 PM
#4
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: admin preview shows code not what site will show

Zen 1.3.8a
You have got to be kidding....this code is over 5 years old

Being that this is that old you must have had it installed for some time
When did you notice this behaviour??
What did you change around that same time

Also read this about support life cycle as probably no one here still has a working copy of 1.3.8a

Zen Cart v1.3.8 will be supported for 6 months after v1.3.9 is released
http://www.zen-cart.com/showthread.php?72868-Zen-Cart-Software-Support-Life-Cycle

22 Feb 2013, 2:05 PM
#5
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,086
Plugin Contributions:
56

Re: admin preview shows code not what site will show

I'll echo what kobra said in that you should **really **upgrade as more and more hosts are leaving PHP 5.2.x behind.

The behavior you're describing is symptomatic of the use of "short open tags" on PHP 5.3 and later. Although you say that you don't have any admin-related add-ons, you might want to look at /YOUR_ADMIN/includes/modules/product/preview_info.php file and search for each occurrence of <?. Each occurrence should be of the form <?php, with a trailing space. Any occurrence that looks like <?php/* will also result in the symptoms you describe.

22 Feb 2013, 3:02 PM
#6
marvin avatar

marvin

Zen Follower

Join Date:
Feb 2006
Posts:
222
Plugin Contributions:
0

Re: admin preview shows code not what site will show

Thanks lat9.
Your reply is the type of reply that we all are appreciative of, help without attitude.
Yes I do need to upgrade but I along with thousands of other users of ZenCart are small and don't have the techie knowledge (or the funds to hire someone) to upgrade every time there is a .1, .2 or .9h upgrade. So we wait a while and then upgrade or do a new install.

Your suggestion of <? search found none in that file.
It's not a big deal and I've decided to upgrade or do a new install as I want to use 1.5.1 and some of my modules are not, possibly, compatible with it.

Any suggestions as to who I might contact to do a upgrade?

Again thanks

22 Feb 2013, 6:18 PM
#7
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: admin preview shows code not what site will show

/YOUR_ADMIN/includes/modules/product/preview_info.php
Your suggestion of <? search found none in that file.
Look again....it is a php file and as such must have them

22 Feb 2013, 6:32 PM
#8
marvin avatar

marvin

Zen Follower

Join Date:
Feb 2006
Posts:
222
Plugin Contributions:
0

Re: admin preview shows code not what site will show

SORRY, I should have said that a search found only "<?php" and no "<?"

22 Feb 2013, 8:21 PM
#9
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,086
Plugin Contributions:
56

Re: admin preview shows code not what site will show

marvin:

SORRY, I should have said that a search found only "<?php" and no "<?"
Just make sure that all the "<?php" are of the form "<?php " (the space afterword); that bit me a couple of times

22 Feb 2013, 8:36 PM
#10
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: admin preview shows code not what site will show

I should have said that a search found only "<?php" and no "<?"
Here is that file from a 1.5.1 distribution and "<?" are highlighted

<?php
/**
 * @package admin
 * @copyright Copyright 2003-2011 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: preview_info.php 18698 2011-05-04 14:50:06Z wilt $
 */
if (!defined('IS_ADMIN_FLAG')) {
  die('Illegal Access');
}
    if (zen_not_null($_POST)) {
      $pInfo = new objectInfo($_POST);
      $products_name = $_POST['products_name'];
      $products_description = $_POST['products_description'];
      $products_url = $_POST['products_url'];
    } else {
      $product = $db->Execute("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_virtual,
                                      p.products_weight, p.products_date_added, p.products_last_modified,
                                      p.products_date_available, p.products_status, p.manufacturers_id,
                                      p.products_quantity_order_min, p.products_quantity_order_units, p.products_priced_by_attribute,
                                      p.product_is_free, p.product_is_call, p.products_quantity_mixed,
                                      p.product_is_always_free_shipping, p.products_qty_box_status, p.products_quantity_order_max,
                    p.products_sort_order
                               from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                               where p.products_id = pd.products_id
                               and p.products_id = '" . (int)$_GET['pID'] . "'");

      $pInfo = new objectInfo($product->fields);
      $products_image_name = $pInfo->products_image;
    }

    $form_action = (isset($_GET['pID'])) ? 'update_product' : 'insert_product';

    $languages = zen_get_languages();
    for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
      if (isset($_GET['read']) && ($_GET['read'] == 'only')) {
        $pInfo->products_name = zen_get_products_name($pInfo->products_id, $languages[$i]['id']);
        $pInfo->products_description = zen_get_products_description($pInfo->products_id, $languages[$i]['id']);
        $pInfo->products_url = zen_get_products_url($pInfo->products_id, $languages[$i]['id']);
      } else {
        $pInfo->products_name = zen_db_prepare_input($products_name[$languages[$i]['id']]);
        $pInfo->products_description = zen_db_prepare_input($products_description[$languages[$i]['id']]);
        $pInfo->products_url = zen_db_prepare_input($products_url[$languages[$i]['id']]);
      }

      $specials_price = zen_get_products_special_price($pID);
?>
    <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 zen_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']) . ' ' . zen_output_string_protected($pInfo->products_name); ?></td>
            <td class="pageHeading" align="right"><?php echo $currencies->format($pInfo->products_price) . ($pInfo->products_virtual == 1 ? '<span class="errorText">' . '<br />' . TEXT_VIRTUAL_PREVIEW . '</span>' : '') . ($pInfo->product_is_always_free_shipping == 1 ? '<span class="errorText">' . '<br />' . TEXT_FREE_SHIPPING_PREVIEW . '</span>' : '') . ($pInfo->products_priced_by_attribute == 1 ? '<span class="errorText">' . '<br />' . TEXT_PRODUCTS_PRICED_BY_ATTRIBUTES_PREVIEW . '</span>' : '') . ($pInfo->product_is_free == 1 ? '<span class="errorText">' . '<br />' . TEXT_PRODUCTS_IS_FREE_PREVIEW . '</span>' : '') . ($pInfo->product_is_call == 1 ? '<span class="errorText">' . '<br />' . TEXT_PRODUCTS_IS_CALL_PREVIEW . '</span>' : '') . ($pInfo->products_qty_box_status == 0 ? '<span class="errorText">' . '<br />' . TEXT_PRODUCTS_QTY_BOX_STATUS_PREVIEW . '</span>' : '') . ($pInfo->products_priced_by_attribute == 1 ? '<br />' . zen_get_products_display_price($_GET['pID']) : ''); ?></td>
          </tr>
        </table></td>
      </tr>
      <tr>
        <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
      </tr>
      <tr>
        <td class="main">
          <?php
//auto replace with defined missing image
            if ($_POST['products_image_manual'] != '') {
              $products_image_name = $_POST['img_dir'] . $_POST['products_image_manual'];
              $pInfo->products_name = $products_image_name;
            }
            if ($_POST['image_delete'] == 1 || $products_image_name == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == '1') {
              echo zen_image(DIR_WS_CATALOG_IMAGES . PRODUCTS_IMAGE_NO_IMAGE, $pInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'align="right" hspace="5" vspace="5"') . $pInfo->products_description;
            } else {
              echo zen_image(DIR_WS_CATALOG_IMAGES . $products_image_name, $pInfo->products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'align="right" hspace="5" vspace="5"') . $pInfo->products_description;
            }
          ?>
        </td>
      </tr>
<?php
      if ($pInfo->products_url) {
?>
      <tr>
        <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
      </tr>
      <tr>
        <td class="main"><?php echo sprintf(TEXT_PRODUCT_MORE_INFORMATION, $pInfo->products_url); ?></td>
      </tr>
<?php
      }
?>
      <tr>
        <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
      </tr>
<?php
      if ($pInfo->products_date_available > date('Y-m-d')) {
?>
      <tr>
        <td align="center" class="smallText"><?php echo sprintf(TEXT_PRODUCT_DATE_AVAILABLE, zen_date_long($pInfo->products_date_available)); ?></td>
      </tr>
<?php
      } else {
?>
      <tr>
        <td align="center" class="smallText"><?php echo sprintf(TEXT_PRODUCT_DATE_ADDED, zen_date_long($pInfo->products_date_added)); ?></td>
      </tr>
<?php
      }
?>
      <tr>
        <td><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
      </tr>
<?php
    }

    if (isset($_GET['read']) && ($_GET['read'] == 'only')) {
      if (isset($_GET['origin'])) {
        $pos_params = strpos($_GET['origin'], '?', 0);
        if ($pos_params != false) {
          $back_url = substr($_GET['origin'], 0, $pos_params);
          $back_url_params = substr($_GET['origin'], $pos_params + 1);
        } else {
          $back_url = $_GET['origin'];
          $back_url_params = '';
        }
      } else {
        $back_url = FILENAME_CATEGORIES;
        $back_url_params = 'cPath=' . $cPath . '&pID=' . $pInfo->products_id;
      }
?>
      <tr>
        <td align="right"><?php echo '<a href="' . zen_href_link($back_url, $back_url_params . (isset($_POST['search']) ? '&search=' . $_POST['search'] : ''), 'NONSSL') . '">' . zen_image_button('button_back.gif', IMAGE_BACK) . '</a>'; ?></td>
      </tr>
<?php
    } else {
      echo zen_draw_form($form_action, $type_admin_handler, 'cPath=' . $cPath . (isset($_GET['product_type']) ? '&product_type=' . $_GET['product_type'] : '') . (isset($_GET['pID']) ? '&pID=' . $_GET['pID'] : '') . '&action=' . $form_action . (isset($_GET['page']) ? '&page=' . $_GET['page'] : ''), 'post', 'enctype="multipart/form-data"');
?>
      <tr>
        <td align="right" class="smallText">
<?php
/* Re-Post all POST'ed variables */
      reset($_POST);
      while (list($key, $value) = each($_POST)) {
        if (!is_array($_POST[$key])) {
          echo zen_draw_hidden_field($key, htmlspecialchars(stripslashes($value)));
        }
      }

      $languages = zen_get_languages();
      for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
        echo zen_draw_hidden_field('products_name[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_name[$languages[$i]['id']])));
        echo zen_draw_hidden_field('products_description[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_description[$languages[$i]['id']])));
        echo zen_draw_hidden_field('products_url[' . $languages[$i]['id'] . ']', htmlspecialchars(stripslashes($products_url[$languages[$i]['id']])));
      }
      echo zen_draw_hidden_field('products_image', stripslashes($products_image_name));
      echo ( (isset($_GET['search']) && !empty($_GET['search'])) ? zen_draw_hidden_field('search', $_GET['search']) : '') . ( (isset($_POST['search']) && !empty($_POST['search']) && empty($_GET['search'])) ? zen_draw_hidden_field('search', $_POST['search']) : '');
      echo zen_image_submit('button_back.gif', IMAGE_BACK, 'name="edit"') . '  ';

      if (isset($_GET['pID'])) {
        echo zen_image_submit('button_update.gif', IMAGE_UPDATE);
      } else {
        echo zen_image_submit('button_insert.gif', IMAGE_INSERT);
      }
     echo '  <a href="' . zen_href_link(FILENAME_CATEGORIES, 'cPath=' . $cPath . (isset($_GET['pID']) ? '&pID=' . $_GET['pID'] : '') . (isset($_GET['page']) ? '&page=' . $_GET['page'] : '') . (isset($_GET['search']) ? '&search=' . $_GET['search'] : '')) . '">' . zen_image_button('button_cancel.gif', IMAGE_CANCEL) . '</a>';
?>
        </td>
      </tr>
    </table></form>
<?php
    }
?>