Author Topic: Need to call a dynamic link for URL in products page - please look  (Read 9528 times)

launchpad67a

  • Beginner
  • *
  • Posts: 16
This is a bit tough to explain, so here it goes.
In the "browse_1.php" the {product_name} is called and it is a URL. When you click it it goes to the "shop.product_details.php" page (flyout page) where you can click the Image. This image url is the one specified as URL in the admin panel for each product.
I need to know how to call this URL on the "browse.php" pages.

Here's what I'm trying to do: I have a Digital Music store and I would like to create a link right next to the "product_name" where people can listen to a song sample. Now if I type the path to the .mp3 in the URL box in the admin panel for each product, this is the path that needs to get written to this link. Understand?
How can I call these urls from the "browse.php" pages?

Thanks so much,
Mike

zorkhh

  • Advanced
  • Jr. Member
  • *****
  • Posts: 245
    • vm-expert.com
Re: Need to call a dynamic link for URL in product
« Reply #1 on: March 15, 2007, 22:34:13 pm »
Hi,

i don't know if i understood what what you need to know - but it is easy to create a link-path to whatever / wherever you want.

Just add something like this to your browse-template:

http://www.yourdomain.com/path/to/the/file/{product_sku}.mp3

for example. I hope this brings you a step forward. If this is not what you need, please try to describe it with an example...

hth

Thomas
Virtuemart Professional Support at http://www.vm-expert.com

Visit the large Virtuemart Group on Joomla.org: http://people.joomla.org/groups/viewgroup/30-Virtuemart.html

launchpad67a

  • Beginner
  • *
  • Posts: 16
Re: Need to call a dynamic link for URL in products page - please look
« Reply #2 on: March 16, 2007, 02:10:44 am »
Thanks Thomas,
The thing is, you cannot add an <a href= ....  like that into the "browse.php" pages. It doesn't parse the code correctly. Adding anything like {product_url} or {product_sku} will not work because those variables are not being pulled into the "browse.php" pages. Believe me, i have tried. There is a {product_url} that I thought would work for sure but it's being defined on another page and not in the browse pages, so it in unrecognized..

At any rate, I have found a work around. I am simply including some script into the "small description" box on the actual product page, in the admin panel. It's not the dynamic method I was hoping to achieve but it's a hard code that works fine.

My goal was to make the store look like an itunes store, where every song is on 1 single line with a "sample audio" button and an add to cart button. I am very close but it's taken a lot of ripping and hacking the files.

Thanks for your reply.
Mike

Lou Reed

  • Jr. Member
  • **
  • Posts: 418
Re: Need to call a dynamic link for URL in products page - please look
« Reply #3 on: March 16, 2007, 03:13:25 am »
Actually, without ripping and hacking any file, if you just place a link like this:

<a href="http://www.mysite.com/MP3/123.mp3"><img src="images/button.gif" /></a>

In the small description of product details page, you will have what you are looking for. Of course the links for the mp3 and image files have to be properly adjusted and so does the behavior for how to get the music to play.

Have a nice day!

launchpad67a

  • Beginner
  • *
  • Posts: 16
Re: Need to call a dynamic link for URL in products page - please look
« Reply #4 on: March 16, 2007, 04:54:19 am »
Actually, without ripping and hacking any file, if you just place a link like this:

<a href="http://www.mysite.com/MP3/123.mp3"><img src="images/button.gif" /></a>

In the small description of product details page, you will have what you are looking for. Of course the links for the mp3 and image files have to be properly adjusted and so does the behavior for how to get the music to play.

Have a nice day!
Thanks, that's exactly what I did according to my previous post.
But, it still is not the dynamic answer I was hoping for. See, I have a single line ".js" audio player that will play any mp3 that is on the same line that It is on. Meaning, it doesn't open an external player and plays transparently on the page...very cool script. But in order for this to work, it must be generated dynamically along with a link associated with that individual product.
That's why I was hoping someone could tell me the exact url to call that is associated with the URL box in the admin panel of the product. It can't be that hard to figure out, but apparently it is. i know php very well and i cannot find the right url coding to pull this off.
In the meantime, the method I am currently using works just fine but it opens the users default mp3 application and I really don't want that. Hence the "dynamic" method.

Thanks,
Mike

lordbarron

  • Beginner
  • *
  • Posts: 1
Re: Need to call a dynamic link for URL in products page - please look
« Reply #5 on: March 30, 2009, 13:17:39 pm »
Hi there I had this same problem and i got lucky with some simple re-writing.
What I wanted to do was wrap the product image preview with the product_url specified in the admin end so that when it was clicked on it didn't show the image preview but opened a specified link (in my case to a flash file).


Look for something that looks like this in your templates/browse/browse_1.php file

        <div class="browseProductImageContainer">
           <script type="text/javascript">//<![CDATA[
           document.write('<a <?php echo $product_url ?>">');
           document.write( '<?php echo ps_product::image_tag( $product_thumb_image, 'class="browseProductImage" border="0" title="'.$product_name.'" alt="'.$product_name .'"' ) ?></a>' );
           //]]>
           </script>
           <noscript>
               <a rel="lightbox;width=1000;height=800;" href="<?php echo $product_full_image ?>" target="_blank" title="<?php echo $product_name ?>">
               <?php echo ps_product::image_tag( $product_thumb_image, 'class="browseProductImage" border="0" title="'.$product_name.'" alt="'.$product_name .'"' ) ?>
               </a>
           </noscript>
        </div>


You  should notice this  document.write('<a <?php echo $product_url ?>">');
i swaped the $product_image for the $product_url It was already defined in an earlier part of the script (stroke of luck for me as I had no idea if this was the case)
So if you want a link just copy that and place it in your browse_1.php script in the relevant place and it should work fine for you.