Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Why can't i put PHP in product description


otacon221

Recommended Posts

You can use the eval function in products_info.php but be careful what your doin.

<?php $product_info['products_description'] = "
<table border=0 width=100% cellspacing=0 cellpadding=0><tr><td width=100%>
<?php include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS); ?>
</td></tr></table>
"; ?>

<?php eval (' ?> ' . $product_info['products_description'] . ' <?php '); ?>

Link to comment
Share on other sites

  • 4 weeks later...
  • 1 month later...

Hi there;

I cant use HTML tags on products description. For example; i wrote.

 

Specs <p><p>

              Controls<p>

              Nice<p>

 

 

It returns

 

Specs_p__p_Controls_p_Nice_p_

 

When i go to the MySql on pruducts table. The product_description field again,

 

Specs_p__p_Controls_p_Nice_p_

 

I think there can be a problem at admin/catagories.php while adding the products.

 

Any suggestions?

 

Thanks a lot and sory for my poor english..

Link to comment
Share on other sites

you must have uploaded catalog/includes/functions/database.php into your admin catalog/admin/includes/functions/database.php

 

This function is for admin it doesnt call tep_sanitize_string().

 

 

  function tep_db_prepare_input($string) {
   if (is_string($string)) {
     return trim(stripslashes($string));
   } elseif (is_array($string)) {
     reset($string);
     while (list($key, $value) = each($string)) {
       $string[$key] = tep_db_prepare_input($value);
     }
     return $string;
   } else {
     return $string;
   }
 }

Link to comment
Share on other sites

  • 7 months later...
  • 1 year later...

I was referred to this thread by another for this fix...........however, I don't see the code that's posted in product_info.php........is this supposed to be inserted in /catalog/product_info.php??? or another file?? :blink:

 

Thanks Dave!

 

Genius like you make our life easier!! :D

Link to comment
Share on other sites

  • 11 months later...
I was referred to this thread by another for this fix...........however, I don't see the code that's posted in product_info.php........is this supposed to be inserted in /catalog/product_info.php??? or another file?? :blink:

 

Hi

 

Another thanks to Dave. The eval function worked for me straight off.

 

There is another thread similar to this here and as mentioned by Germ

 

Offhand, I'd say to change this line:

 

 <p><?php echo stripslashes($product_info['products_description']); ?></p>

 

To:

 

  <p><?php eval (' ?> ' . $product_info['products_description'] . ' <?php '); ?></p>

 

Thought I'd just clarify so if anyone else needs this, it's all in one post. You need to change the above code in the catalog/product_info.php file around line 120 on a default install of 2.2Rc2a

 

Cheers

 

Ian

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...