Zen Cart Logo
Forums / General Questions / Confirmation: can't use php in Product Descriptions?

Confirmation: can't use php in Product Descriptions?

Locked

Views: 18,968

Results 21 to 34 of 34
This thread is locked. New replies are disabled.
20 Jun 2008, 3:59 AM
#21
karma_lab avatar

karma_lab

Zen Follower

Join Date:
Apr 2008
Posts:
135
Plugin Contributions:
0

Confirmation: can't use php in Product Descriptions?

I took a quick look at that file, and it does not seem to contain the code that creates the product description. Basically, you need to find where that is coming from in this mod, and modify it similar to the examples above.

23 Jun 2008, 7:23 PM
#22
rmjr avatar

rmjr

New Zenner

Join Date:
May 2005
Posts:
48
Plugin Contributions:
0

Re: Confirmation: can't use php in Product Descriptions?

I fixed the problem by adding the html include syntax from swguy's website after the comments at the top of the tpl_product_info_display.php file.

Now the HTML_INCLUDE_XXX works.

Thanks for the info!

20 Aug 2008, 11:33 PM
#23
mdegrandis avatar

mdegrandis

New Zenner

Join Date:
Jun 2008
Location:
Oregon
Posts:
60
Plugin Contributions:
0

Re: Confirmation: can't use php in Product Descriptions?

I'd like to do something like this. I'd need it to use a template with constant text then add the product name to it. Or inside it contextually...is that possible with this?

24 Aug 2008, 10:40 AM
#24
bluesky2008 avatar

bluesky2008

New Zenner

Join Date:
Jul 2008
Posts:
75
Plugin Contributions:
0

Re: Confirmation: can't use php in Product Descriptions?

i tried the HTML_INCLUDE method, but there's no description showing on my product page, i dont know what wrong is. anyone help? thanks

here's the codes of my tpl_product_info_display.php

<?php
/**
 * Page Template
 *
 * Loaded automatically by index.php?main_page=product_info.<br />
 * Displays details of a typical product
 *
 * @package templateSystem
 * @copyright Copyright 2003-2006 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: tpl_product_info_display.php 5369 2006-12-23 10:55:52Z drbyte $
 */
 //require(DIR_WS_MODULES . '/debug_blocks/product_info_prices.php');
?>
<div class="centerColumn" id="productGeneral">


<h1 id="productinfoDefaultHeading"><?php echo HEADING_TITLE; ?></h1>


<!--bof Form start-->
<?php echo zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($_GET['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product'), 'post', 'enctype="multipart/form-data"') . "\n"; ?>
<!--eof Form start-->

<?php if ($messageStack->size('product_info') > 0) echo $messageStack->output('product_info'); ?>

<!--bof Category Icon -->
<?php if ($module_show_categories != 0) {?>
<?php
/**
 * display the category icons
 */
require($template->get_template_dir('/tpl_modules_category_icon_display.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_category_icon_display.php'); ?>
<?php } ?>
<!--eof Category Icon -->

<!--bof Prev/Next top position -->
<?php if (PRODUCT_INFO_PREVIOUS_NEXT == 1 or PRODUCT_INFO_PREVIOUS_NEXT == 3) { ?>
<?php
/**
 * display the product previous/next helper
 */
require($template->get_template_dir('/tpl_products_next_previous.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_products_next_previous.php'); ?>
<?php } ?>
<!--eof Prev/Next top position-->

<!--bof Main Product Image -->
<?php
  if (zen_not_null($products_image)) {
  ?>
<?php
/**
 * display the main product image
 */
   require($template->get_template_dir('/tpl_modules_main_product_image.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_main_product_image.php'); ?>
<?php
  }
?>
<!--eof Main Product Image-->




<!--bof Product Name-->
<h1 id="productName" class="productGeneral"><?php echo $products_name; ?></h1>
<!--eof Product Name-->

<!--bof Product details list  -->
<?php if ( (($flag_show_product_info_model == 1 and $products_model != '') or ($flag_show_product_info_weight == 1 and $products_weight !=0) or ($flag_show_product_info_quantity == 1) or ($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name))) ) { ?>
<ul id="productDetailsList" class="floatingBox back">
  <?php echo (($flag_show_product_info_model == 1 and $products_model !='') ? '<li>' . TEXT_PRODUCT_MODEL . $products_model . '</li>' : '') . "\n"; ?>
  <?php echo (($flag_show_product_info_weight == 1 and $products_weight !=0) ? '<li>' . TEXT_PRODUCT_WEIGHT .  $products_weight . TEXT_PRODUCT_WEIGHT_UNIT . '</li>'  : '') . "\n"; ?>
  <?php echo (($flag_show_product_info_quantity == 1) ? '<li>' . $products_quantity . TEXT_PRODUCT_QUANTITY . '</li>'  : '') . "\n"; ?>
  <?php echo (($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name)) ? '<li>' . TEXT_PRODUCT_MANUFACTURER . $manufacturers_name . '</li>' : '') . "\n"; ?>
</ul>
<br class="clearBoth" />
<?php
  }
?>
<!--eof Product details list -->

<!--bof Product Price block -->
<h2 id="productPrices" class="productGeneral">
<?php
// base price
  if ($show_onetime_charges_description == 'true') {
    $one_time = '<span >' . TEXT_ONETIME_CHARGE_SYMBOL . TEXT_ONETIME_CHARGE_DESCRIPTION . '</span><br />';
  } else {
    $one_time = '';
  }
  echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : '') . zen_get_products_display_price((int)$_GET['products_id']);
?></h2>
<!--eof Product Price block -->





<!--bof free ship icon  -->
<?php if(zen_get_product_is_always_free_shipping($products_id_current) && $flag_show_product_info_free_shipping) { ?>
<div id="freeShippingIcon"><?php echo TEXT_PRODUCT_FREE_SHIPPING_ICON; ?></div>
<?php } ?>
<!--eof free ship icon  -->


<!-- bof html description -->
<?php function html_include_cb($match) {
      $prefix = "HTML_INCLUDE_";
      $match_filename = str_replace($prefix, '', $match[0]); 
      $filename = DIR_WS_LANGUAGES . $_SESSION['language'] .  
                 '/boilerplate/' . 
                 $match_filename  . ".html";
      $buffer = ""; 
      if (file_exists($filename)) { 
          $handle = @fopen($filename, "r"); 
          while (!feof($handle)) {
              $buffer .= fgets($handle, 4096); 
          }
          fclose($handle);
      }
      return $buffer;
}
if ($products_description != '') { 
   $pattern = "/HTML_INCLUDE_[a-zA-Z0-9]*/"; 
   $products_description = preg_replace_callback($pattern, "html_include_cb", 
           $products_description, -1);
}?>
<!-- eof html description -->

 <!--bof Product description -->
<?php if ($products_description != '') { ?>
<div id="productDescription" class="productGeneral biggerText"><?php echo stripslashes($products_description) ?></div>
<?php } ?>
<!--eof Product description -->
<br class="clearBoth" />


<!--bof Additional Product Images -->
<?php
/**
 * display the products additional images
 */
  require($template->get_template_dir('/tpl_modules_additional_images.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_additional_images.php'); ?>
<!--eof Additional Product Images -->



<!--bof Attributes Module -->
<?php
  if ($pr_attr->fields['total'] > 0) {
?>
<?php
/**
 * display the product atributes
 */
  require($template->get_template_dir('/tpl_modules_attributes.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_attributes.php'); ?>
<?php
  }
?>
<!--eof Attributes Module -->

<!--bof Quantity Discounts table -->
<?php
  if ($products_discount_type != 0) { ?>
<?php
/**
 * display the products quantity discount
 */
 require($template->get_template_dir('/tpl_modules_products_quantity_discounts.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_products_quantity_discounts.php'); ?>
<?php
  }
?>
<!--eof Quantity Discounts table -->


<!--bof Prev/Next bottom position -->
<?php if (PRODUCT_INFO_PREVIOUS_NEXT == 2 or PRODUCT_INFO_PREVIOUS_NEXT == 3) { ?>
<?php
/**
 * display the product previous/next helper
 */
 require($template->get_template_dir('/tpl_products_next_previous.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_products_next_previous.php'); ?>
<?php } ?>
<!--eof Prev/Next bottom position -->

<!--bof Add to Cart Box -->
<?php
if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') {
  // do nothing
} else {
?>
            <?php
    $display_qty = (($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($_GET['products_id'])) ? '<p>' . PRODUCTS_ORDER_QTY_TEXT_IN_CART . $_SESSION['cart']->get_quantity($_GET['products_id']) . '</p>' : '');
            if ($products_qty_box_status == 0 or $products_quantity_order_max== 1) {
              // hide the quantity box and default to 1
              $the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
            } else {
              // show the quantity box
    $the_button = PRODUCTS_ORDER_QTY_TEXT . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '<br />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
            }
    $display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);
  ?>
  <?php if ($display_qty != '' or $display_button != '') { ?>
    <div id="cartAdd">
    <?php
      echo $display_qty;
      echo $display_button;
            ?>
          </div>
  <?php } // display qty and button ?>
<?php } // CUSTOMERS_APPROVAL == 3 ?>
<!--eof Add to Cart Box-->

<!--bof Tell a Friend button -->
<?php
  if ($flag_show_product_info_tell_a_friend == 1) { ?>
<div id="productTellFriendLink" class="buttonRow forward"><?php echo ($flag_show_product_info_tell_a_friend == 1 ? '<a href="' . zen_href_link(FILENAME_TELL_A_FRIEND, 'products_id=' . $_GET['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_TELLAFRIEND, BUTTON_TELLAFRIEND_ALT) . '</a>' : ''); ?></div>
<?php
  }
?>
<!--eof Tell a Friend button -->

<!--bof Reviews button and count-->
<?php
  if ($flag_show_product_info_reviews == 1) {
    // if more than 0 reviews, then show reviews button; otherwise, show the "write review" button
    if ($reviews->fields['count'] > 0 ) { ?>
<div id="productReviewLink" class="buttonRow back"><?php echo '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS, zen_get_all_get_params()) . '">' . zen_image_button(BUTTON_IMAGE_REVIEWS, BUTTON_REVIEWS_ALT) . '</a>'; ?></div>
<br class="clearBoth" />
<p class="reviewCount"><?php echo ($flag_show_product_info_reviews_count == 1 ? TEXT_CURRENT_REVIEWS . ' ' . $reviews->fields['count'] : ''); ?></p>
<?php } else { ?>
<div id="productReviewLink" class="buttonRow back"><?php echo '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, zen_get_all_get_params(array())) . '">' . zen_image_button(BUTTON_IMAGE_WRITE_REVIEW, BUTTON_WRITE_REVIEW_ALT) . '</a>'; ?></div>
<br class="clearBoth" />
<?php
  }
}
?>
<!--eof Reviews button and count -->

<!--bof Product date added/available-->
<?php
  if ($products_date_available > date('Y-m-d H:i:s')) {
    if ($flag_show_product_info_date_available == 1) {
?>
  <p id="productDateAvailable" class="productGeneral centeredContent"><?php echo sprintf(TEXT_DATE_AVAILABLE, zen_date_long($products_date_available)); ?></p>
<?php
    }
  } else {
    if ($flag_show_product_info_date_added == 1) {
?>
      <p id="productDateAdded" class="productGeneral centeredContent"><?php echo sprintf(TEXT_DATE_ADDED, zen_date_long($products_date_added)); ?></p>
<?php
    } // $flag_show_product_info_date_added
  }
?>
<!--eof Product date added/available -->

<!--bof Product URL -->
<?php
  if (zen_not_null($products_url)) {
    if ($flag_show_product_info_url == 1) {
?>
    <p id="productInfoLink" class="productGeneral centeredContent"><?php echo sprintf(TEXT_MORE_INFORMATION, zen_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($products_url), 'NONSSL', true, false)); ?></p>
<?php
    } // $flag_show_product_info_url
  }
?>
<!--eof Product URL -->

<!--bof also purchased products module-->
<?php require($template->get_template_dir('tpl_modules_also_purchased_products.php', DIR_WS_TEMPLATE, $current_page_base,'templates'). '/' . 'tpl_modules_also_purchased_products.php');?>
<!--eof also purchased products module-->

<!--bof Form close-->
</form>
<!--bof Form close-->
</div>
10 Jul 2009, 6:12 PM
#25
meshach avatar

meshach

Zen Follower

Join Date:
Jun 2008
Location:
USA
Posts:
188
Plugin Contributions:
0

Re: Confirmation: can't use php in Product Descriptions?

karma-lab:

I just finished getting the php include concept to work on all the various pages (featured, specials, new products etc.)

The basic idea is to eval() the product description first into a variable (using output buffering), and then perform whatever string cleaning and truncation is normally done on the results of that eval(). It's basically the same mod in each spot, just sometimes the code or variables are a bit different.

I'm not going to detail each mod, because this was a bunch of work and I'm not sure anyone really wants to go through this, it will be extremely helpful for me, but maybe not for anyone else to work in this fashion. But here's the basic idea:

includes/templates/CUSTOM/common/tpl_tabular_display.php

replace:

$list_box_contents[$rows]['description'] = zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION);

> ```
ob_start();
eval(stripslashes('?>'.zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id'])));
$contents = ob_get_contents();
ob_end_clean(); 
$list_box_contents[$rows]['description'] = zen_trunc_string(zen_clean_html($contents), PRODUCT_LIST_DESCRIPTION);
```includes/templates/CUSTOM/templates/**tpl_modules_products_all_listing.php**
> 
> replace:
> ```
$disp_text = zen_get_products_description($products_all->fields['products_id']);
$disp_text = zen_clean_html($disp_text);

$display_products_description = stripslashes(zen_trunc_string($disp_text, PRODUCT_ALL_LIST_DESCRIPTION, '<a href="' . zen_href_link(zen_get_info_page($products_all->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_all->fields['master_categories_id']) . '&products_id=' . $products_all->fields['products_id']) . '"> ' . MORE_INFO_TEXT . '</a>'));
```...with:
> ```
$disp_text = zen_get_products_description($products_all->fields['products_id']);

ob_start();
eval(stripslashes('?>'.$disp_text));
$contents = ob_get_contents();
ob_end_clean(); 

$contents = zen_clean_html($contents);

$display_products_description = zen_trunc_string($contents, PRODUCT_ALL_LIST_DESCRIPTION, '<a href="' . zen_href_link(zen_get_info_page($products_all->fields['products_id']), 'cPath=' . zen_get_generated_category_path_rev($products_all->fields['master_categories_id']) . '&products_id=' . $products_all->fields['products_id']) . '"> ' . MORE_INFO_TEXT . '</a>');

includes/templates/CUSTOM/templates/tpl_modules_products_featured_listing.php
includes/templates/CUSTOM/templates/tpl_modules_products_new_listing.php
includes/templates/CUSTOM/templates/tpl_specials_default.php

...these are all virtually identical to the one above for products_all_listing.

One caveat: I'm already using a custom theme that has some modifications, so I cannot guarantee that this will match 100%. But the concept behind it is clear, for anyone who understands a bit of php.

Hope that helps anyone who wants to have the freedom of having every single product description reside on the server as a separate HTML file. :wink:

Hello, is there a way of doing this in Zen Cart 1.3.8? The code your say to replace is different in Zen Cart 1.3.8.

Thanks much.

Meshach

14 Jul 2009, 5:54 PM
#26
karma_lab avatar

karma_lab

Zen Follower

Join Date:
Apr 2008
Posts:
135
Plugin Contributions:
0

Re: Confirmation: can't use php in Product Descriptions?

Meshach:

Hello, is there a way of doing this in Zen Cart 1.3.8? The code your say to replace is different in Zen Cart 1.3.8.

Thanks much.

MeshachIt really wasn't necessary to quote the entire huge code dump just to ask a one-line question. ;)

At the time I posted this, I was using 1.3.8a. With a custom theme. As explained. So I cannot guarantee the code matches. But the concept is the same.

14 Jul 2009, 5:57 PM
#27
meshach avatar

meshach

Zen Follower

Join Date:
Jun 2008
Location:
USA
Posts:
188
Plugin Contributions:
0

Re: Confirmation: can't use php in Product Descriptions?

Sorry for copying all that code, that was stupid of me. :blush:

Would you help me figure it out if I send you the code?

If we can get this figured out for a default install of Zen Cart 1.3.8a perhaps you (or me) can create a module?

Thanks for your time, I appreciate it.
Meshach

21 Jul 2009, 11:02 PM
#28
meshach avatar

meshach

Zen Follower

Join Date:
Jun 2008
Location:
USA
Posts:
188
Plugin Contributions:
0

Re: Confirmation: can't use php in Product Descriptions?

So how would I use PHP includes in product description's (Zen Cart 1.3.8)?

Thanks. :smile:

11 Aug 2009, 10:09 PM
#29
wheelock avatar

wheelock

New Zenner

Join Date:
Jun 2008
Posts:
16
Plugin Contributions:
0

Re: Confirmation: can't use php in Product Descriptions?

found this thread searching around about using php in product description pages.

karma-lab, your simple mod is nice.
The fact that it does not show any text in the product listing is no problem as i simply do a css display none in a separate table if needed.

I must say that i am very grateful to all the knowlegable people on these forums!!
All my answers come from here via google!

My own php thing regarding the product pages is how to embed a php gallery/slide show into my html.
this: zinkwazi.com/wp/scripts/
I found this little gem suits me perfectly, just chuck in images and you are done.[a folder for each product]
The thing is, i am embedding it In my html content using iframes.
It would be nice to find a better way.
The delay in loading compared to the main page bothers me a bit, among other things.

But really i know next to nothing about php so wondered whether there was a simple solution.
A php equivalent to fill a table cell etc?

wish i had more hours in the day to learn this stuff:(

Thanks

Mark

25 Aug 2009, 12:43 PM
#30
geronimo avatar

geronimo

New Zenner

Join Date:
Sep 2007
Location:
Tasmania
Posts:
46
Plugin Contributions:
0

Re: Confirmation: can't use php in Product Descriptions?

Hello.

I've read many posts on using PHP in the product description and have experimented with "Using Boilerplate Text in the Product Description" and "Using Files Containing Boilerplate Text in the Product Description".

In each case, when I put (e.g.) HTML_INCLUDE_XYZ or PHP_ONE_WEEK_DELAY in the product description, the exact text is output on the product page of my site.

Should I be adding something around the strings to make them work?

Thank you

Philip

26 Aug 2009, 2:59 PM
#31
rmjr avatar

rmjr

New Zenner

Join Date:
May 2005
Posts:
48
Plugin Contributions:
0

Re: Confirmation: can't use php in Product Descriptions?


I was just asked about the code that I placed in the /includes/templates/YOURTEMPLATE/templates/tpl_product_info_display.php file to make this work. Thanks again to swguy for the code.

The code is immediately after the comments at the top [in the <!-- bof html description --> section], but I included the entire file in case someone needs it.


<?php
/**
 * Page Template
 * Tabbed Products Lite v3.8
 * QHome (qhomezone######################)
 *
 * Loaded automatically by index.php?main_page=product_info.<br />
 * Displays details of a typical product
 *
 * @package templateSystem
 * @copyright Copyright 2003-2006 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license [url]http://www.zen-cart.com/license/2_0.txt[/url] GNU Public License V2.0
 * @version $Id: tpl_product_info_display.php 3435 2006-04-14 03:42:46Z ajeh $
 */
 //require(DIR_WS_MODULES . '/debug_blocks/product_info_prices.php');
?>


<!-- bof html description -->
<?php
function html_include_cb($match) {
      $prefix = "HTML_INCLUDE_";
      $match_filename = str_replace($prefix, '', $match[0]); 
      $filename = DIR_WS_LANGUAGES . $_SESSION['language'] .  
                 '/boilerplate/' . 
                 $match_filename  . ".html";
      $buffer = ""; 
      if (file_exists($filename)) { 
          $handle = @fopen($filename, "r"); 
          while (!feof($handle)) {
              $buffer .= fgets($handle, 4096); 
          }
          fclose($handle);
      }
      return $buffer;
}
if ($products_description != '') { 
   $pattern = "/HTML_INCLUDE_[a-zA-Z0-9]*/"; 
   $products_description = preg_replace_callback($pattern, "html_include_cb", 
           $products_description, -1);
}
?>
<!-- eof html description -->


<!-- bof: Tabbed Product Lite Modifications -->
<?php require(DIR_WS_MODULES . 'tabbed_products_lite.php');?>
<!-- eof: Tabbed Product Lite Modifications -->

<div class="centerColumn" id="productGeneral">

<!--bof Form start-->
<?php echo zen_draw_form('cart_quantity', zen_href_link(zen_get_info_page($_GET['products_id']), zen_get_all_get_params(array('action')) . 'action=add_product'), 'post', 'enctype="multipart/form-data"') . "\n"; ?>
<!--eof Form start-->

<?php if ($messageStack->size('product_info') > 0) echo $messageStack->output('product_info'); ?>

<!--bof Category Icon -->
<?php if ($module_show_categories != 0) {?>
<?php
/**
 * display the category icons
 */
require($template->get_template_dir('/tpl_modules_category_icon_display.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_category_icon_display.php'); ?>
<?php } ?>
<!--eof Category Icon -->


<!--eof Prev/Next top position -->
<?php if (PRODUCT_INFO_PREVIOUS_NEXT == 1 or PRODUCT_INFO_PREVIOUS_NEXT == 3) { ?>
<?php
/**
 * display the product previous/next helper
 */
require($template->get_template_dir('/tpl_products_next_previous.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_products_next_previous.php'); ?>
<?php } ?>
<!--eof Prev/Next top position-->


<!-- bof: Tabbed Product Lite Modifications -->
<?php If ($bMainImageOnTabs === false || $chkTabStart === false || $chkTabEnd === false) { ?>
<!-- eof: Tabbed Product Lite Modifications -->



<!--bof Main Product Image -->
<?php
  if (zen_not_null($products_image)) {
  ?>
<?php
/**
 * display the main product image
 */
   require($template->get_template_dir('/tpl_modules_main_product_image.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_main_product_image.php'); ?>
<?php
  }
?>
<!--eof Main Product Image-->


<!--bof Add to Cart Box -->
<?php 
if (CUSTOMERS_APPROVAL == 3 and TEXT_LOGIN_FOR_PRICE_BUTTON_REPLACE_SHOWROOM == '') {
  // do nothing
} else {
  $display_qty = (($flag_show_product_info_in_cart_qty == 1 and $_SESSION['cart']->in_cart($_GET['products_id'])) ? '<p>' . PRODUCTS_ORDER_QTY_TEXT_IN_CART . $_SESSION['cart']->get_quantity($_GET['products_id']) . '</p>' : '');
  if ($products_qty_box_status == 0 or $products_quantity_order_max== 1) {
    // hide the quantity box and default to 1
    $the_button = '<input type="hidden" name="cart_quantity" value="1" />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
  } else {
    // show the quantity box
    $the_button = PRODUCTS_ORDER_QTY_TEXT . '<input type="text" name="cart_quantity" value="' . (zen_get_buy_now_qty($_GET['products_id'])) . '" maxlength="6" size="4" /><br />' . zen_get_products_quantity_min_units_display((int)$_GET['products_id']) . '<br />' . zen_draw_hidden_field('products_id', (int)$_GET['products_id']) . zen_image_submit(BUTTON_IMAGE_IN_CART, BUTTON_IN_CART_ALT);
  }
  $display_button = zen_get_buy_now_button($_GET['products_id'], $the_button);

  if ($display_qty != '' or $display_button != '') { ?>
    <div id="cartAdd">
    <?php
      echo $display_qty;
      echo $display_button;
    ?>
    </div>
  <?php } // display qty and button ?>
<?php } // CUSTOMERS_APPROVAL == 3 ?>
<!--eof Add to Cart Box-->


<!--bof Product Name-->
<h1 id="productName" class="productGeneral"><?php echo $products_name; ?></h1>
<!--eof Product Name-->


<!--bof Product Price block -->
<h2 id="productPrices" class="productGeneral">
<?php
// base price
  if ($show_onetime_charges_description == 'true') {
    $one_time = '<span >' . TEXT_ONETIME_CHARGE_SYMBOL . TEXT_ONETIME_CHARGE_DESCRIPTION . '</span><br />';
  } else {
    $one_time = '';
  }
  echo $one_time . ((zen_has_product_attributes_values((int)$_GET['products_id']) and $flag_show_product_info_starting_at == 1) ? TEXT_BASE_PRICE : '') . zen_get_products_display_price((int)$_GET['products_id']);
?></h2>
<!--eof Product Price block -->




<!--bof free ship icon  -->
<?php if(zen_get_product_is_always_free_shipping($products_id_current)) { ?>
<div id="freeShippingIcon"><?php echo TEXT_PRODUCT_FREE_SHIPPING_ICON; ?></div>
<?php } ?>
<!--eof free ship icon  -->

<!--bof Attributes Module -->
<?php if ($bsubtab_AttributeOptions == false) {
  if ($pr_attr->fields['total'] > 0) {
    require($template->get_template_dir('/tpl_modules_attributes.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_attributes.php');
  }
}?>
<!--eof Attributes Module -->
<br class="clearBoth" />



<!-- bof: Tabbed Product Lite Modifications -->
<!--bof Product details list  -->
<?php
if ( (($flag_show_product_info_model == 1 and $products_model != '') or ($flag_show_product_info_weight == 1 and $products_weight !=0) or ($flag_show_product_info_quantity == 1) or ($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name))) ) { ?>
  <ul id="productDetailsList" class="floatingBox back">
  <?php echo (($flag_show_product_info_model == 1 and $products_model !='') ? '<li>' . TEXT_PRODUCT_MODEL . $products_model . '</li>' : '') . "\n"; ?>
  <?php echo (($flag_show_product_info_weight == 1 and $products_weight !=0) ? '<li>' . TEXT_PRODUCT_WEIGHT .  $products_weight . TEXT_PRODUCT_WEIGHT_UNIT . '</li>'  : '') . "\n"; ?>
  <?php echo (($flag_show_product_info_quantity == 1) ? '<li>' . $products_quantity . TEXT_PRODUCT_QUANTITY . '</li>'  : '') . "\n"; ?>
  <?php echo (($flag_show_product_info_manufacturer == 1 and !empty($manufacturers_name)) ? '<li>' . TEXT_PRODUCT_MANUFACTURER . $manufacturers_name . '</li>' : '') . "\n"; ?>
  </ul>
<?php }
?>
<!--eof Product details list -->
<!-- <br class="clearBoth" />
<div></div>
-->
<!-- eof: Tabbed Product Lite Modifications -->


<!--bof Quantity Discounts table -->
<?php if ($products_discount_type != 0) {
  require($template->get_template_dir('/tpl_modules_products_quantity_discounts.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_products_quantity_discounts.php');
}?>
<!--eof Quantity Discounts table -->





<!-- bof: Tabbed Product Lite Modifications -->
<?php
} //end of the show_main_image_on_tabs if statement
if ($products_description != '') {
  if ($chkTabStart === false || $chkTabEnd === false) { // BEGIN custom tab exist check
    ?> 



    
 <!--bof Product description -->
<?php if ($products_description != '') { ?>
<div><?php echo stripslashes($products_description) ?><br/><br/></div>
<?php } ?>
<!--eof Product description -->

    
    
    <?php
    If ($bAddToCart || $bMediaCollection || $bAdditionalImages || $bCustomersAlsoPurchased || $bCrossSell_Tab || $bReviews_Tab) {
      require($template->get_template_dir('/tpl_tabbed_products_lite.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_tabbed_products_lite.php');
    }
  } else { 
    require($template->get_template_dir('/tpl_tabbed_products_lite.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_tabbed_products_lite.php');
  }
}
?>
<!-- eof: Tabbed Product Lite Modifications -->

<!-- bof: Tabbed Product Lite Modifications -->
<?php if (!$bAddToCart && !$bsubtab_AddToCart) { // If not a tab, display as normal ?>
<!-- eof: Tabbed Product Lite Modifications -->



<!-- bof: Tabbed Product Lite Modifications -->
<?php } ?>
<!-- eof: Tabbed Product Lite Modifications -->

<!-- bof: Tabbed Product Lite Modifications -->
<!--bof Additional Product Images -->
<?php if (!$bAdditionalImages && !$bsubtab_AdditionalImages) {
  	require($template->get_template_dir('/tpl_modules_additional_images.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_additional_images.php');
}?>
<!--eof Additional Product Images -->
<!-- eof: Tabbed Product Lite Modifications -->

<!--bof Prev/Next bottom position -->
<?php if (PRODUCT_INFO_PREVIOUS_NEXT == 2 or PRODUCT_INFO_PREVIOUS_NEXT == 3) { ?>
<?php
/**
 * display the product previous/next helper
 */
 require($template->get_template_dir('/tpl_products_next_previous.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_products_next_previous.php'); ?>
<?php } ?>
<!--eof Prev/Next bottom position -->

<!--bof Tell a Friend button -->
<?php
  if ($flag_show_product_info_tell_a_friend == 1) { ?>
<div id="productTellFriendLink" class="buttonRow forward"><?php echo ($flag_show_product_info_tell_a_friend == 1 ? '<a href="' . zen_href_link(FILENAME_TELL_A_FRIEND, 'products_id=' . $_GET['products_id']) . '">' . zen_image_button(BUTTON_IMAGE_TELLAFRIEND, BUTTON_TELLAFRIEND_ALT) . '</a>' : ''); ?></div>
<?php
  }
?>
<!--eof Tell a Friend button -->

<!-- bof: Tabbed Product Lite Modifications -->
<!--bof Reviews button and count-->
<?php if (!$bReviews_Tab && !$bsubtab_Reviews) {?>
<?php
if ($flag_show_product_info_reviews == 1) {
  $reviews = $db->Execute($reviews_query);
  // if more than 0 reviews, then show reviews button; otherwise, show the "write review" button
  if ($reviews->fields['count'] > 0 ) { ?>
    <div id="productReviewLink" class="buttonRow back"><?php echo '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS, zen_get_all_get_params()) . '">' . zen_image_button(BUTTON_IMAGE_REVIEWS, BUTTON_REVIEWS_ALT) . '</a>'; ?></div>
    <br class="clearBoth" />
    <p class="reviewCount"><?php echo ($flag_show_product_info_reviews_count == 1 ? TEXT_CURRENT_REVIEWS . ' ' . $reviews->fields['count'] : ''); ?></p>
    <?php } else { ?>
    <div id="productReviewLink" class="buttonRow back"><?php echo '<a href="' . zen_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, zen_get_all_get_params(array())) . '">' . zen_image_button(BUTTON_IMAGE_WRITE_REVIEW, BUTTON_WRITE_REVIEW_ALT) . '</a>'; ?></div>

    <?php
  }
}
?>
<?php } ?>
<!--eof Reviews button and count -->
<!-- eof: Tabbed Product Lite Modifications -->
    <br class="clearBoth" />
<!--bof Product date added/available-->
<?php
  if ($products_date_available > date('Y-m-d H:i:s')) {
    if ($flag_show_product_info_date_available == 1) {
?>
  <p id="productDateAvailable" class="productGeneral centeredContent"><?php echo sprintf(TEXT_DATE_AVAILABLE, zen_date_long($products_date_available)); ?></p>
<?php
    }
  } else {
    if ($flag_show_product_info_date_added == 1) {
?>
      <p id="productDateAdded" class="productGeneral centeredContent"><?php echo sprintf(TEXT_DATE_ADDED, zen_date_long($products_date_added)); ?></p>
<?php
    } // $flag_show_product_info_date_added
  }
?>
<!--eof Product date added/available -->

<!--bof Product URL -->
<?php
  if (zen_not_null($products_url)) {
    if ($flag_show_product_info_url == 1) {
?>
    <p id="productInfoLink" class="productGeneral centeredContent"><?php echo sprintf(TEXT_MORE_INFORMATION, zen_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($products_url), 'NONSSL', true, false)); ?></p>
<?php
    } // $flag_show_product_info_url
  }
?>
<!--eof Product URL -->

<!-- bof: Tabbed Product Lite Modifications -->
<!--bof also purchased products module-->
<?php if (!$bCustomersAlsoPurchased && !$bsubtab_CustomersAlsoPurchased) {
   require($template->get_template_dir('tpl_modules_also_purchased_products.php', DIR_WS_TEMPLATE, $current_page_base,'templates'). '/' . 'tpl_modules_also_purchased_products.php');
 }?>
<!--eof also purchased products module-->
<!-- eof: Tabbed Product Lite Modifications -->

<!-- bof: Tabbed Product Lite Modifications -->
<!-- BOF: Cross-Sell information -->
<?php if (!$bCrossSell_Tab && $bCrossSell_Exists == true && !$bsubtab_CrossSell) {  
  // THIS CODE WOULD BE ADDED INTO YOUR TPL_PRODUCT_INFO_DISPLAY.PHP WHEREVER YOU WANT TO DISPLAY THE CROSS_SELL BOX:
  require($template->get_template_dir('tpl_modules_xsell_products.php', DIR_WS_TEMPLATE, $current_page_base,'templates'). '/' . 'tpl_modules_xsell_products.php');
}?>
<!-- EOF: Cross-Sell information -->
<!-- eof: Tabbed Product Lite Modifications -->

<!--bof Form close-->
</form>
<!--bof Form close-->
</div>

26 Aug 2009, 3:01 PM
#32
rmjr avatar

rmjr

New Zenner

Join Date:
May 2005
Posts:
48
Plugin Contributions:
0

Re: Confirmation: can't use php in Product Descriptions?

The code that I just placed was for Zen Cart 1.3.7.1 - I do not have any specifics for 1.3.8.

26 Aug 2009, 3:09 PM
#33
geronimo avatar

geronimo

New Zenner

Join Date:
Sep 2007
Location:
Tasmania
Posts:
46
Plugin Contributions:
0

Re: Confirmation: can't use php in Product Descriptions?

Hi mjr

Thanks for this post. I'll look through your file thoroughly tomorrow and see if I can work it out now.

Kind regards
Philip

27 Aug 2009, 8:08 AM
#34
geronimo avatar

geronimo

New Zenner

Join Date:
Sep 2007
Location:
Tasmania
Posts:
46
Plugin Contributions:
0

Re: Confirmation: can't use php in Product Descriptions?

Thanks rmjr.

I've added the code in the position you showed above and now boilerplate works perfectly. This is going to save SO much time in future. Thanks also to swguy.

Regards
Philip