Author Topic: Need url associated with thumbnail in thumbnail_bit.html  (Read 6841 times)

0 Members and 1 Guest are viewing this topic.

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Need url associated with thumbnail in thumbnail_bit.html
« on: October 05, 2002, 05:35:56 PM »
Is there any way to retrieve just the details URL associated with the thumbnail in the thumbnail_bit.html template?  

I want to get that URL and append "&action=buynow".  This is so that when the user clicks the thumbnail, my details page opens and the tab pane where the order form is located is selected and made active.  I have everything working, I just need the url accessible to me in the thumbnail_bit.html template for a new "buy now" button I'm adding.  I've already made the required modifications to details.php and details.html

I could do it myself by adding a new parameter to get_thumbnail_code() and a line like this inside the function

Code: [Select]
if ($MyNewParameter)
$thumb = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&mode=".$mode : ""));


But I'd rather not take this approach if there already exists a way of doing this.

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Okay, call me impatient
« Reply #1 on: October 05, 2002, 05:55:19 PM »
Well I decided to try it anyway and it works.  Here's what I did.  Inside includes/functions.php.
Add after:
Code: [Select]
   "thumbnail_openwindow" => get_thumbnail_code($image_row['image_media_file'], $image_row['image_thumb_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode, $show_link, 1),this
Code: [Select]
   "thumbnail_urlonly" => get_thumbnail_code($image_row['image_media_file'], $image_row['image_thumb_file'], $image_row['image_id'], $image_row['cat_id'], $image_row['image_name'], $mode, $show_link, 1, 1),Change
Code: [Select]
function get_thumbnail_code($media_file_name, $thumb_file_name = "", $image_id, $cat_id, $image_name = "", $mode = "", $show_link = 1, $open_window = 0) {to
Code: [Select]
function get_thumbnail_code($media_file_name, $thumb_file_name = "", $image_id, $cat_id, $image_name = "", $mode = "", $show_link = 1, $open_window = 0, $urlonly = 0) {Change
Code: [Select]
 if ($show_link) {
    if ($open_window) {
to
Code: [Select]
 if ($show_link) {
    if ($urlonly)
      $thumb = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$image_id.((!empty($mode)) ? "&mode=".$mode : ""));
    elseif ($open_window) {


Is there any easier way?

Offline cyber

  • Jr. Member
  • **
  • Posts: 62
    • View Profile
h
« Reply #2 on: October 06, 2002, 02:31:32 AM »
Can you tell me your url to see the demo? tks

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Just visit my site
« Reply #3 on: October 06, 2002, 04:53:51 AM »
I've removed the ability to directly enter the URL of the top level of 4images.  Just go to my main page, then navigate to "Images".  All the thumbnails have a "Buy" button under them.

Clicking either the thumbnail or the Buy button will take you to the details page.  But the buy button also sets the focus to the "Order" tab on the details page thus presenting the visitor with the form to place an order online.  While this seems like a simple concept, the implementation is tricky and the tab pane has some issues in Mozilla.

If you want details about the tab pane, you can find it at http://webfx.eae.net/dhtml/tabpane/tabpane.html

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Other code mods used
« Reply #4 on: October 06, 2002, 05:02:37 AM »
As long as I'm at it, here are the other changes I had to make to get this working:

In details.php, just above
Code: [Select]
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------

Add:
Code: [Select]
$order_tab_focus = "";
if ($action == "buy") {
$order_tab_focus = "<script type=\"text/javascript\">\n<!--\njavascript:tp1.setSelectedIndex(2);\n//-->\n</script>";
}

//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------

And add just after:
Code: [Select]
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  "msg" => $msg,

This:
Code: [Select]
//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  "msg" => $msg,
  "order_tab_focus" => $order_tab_focus,


You will just have to look at the code from http://webfx.eae.net/dhtml/tabpane/tabpane.html to understand what
Code: [Select]
javascript:tp1.setSelectedIndex(2) does.

This is what I put in my thumbnail_bit.html template
Code: [Select]
<a href="{thumbnail_urlonly}&action=buy"><img src="{template_url}/images/buy.gif" border="0" alt="{lang_buy}" /></a>

Offline didoman

  • Newbie
  • *
  • Posts: 32
    • View Profile
Re: Need url associated with thumbnail in thumbnail_bit.html
« Reply #5 on: December 03, 2011, 03:04:55 AM »
this is the easy answer

./data/thumbnails/{cat_id}/{thumbnail_file_name}