Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

help with php code - converting reference-> string


rockstar

Recommended Posts

Posted

I'm trying to do a quick change to the product_info page but don't really know php.

 

basically, I want to take the reference to the product image

 

$products['products_image']

 

convert it to a string -> images/some_photo.jpg

 

then use some string functions to add a suffix -> images/some_photo_large.jpg

 

then convert it back to the object reference and have the "large image" display on screen.

 

Here's what I tried but it didn't work:

<?php
echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . str_replace(".jpg", "_large.jpg", $products['products_image']), addslashes($product_info['products_name'])) . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>';
?>

 

Any help?

Posted

ok, i figured out how to convert it to the string I want, I used this:

 

str_replace(".jpg", "_lg.jpg", tep_output_string($product_info['products_image'])

 

now all I have to do is figure out how to convert this back to a reference so I can use it in the tep_image function call below:

 

<?php

echo '<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name'])) . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>');

?>

 

again, any help would be appreciated.

Posted

never mind, figured it out. Maybe I'll post to the contributions, but since nobody helped me out, maybe not. Just kidding, I'll post.

Archived

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

×
×
  • Create New...