Welcome, Guest. Please login or register.
Login with username, password and session length


VirtueMart 1.1.8 - [SECURITY RELEASE] is available! Read more....

  Advanced search

247038 Posts in 67506 Topics- by 258314 Members - Latest Member: aniketana
Pages: [1]   Go Down
Print
Author Topic: Include {file_list} in browse_1.php  (Read 9968 times)
keeps21
Newbie
*
Posts: 2


« on: February 27, 2008, 05:11:00 AM »

Hi

I'm looking for a way to include {file_list} in the browse_1.php page so that customers can download a product datasheet for each item.

I have included the code {file_list} in the browse_1.php template, but this just shows up as {file_list} in my browser when the page is viewed.

Any help would be greatly appreciated.
Thanks
Logged
jenkinhill
Global Moderator
Hero Member
*
Posts: 9763



WWW
« Reply #1 on: February 27, 2008, 14:24:13 PM »

You need to add some code in shop.browse.php to get the file list - for the product page this is accomplished in shop.product_details.php  - look to see how $file_list is obtained.

I am not a programmer so don't know exactly how to accomplish this, but that should give you a start.
Logged

Kelvyn
Jenkin Hill Internet,
Keswick, Lake District

Please do not PM or Email me with support questions. I look at PMs only once a month. You will get better and faster responses in the support forums.

Current recommended release versions are: Joomla! 1.5.23 :: VirtueMart 1.1.8

URGENT:  Help VirtueMart development by testing  version 1.1.9
keeps21
Newbie
*
Posts: 2


« Reply #2 on: March 06, 2008, 07:26:29 AM »

I've had no luck in getting this to work, the code is way above my level of php.

Could any of the dev shed any light on the matter?

Thanks very much.
Logged
smalcolm
Newbie
*
Posts: 10



WWW
« Reply #3 on: March 06, 2008, 11:00:12 AM »

Try this...

in the file shop.browse.php insert the following code at line 411 (just above the multi-line comment that starts ***now fill the template)

Code:
  require_once(CLASSPATH . 'ps_product_files.php' ); 
  $db = new ps_DB;
  $product_id = $db_browse->f("product_id");
  // Let's have a look wether the product has images.
  if( $product_parent_id != 0 ) {
  $db->query( "SELECT COUNT(file_id) AS images FROM #__{vm}_product_files WHERE file_product_id=$product_parent_id AND file_is_image=1" );
  }
  else {
    $db->query( "SELECT COUNT(file_id) AS images FROM #__{vm}_product_files WHERE file_product_id=$product_id AND file_is_image=1" );
  }
  $db->next_record();
  $images = new stdClass();
  $images->images = $db->f("images");

  /* MORE IMAGES ??? */
  $more_images = "";
  if( !empty($images->images) ) {
    /* Build the JavaScript Link */
    $more_images = "<a href=\"$mosConfig_live_site/index.php?option=com_virtuemart&page=shop.view_images&flypage=".mosGetParam($_REQUEST, 'flypage')."&product_id=$product_id&category_id=$category_id&Itemid=$Itemid\">";
    $more_images .= "<img src=\"".IMAGEURL."ps_image/more_images.png\" width=\"16\" height=\"16\" border=\"0\" alt=\"".$VM_LANG->_PHPSHOP_MORE_IMAGES ." (".$images->images.")\" />";
    $more_images .= "<br />".$VM_LANG->_PHPSHOP_MORE_IMAGES." (".$images->images.")</a>";
  }
  /* Files? */
  $file_list = ps_product_files::get_file_list( $product_id );

Now, in the same file (shop.browse.php) go down a few lines and you will see several lines of code that all start $product_cell = str_replace(..etc..etc.. AFTER those lines, insert the following two lines:

Code:
  $product_cell = str_replace( "{more_images}", $more_images, $product_cell );
  $product_cell = str_replace( "{file_list}", $file_list, $product_cell );

Now, the {more_images} and {file_list} tags should work in the browse_1 file!

Good luck!
Logged
djstevie84
Newbie
*
Posts: 1


« Reply #4 on: November 17, 2008, 07:53:54 AM »

Anyone know how to this in Vituemart 1.1?

I am willing to pay if needs be


Thanks

Stephen

Try this...
in the file shop.browse.php insert the following code at line 411 (just above the multi-line comment that starts ***now fill the template)
Code:
  require_once(CLASSPATH . 'ps_product_files.php' ); 
  $db = new ps_DB;
  $product_id = $db_browse->f("product_id");
  // Let's have a look wether the product has images.
  if( $product_parent_id != 0 ) {
  $db->query( "SELECT COUNT(file_id) AS images FROM #__{vm}_product_files WHERE file_product_id=$product_parent_id AND file_is_image=1" );
  }
  else {
    $db->query( "SELECT COUNT(file_id) AS images FROM #__{vm}_product_files WHERE file_product_id=$product_id AND file_is_image=1" );
  }
  $db->next_record();
  $images = new stdClass();
  $images->images = $db->f("images");
  /* MORE IMAGES ??? */
  $more_images = "";
  if( !empty($images->images) ) {
    /* Build the JavaScript Link */
    $more_images = "<a href=\"$mosConfig_live_site/index.php?option=com_virtuemart&page=shop.view_images&flypage=".mosGetParam($_REQUEST, 'flypage')."&product_id=$product_id&category_id=$category_id&Itemid=$Itemid\">";
    $more_images .= "<img src=\"".IMAGEURL."ps_image/more_images.png\" width=\"16\" height=\"16\" border=\"0\" alt=\"".$VM_LANG->_PHPSHOP_MORE_IMAGES ." (".$images->images.")\" />";
    $more_images .= "<br />".$VM_LANG->_PHPSHOP_MORE_IMAGES." (".$images->images.")</a>";
  }
  /* Files? */
  $file_list = ps_product_files::get_file_list( $product_id );
Now, in the same file (shop.browse.php) go down a few lines and you will see several lines of code that all start $product_cell = str_replace(..etc..etc.. AFTER those lines, insert the following two lines:
Code:
  $product_cell = str_replace( "{more_images}", $more_images, $product_cell );
  $product_cell = str_replace( "{file_list}", $file_list, $product_cell );
Now, the {more_images} and {file_list} tags should work in the browse_1 file!
Good luck!
Logged
amorino
Jr. Member
**
Posts: 88


« Reply #5 on: August 14, 2009, 07:25:06 AM »

Hello
how it works under 1.1.3?
Best regards
Logged
ZEUS__
Newbie
*
Posts: 46


« Reply #6 on: October 07, 2009, 12:37:59 PM »

please explain how it works on 1.1.3
Logged

PHP on cgi
Joomla!: 1.5.14
Virtuemart: 1.1.3
amorino
Jr. Member
**
Posts: 88


« Reply #7 on: October 09, 2009, 18:26:15 PM »

still waiting Sad
Logged
zerocool6707
Newbie
*
Posts: 2


« Reply #8 on: October 26, 2009, 06:01:49 AM »

I think i got the answer
Logged
amorino
Jr. Member
**
Posts: 88


« Reply #9 on: November 01, 2009, 08:57:21 AM »

Please could you give it to us?
Thanks Wink
Logged
Pages: [1]   Go Up
Print
Jump to: