Hey,
I have used the following method to make a link in my orders page to the image, however I have 11 different upload attributes (long story) and this creates a rather unsightly bit of code which isn't very flexible.
The code now looks as follows:
//echo '<br /><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br(zen_output_string_protected($order->products[$i]['attributes'][$j]['value']));
echo '<br><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ';
if (($order->products[$i]['attributes'][$j]['option'] == "1") or ($order->products[$i]['attributes'][$j]['option'] == "2") or ($order->products[$i]['attributes'][$j]['option'] == "3") or ($order->products[$i]['attributes'][$j]['option'] == "4") or ($order->products[$i]['attributes'][$j]['option'] == "5") or ($order->products[$i]['attributes'][$j]['option'] == "6") or ($order->products[$i]['attributes'][$j]['option'] == "7") or ($order->products[$i]['attributes'][$j]['option'] == "8") or ($order->products[$i]['attributes'][$j]['option'] == "9") or ($order->products[$i]['attributes'][$j]['option'] == "10") or ($order->products[$i]['attributes'][$j]['option'] == "1.")){
$full_logo_name = $order->products[$i]['attributes'][$j]['value'];
$pieces = explode(".", $full_logo_name);
echo ' <a href="' . HTTP_SERVER . DIR_WS_CATALOG . '/images/uploads/' . $pieces[0] . '.' . $pieces[2] . '" target="_blank">' . nl2br($order->products[$i]['attributes'][$j]['value']) . '</a>';
} else {
Obviously this would be 1,000,000's of times better if it had one "if" statement, which checked if the product_option_type was "file" and then did the same process. Does anyone know how to modify this?
ORIGINAL METHOD:
boylan:
Continuing on the bad practice described above - I have changed the .htaccess file to allow access to the uploaded images from IP address of the store owner - and created a link on the edit order page to view the file. To do this on your site:
(using 1.3.5)
change line 401 of admin/orders.php FROM:
echo '<br /><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br($order->products[$i]['attributes'][$j]['value']);
> TO:
> ```
// echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ' . nl2br($order->products[$i]['attributes'][$j]['value']);
echo '<br><nobr><small> <i> - ' . $order->products[$i]['attributes'][$j]['option'] . ': ';
if ($order->products[$i]['attributes'][$j]['option'] == "Logo 1" || $order->products[$i]['attributes'][$j]['option'] == "Logo 2" || $order->products[$i]['attributes'][$j]['option'] == "Logo 3" || $order->products[$i]['attributes'][$j]['option'] == "Logo 4" || $order->products[$i]['attributes'][$j]['option'] == "Logo 5") {
$full_logo_name = $order->products[$i]['attributes'][$j]['value'];
$pieces = explode(".", $full_logo_name);
echo nl2br($order->products[$i]['attributes'][$j]['value']) . ' <a href="/images/uploads/' . $pieces[0] . '.' . $pieces[2] . '" target="_blank">View ' . $pieces[0] . '.' . $pieces[2] . '</a>';
} else {
echo nl2br($order->products[$i]['attributes'][$j]['value']);
}
Which results in something like this:
Logo 1: 4. joomla_logo_black.jpg View 4.jpg
The above only works because the Option Name for uploaded images is "Logo 1" through "Logo 5". If the Option Name for your uploaded file is different, then change those names. It will also fail if there is more than one "." in a filename - but I'm not sure Zen-Cart would allow it to be uploaded.
It currently works on my site, but no guarantees. Hope this helps some people - its not a full uploaded file editor, but it will allow unskilled store admins to at least see the uploaded files referenced without typing a bunch of stuff.