Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

PHP in Product Description


draxion

Recommended Posts

Posted

Hi,

 

I'm wondering if there's a way to place some PHP code in the product description from the admin catalogue when adding or modifing products? I simply want to add a link in the product description for a specific product. I've tried adding the following PHP code but it doesn't seem to run. When I view the source on the page, I see the php code, not the result which should be a link. Here's the code I'm trying to. (BTW... this works fine if I just add in to product_info.php and not the product description)

 

<td class="ProductInfoLink" height="10"><?php echo '<a href="' . tep_href_link(FILENAME_HELMET_SIZING, 'products_id=' . $HTTP_GET_VARS['products_id'], 'NONSSL') . '">' . BOX_HELMET_SIZING_TEXT . '</a>'; ?></td>

 

Anyways, hope I make sense.

 

Thanks again!

 

Shayne

Posted
Hi,

 

I'm wondering if there's a way to place some PHP code in the product description from the admin catalogue when adding or modifing products? I simply want to add a link in the product description for a specific product. I've tried adding the following PHP code but it doesn't seem to run. When I view the source on the page, I see the php code, not the result which should be a link. Here's the code I'm trying to. (BTW... this works fine if I just add in to product_info.php and not the product description)

 

<td class="ProductInfoLink" height="10"><?php echo '<a href="' . tep_href_link(FILENAME_HELMET_SIZING, 'products_id=' . $HTTP_GET_VARS['products_id'], 'NONSSL') . '">' . BOX_HELMET_SIZING_TEXT . '</a>'; ?></td>

 

Anyways, hope I make sense.

 

Thanks again!

 

Shayne

 

1) you put '<%MY_NEW_LINK%>' into your product description in admin where you want the link

 

2) before you echo out your description on product_info.php you add :

 

$my_new_link =

'<td class="ProductInfoLink" height="10"><a href="' . tep_href_link(FILENAME_HELMET_SIZING, 'products_id=' . $HTTP_GET_VARS['products_id'], 'NONSSL') . '">' . BOX_HELMET_SIZING_TEXT . '</a></td>';

 

$product_info['products_description'] = str_replace('<%MY_NEW_LINK%>', $my_new_link, $product_info['products_description']);

 

3) echo out the product description

Treasurer MFC

Archived

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

×
×
  • Create New...