За последние 24 часа нас посетили 18279 программистов и 1611 роботов. Сейчас ищут 1658 программистов ...

Нужна ваша помощь.

Тема в разделе "PHP для новичков", создана пользователем sashaJan, 23 фев 2009.

  1. sashaJan

    sashaJan Активный пользователь

    С нами с:
    23 фев 2009
    Сообщения:
    5
    Симпатии:
    0
    Всем привет=).Сейчас делаю свой первый сайт.Подскажите как мне лучше преобразовать этот скрипт, а точнее нужно на страницу вывести основное фото + все дополнительные изображения товара.На форуме видел вариант вставить Javascript.Попробовал сам не работает ни где.
    ссылка на форум:
    http://joomlaforum.ru/index.php/topic,21356.new.html#new
    Мой скрипт
    306 строка.

    • PHP:
      1. <?php
      2. if( !defined( '_VALID_MOS' ) && !defined( '_JEXEC' ) ) die( 'Direct Access to '.basename(__FILE__).' is not allowed.' );
      3. /**
      4. *
      5. * @version $Id: shop.product_details.php 1526 2008-09-15 19:21:43Z soeren_nb $
      6. * @package VirtueMart
      7. * @subpackage html
      8. * @copyright Copyright (C) 2004-2008 soeren - All rights reserved.
      9. * @license [url=http://www.gnu.org/copyleft/gpl.html]http://www.gnu.org/copyleft/gpl.html[/url] GNU/GPL, see LICENSE.php
      10. * VirtueMart is free software. This version may have been modified pursuant
      11. * to the GNU General Public License, and as distributed it includes or
      12. * is derivative of works licensed under the GNU General Public License or
      13. * other free or open source software licenses.
      14. * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
      15. *
      16. * [url=http://virtuemart.net]http://virtuemart.net[/url]
      17. */
      18. mm_showMyFileName( __FILE__ );
      19.  
      20. require_once(CLASSPATH . 'ps_product_files.php' );
      21. require_once(CLASSPATH . 'imageTools.class.php' );
      22. require_once(CLASSPATH . 'ps_product.php' );
      23. $ps_product = $GLOBALS['ps_product'] = new ps_product;
      24.  
      25. require_once(CLASSPATH . 'ps_product_category.php' );
      26. $ps_product_category = new ps_product_category;
      27.  
      28. require_once(CLASSPATH . 'ps_product_attribute.php' );
      29. $ps_product_attribute = new ps_product_attribute;
      30.  
      31. require_once(CLASSPATH . 'ps_product_type.php' );
      32. $ps_product_type = new ps_product_type;
      33. require_once(CLASSPATH . 'ps_reviews.php' );
      34.  
      35. $product_id = intval( vmGet($_REQUEST, "product_id", null) );
      36. $product_sku = $db->getEscaped( vmGet($_REQUEST, "sku", '' ) );
      37. $category_id = vmGet($_REQUEST, "category_id", null);
      38. $pop = (int)vmGet($_REQUEST, "pop", 0);
      39. $manufacturer_id = vmGet($_REQUEST, "manufacturer_id", null);
      40. $Itemid = $sess->getShopItemid();
      41. $db_product = new ps_DB;
      42.  
      43. // Get the product info from the database
      44. $q = "SELECT * FROM `#__{vm}_product` WHERE ";
      45. if( !empty($product_id)) {
      46.     $q .= "`product_id`=$product_id";
      47. }
      48. elseif( !empty($product_sku )) {
      49.     $q .= "`product_sku`='$product_sku'";
      50. }
      51. else {
      52.     vmRedirect( $sess->url( $_SERVER['PHP_SELF']."?keyword=".urlencode($keyword)."&category_id={$_SESSION['session_userstate']['category_id']}&limitstart={$_SESSION['limitstart']}&page=shop.browse", false, false ), $VM_LANG->_('PHPSHOP_PRODUCT_NOT_FOUND') );
      53. }
      54.  
      55. if( !$perm->check("admin,storeadmin") ) {
      56.     $q .= " AND `product_publish`='Y'";
      57.     if( CHECK_STOCK && PSHOP_SHOW_OUT_OF_STOCK_PRODUCTS != "1") {
      58.         $q .= " AND `product_in_stock` > 0 ";
      59.     }
      60. }
      61. $db_product->query( $q );
      62.  
      63. // Redirect back to Product Browse Page on Error
      64. if( !$db_product->next_record() ) {
      65.     $vmLogger->err( $VM_LANG->_('PHPSHOP_PRODUCT_NOT_FOUND',false) );
      66.     return;
      67. }
      68. if( empty($product_id)) {
      69.     $product_id = $db_product->f('product_id');
      70. }
      71. $product_parent_id = (int)$db_product->f("product_parent_id");
      72. if ($product_parent_id != 0) {
      73.     $dbp= new ps_DB;
      74.     $dbp->query('SELECT * FROM `#__{vm}_product` WHERE `product_id`='.$product_parent_id );
      75.     $dbp->next_record();
      76. }
      77.  
      78. // Create the template object
      79. $tpl = vmTemplate::getInstance();
      80.  
      81.  
      82. // Let's have a look wether the product has related products.
      83. $q = "SELECT product_sku, related_products FROM #__{vm}_product,#__{vm}_product_relations ";
      84. $q .= "WHERE #__{vm}_product_relations.product_id='$product_id' AND product_publish='Y' ";
      85. $q .= "AND FIND_IN_SET(#__{vm}_product.product_id, REPLACE(related_products, '|', ',' )) LIMIT 0, 4";
      86. $db->query( $q );
      87. /*// This shows randomly selected products from the products table
      88. // if you don't like to set up related products for each product
      89. $q = "SELECT product_sku FROM #__{vm}_product ";
      90. $q .= "WHERE product_publish='Y' AND product_id != $product_id ";
      91. $q .= "ORDER BY RAND() LIMIT 0, 4";
      92. $db->query( $q );*/
      93. $related_products = '';
      94. if( $db->num_rows() > 0 ) {
      95.     $tpl->set( 'ps_product', $ps_product );
      96.     $tpl->set( 'products', $db );
      97.     $related_products = $tpl->fetch( '/common/relatedProducts.tpl.php' );
      98. }
      99.  
      100. // GET THE PRODUCT NAME
      101. $product_name = shopMakeHtmlSafe(  $db_product->f("product_name") );
      102. if( $db_product->f("product_publish") == "N" ) {
      103.     $product_name .= " (".$VM_LANG->_('CMN_UNPUBLISHED').")";
      104. }
      105. $product_description = $db_product->f("product_desc");
      106. if( (str_replace("<br />", "" , $product_description)=='') && ($product_parent_id!=0) ) {
      107.     $product_description = $dbp->f("product_desc"); // Use product_desc from Parent Product
      108. }
      109. $product_description = vmCommonHTML::ParseContentByPlugins( $product_description );
      110.  
      111. // Get the CATEGORY NAVIGATION
      112. $navigation_pathway = "";
      113. $navigation_childlist = "";
      114. $pathway_appended = false;
      115.  
      116. $flypage = vmGet($_REQUEST, "flypage" );
      117.  
      118. // Each Product is assigned to one or more Categories, if category_id was omitted, we must fetch it here
      119. if (empty($category_id) || empty( $flypage ))  {
      120.     $q = "SELECT cx.category_id, category_flypage FROM #__{vm}_category c, #__{vm}_product_category_xref cx WHERE product_id = '$product_id' AND c.category_id=cx.category_id LIMIT 0,1";
      121.     $db->query( $q );
      122.     $db->next_record();
      123.     if( !$db->f("category_id") ) {
      124.         // The Product Has no category entry and must be a Child Product
      125.         // So let's get the Parent Product
      126.         $q = "SELECT product_id FROM #__{vm}_product WHERE product_id = '".$db_product->f("product_parent_id")."' LIMIT 0,1";
      127.         $db->query( $q );
      128.         $db->next_record();
      129.  
      130.         $q = "SELECT cx.category_id, category_flypage FROM #__{vm}_category c, #__{vm}_product_category_xref cx WHERE product_id = '".$db->f("product_id")."' AND c.category_id=cx.category_id LIMIT 0,1";
      131.         $db->query( $q );
      132.         $db->next_record();
      133.     }
      134.     $_GET['category_id'] = $category_id = $db->f("category_id");
      135. }
      136. $ps_product->addRecentProduct($product_id,$category_id,$tpl->get_cfg('showRecent', 5));
      137. if( empty( $flypage )) {
      138.     $flypage = $db->f('category_flypage') ? $db->f('category_flypage') : FLYPAGE;
      139. }
      140. // Flypage Parameter has old page syntax: shop.flypage
      141. // so let's get the second part - flypage
      142. $flypage = str_replace( 'shop.', '', $flypage);
      143. $flypage = stristr( $flypage, '.tpl') ? $flypage : $flypage . '.tpl';
      144.  
      145. // Set up the pathway
      146. // Retrieve the pathway items for this product's category
      147. $category_list = array_reverse( $ps_product_category->get_navigation_list( $category_id ) );
      148. $pathway = $ps_product_category->getPathway( $category_list );
      149.  
      150. // Add this product's name to the pathway, with no link
      151. $item = new stdClass();
      152. $item->name = $product_name;
      153. $item->link = '';
      154. $pathway[] = $item;
      155.  
      156. // Set the CMS pathway
      157. $vm_mainframe->vmAppendPathway( $pathway );
      158.  
      159. // Set the pathway for our template
      160. $tpl->set( 'pathway', $pathway );
      161.  
      162. $tpl->set( 'product_name', $product_name );
      163.  
      164. // Get the neighbor Products to allow navigation on product level
      165. $neighbors = $ps_product->get_neighbor_products( !empty( $product_parent_id ) ? $product_parent_id : $product_id );
      166. $next_product = $neighbors['next'];
      167. $previous_product = $neighbors['previous'];
      168. $next_product_url = $previous_product_url = '';
      169. if( !empty($next_product) ) {
      170.     $url_parameters = 'page=shop.product_details&product_id='.$next_product['product_id'].'&flypage='.$ps_product->get_flypage($next_product['product_id']).'&pop='.$pop;
      171.     if( $manufacturer_id ) {
      172.         $url_parameters .= "&amp;manufacturer_id=" . $manufacturer_id;
      173.     }
      174.     if( $keyword != '') {
      175.         $url_parameters .= "&amp;keyword=".urlencode($keyword);
      176.     }
      177.     if( $pop == 1 ) {
      178.         $next_product_url = $sess->url( $_SERVER['PHP_SELF'].'?'.$url_parameters );
      179.     } else {
      180.         $next_product_url = str_replace("index2","index",$sess->url( $url_parameters ));
      181.     }
      182. }
      183. if( !empty($previous_product) ) {
      184.     $url_parameters = 'page=shop.product_details&product_id='.$previous_product['product_id'].'&flypage='.$ps_product->get_flypage($previous_product['product_id']).'&pop='.$pop;
      185.     if( $manufacturer_id ) {
      186.         $url_parameters .= "&amp;manufacturer_id=" . $manufacturer_id;
      187.     }
      188.     if( $keyword != '') {
      189.         $url_parameters .= "&amp;keyword=".urlencode($keyword);
      190.     }
      191.     if( $pop == 1 ) {
      192.         $previous_product_url = $sess->url( $_SERVER['PHP_SELF'].'?'.$url_parameters );
      193.     } else {
      194.         $previous_product_url = str_replace("index2","index",$sess->url( $url_parameters ));
      195.     }
      196. }
      197.  
      198. $tpl->set( 'next_product', $next_product );
      199. $tpl->set( 'next_product_url', $next_product_url );
      200. $tpl->set( 'previous_product', $previous_product );
      201. $tpl->set( 'previous_product_url', $previous_product_url );
      202.  
      203. $parent_id_link = $db_product->f("product_parent_id");
      204. $return_link = "";
      205. if ($parent_id_link <> 0 ) {
      206.     $q = "SELECT product_name FROM #__{vm}_product WHERE product_id = '$product_parent_id' LIMIT 0,1";
      207.     $db->query( $q );
      208.     $db->next_record();
      209.     $product_parent_name = $db->f("product_name");
      210.     $return_link = "&nbsp;<a class=\"pathway\" href=\"";
      211.     $return_link .= $sess->url($_SERVER['PHP_SELF'] . "?page=shop.product_details&product_id=$parent_id_link");
      212.     $return_link .= "\">";
      213.     $return_link .= $product_parent_name;
      214.     $return_link .= "</a>";
      215.     $return_link .= " ".vmCommonHTML::pathway_separator()." ";
      216. }
      217. $tpl->set( 'return_link', $return_link );
      218.  
      219. // Create the pathway for our template
      220. $navigation_pathway = $tpl->fetch( 'common/pathway.tpl.php');
      221.  
      222. if ($ps_product_category->has_childs($category_id) ) {
      223.     $category_childs = $ps_product_category->get_child_list($category_id);
      224.     $tpl->set( 'categories', $category_childs );
      225.     $navigation_childlist = $tpl->fetch( 'common/categoryChildlist.tpl.php');
      226. }
      227.  
      228. // Set Dynamic Page Title
      229. $vm_mainframe->setPageTitle( html_entity_decode( substr($product_name, 0, 60 ), ENT_QUOTES ));
      230.  
      231. // Prepend Product Short Description Meta Tag "description"
      232. if( vmIsJoomla('1.5')) {
      233.     $document = JFactory::getDocument();
      234.     $document->setDescription(strip_tags( $db_product->f("product_s_desc")));
      235. } else {
      236.     $mainframe->prependMetaTag( "description", strip_tags( $db_product->f("product_s_desc")) );
      237. }
      238.  
      239.  
      240. // Show an "Edit PRODUCT"-Link
      241. if ($perm->check("admin,storeadmin")) {
      242.     $edit_link = '<a href="'. $sess->url( 'index2.php?page=product.product_form&next_page=shop.product_details&product_id='.$product_id).'">
      243.      <img src="images/M_images/edit.png" width="16" height="16" alt="'. $VM_LANG->_('PHPSHOP_PRODUCT_FORM_EDIT_PRODUCT') .'" border="0" /></a>';
      244. }
      245. else {
      246.     $edit_link = "";
      247. }
      248.  
      249. // LINK TO MANUFACTURER POP-UP
      250. $manufacturer_id = $ps_product->get_manufacturer_id($product_id);
      251. $manufacturer_name = $ps_product->get_mf_name($product_id);
      252. $manufacturer_link = "";
      253. if( $manufacturer_id && !empty($manufacturer_name) ) {
      254.     $link = "$mosConfig_live_site/index2.php?page=shop.manufacturer_page&amp;manufacturer_id=$manufacturer_id&amp;output=lite&amp;option=com_virtuemart&amp;Itemid=".$Itemid;
      255.     $text = '( '.$manufacturer_name.' )';
      256.     $manufacturer_link .= vmPopupLink( $link, $text );
      257.  
      258.     // Avoid JavaScript on PDF Output
      259.     if( @$_REQUEST['output'] == "pdf" )
      260.     $manufacturer_link = "<a href=\"$link\" target=\"_blank\" title=\"$text\">$text</a>";
      261. }
      262. // PRODUCT PRICE
      263. if (_SHOW_PRICES == '1') {
      264.     if( $db_product->f("product_unit") && VM_PRICE_SHOW_PACKAGING_PRICELABEL) {
      265.         $product_price_lbl = "<strong>". $VM_LANG->_('PHPSHOP_CART_PRICE_PER_UNIT').' ('.$db_product->f("product_unit")."):</strong>";
      266.     }
      267.     else {
      268.         $product_price_lbl = "<strong>". $VM_LANG->_('PHPSHOP_CART_PRICE'). ": </strong>";
      269.     }
      270.     $product_price = $ps_product->show_price( $product_id );
      271. }
      272. else {
      273.     $product_price_lbl = "";
      274.     $product_price = "";
      275. }
      276. // @var array $product_price_raw The raw unformatted Product Price in Float Format
      277. $product_price_raw = $ps_product->get_adjusted_attribute_price($product_id);
      278.        
      279. // Change Packaging - Begin
      280. // PRODUCT PACKAGING
      281. if (  $db_product->f("product_packaging") ) {
      282.     $packaging = $db_product->f("product_packaging") & 0xFFFF;
      283.     $box = ($db_product->f("product_packaging") >> 16) & 0xFFFF;
      284.     $product_packaging = "";
      285.     if ( $packaging ) {
      286.         $product_packaging .= $VM_LANG->_('PHPSHOP_PRODUCT_PACKAGING1').$packaging;
      287.         if( $box ) $product_packaging .= "<br/>";
      288.     }
      289.     if ( $box ) {
      290.         $product_packaging .= $VM_LANG->_('PHPSHOP_PRODUCT_PACKAGING2').$box;
      291.     }
      292.  
      293.     $product_packaging = str_replace("{unit}",$db_product->f("product_unit")?$db_product->f("product_unit") : $VM_LANG->_('PHPSHOP_PRODUCT_FORM_UNIT_DEFAULT'),$product_packaging);
      294. }
      295. else {
      296.     $product_packaging = "";
      297. }
      298. // Change Packaging - End
      299.  
      300. // PRODUCT IMAGE
      301. $product_full_image = $product_parent_id!=0 && !$db_product->f("product_full_image") ?
      302. $dbp->f("product_full_image") : $db_product->f("product_full_image"); // Change
      303. $product_thumb_image = $product_parent_id!=0 && !$db_product->f("product_thumb_image") ?
      304. $dbp->f("product_thumb_image") : $db_product->f("product_thumb_image"); // Change
      305.  
      306. /* MORE IMAGES ??? */
      307. $files = ps_product_files::getFilesForProduct( $product_id );
      308.  
      309. $more_images = "";
      310. if( !empty($files['images']) ) {
      311.     $more_images = $tpl->vmMoreImagesLink( $files['images'] );
      312.    
      313. }
      314. // Does the Product have files?
      315. $file_list = ps_product_files::get_file_list( $product_id );
      316.  
      317. $product_availability = '';
      318.  
      319. if( @$_REQUEST['output'] != "pdf" ) {
      320.     // Show the PDF, Email and Print buttons
      321.     $tpl->set('option', $option);
      322.     $tpl->set('category_id', $category_id );
      323.     $tpl->set('product_id', $product_id );
      324.     $buttons_header = $tpl->fetch( 'common/buttons.tpl.php' );
      325.     $tpl->set( 'buttons_header', $buttons_header );
      326.  
      327.     // AVAILABILITY
      328.     // This is the place where it shows: Availability: 24h, In Stock: 5 etc.
      329.     // You can make changes to this functionality in the file: classes/ps_product.php
      330.     $product_availability = $ps_product->get_availability($product_id);
      331. }
      332. $product_availability_data = $ps_product->get_availability_data($product_id);
      333.  
      334. /** Ask seller a question **/
      335. $ask_seller_href = $sess->url( $_SERVER ['PHP_SELF'].'?page=shop.ask&amp;flypage='.@$_REQUEST['flypage']."&amp;product_id=$product_id&amp;category_id=$category_id" );
      336. $ask_seller_text = $VM_LANG->_('VM_PRODUCT_ENQUIRY_LBL');
      337. $ask_seller = '<a class="button" href="'. $ask_seller_href .'">'. $ask_seller_text .'</a>';
      338.  
      339. /* SHOW RATING */
      340. $product_rating = "";
      341. if (PSHOP_ALLOW_REVIEWS == '1') {
      342.     $product_rating = ps_reviews::allvotes( $product_id );
      343. }
      344.  
      345. $product_reviews = $product_reviewform = "";
      346. /* LIST ALL REVIEWS **/
      347. if (PSHOP_ALLOW_REVIEWS == '1') {
      348.     /*** Show all reviews available ***/
      349.     $product_reviews = ps_reviews::product_reviews( $product_id );
      350.     /*** Show a form for writing a review ***/
      351.  
      352.     if( $auth['user_id'] > 0 ) {
      353.         $product_reviewform = ps_reviews::reviewform( $product_id );
      354.     }
      355. }
      356.  
      357. /* LINK TO VENDOR-INFO POP-UP **/
      358. $vend_id = $ps_product->get_vendor_id($product_id);
      359. $vend_name = $ps_product->get_vendorname($product_id);
      360.  
      361. $link = "$mosConfig_live_site/index2.php?page=shop.infopage&amp;vendor_id=$vend_id&amp;output=lite&amp;option=com_virtuemart&amp;Itemid=".$Itemid;
      362. $text = $VM_LANG->_('PHPSHOP_VENDOR_FORM_INFO_LBL');
      363. $vendor_link = vmPopupLink( $link, $text );
      364.  
      365. // Avoid JavaScript on PDF Output
      366. if( @$_REQUEST['output'] == "pdf" )
      367. $vendor_link = "<a href=\"$link\" target=\"_blank\" title=\"$text\">$text</a>";
      368.  
      369. if ($product_parent_id!=0 && !$ps_product_type->product_in_product_type($product_id)) {
      370.     $product_type = $ps_product_type->list_product_type($product_parent_id);
      371. }
      372. else {
      373.     $product_type = $ps_product_type->list_product_type($product_id);
      374. }
      375.  
      376.  
      377. $recent_products = $ps_product->recentProducts($product_id,$tpl->get_cfg('showRecent', 5));
      378. /**
      379. * This has changed since VM 1.1.0  
      380. * Now we have a template object that can use all variables
      381. * that we assign here.
      382. *
      383. * Example: If you run
      384. * $tpl->set( "product_name", $product_name );
      385. * The variable "product_name" will be available in the template under this name
      386. * with the value of $product_name
      387. *
      388. * */
      389.  
      390. // This part allows us to copy ALL properties from the product table
      391. // into the template
      392. $productData = $db_product->get_row();
      393. $productArray = get_object_vars( $productData );
      394.  
      395. $productArray["product_id"] = $product_id;
      396. $productArray["product_full_image"] = $product_full_image; // to display the full image on flypage
      397. $productArray["product_thumb_image"] = $product_thumb_image;
      398. $productArray["product_name"] = shopMakeHtmlSafe($productArray["product_name"]);
      399.  
      400. $tpl->set( 'productArray', $productArray );
      401. foreach( $productArray as $property => $value ) {
      402.     $tpl->set( $property, $value);
      403. }
      404. // Assemble the thumbnail image as a link to the full image
      405. // This function is defined in the theme (theme.php)
      406. $product_image = $tpl->vmBuildFullImageLink( $productArray );
      407. $tpl->set( "product_id", $product_id );
      408. $tpl->set( "product_name", $product_name );
      409. $tpl->set( "product_image", $product_image );
      410. $tpl->set( "more_images", $more_images );
      411. $tpl->set( "images", $files['images'] );
      412. $tpl->set( "files", $files['files'] );
      413. $tpl->set( "file_list", $file_list );
      414. $tpl->set( "edit_link", $edit_link );
      415. $tpl->set( "manufacturer_link", $manufacturer_link );
      416. $tpl->set( "product_price", $product_price );
      417. $tpl->set( "product_price_lbl", $product_price_lbl );
      418. $tpl->set( 'product_price_raw', $product_price_raw );
      419. $tpl->set( "product_description", $product_description );
      420.  
      421. /* ADD-TO-CART */
      422. $tpl->set( 'manufacturer_id', $manufacturer_id );
      423. $tpl->set( 'flypage', $flypage );
      424. $tpl->set( 'ps_product_attribute', $ps_product_attribute );
      425. $addtocart = $tpl->fetch('product_details/includes/addtocart_form.tpl.php' );
      426.  
      427. $tpl->set( "addtocart", $addtocart );
      428. // Those come from separate template files
      429. $tpl->set( "navigation_pathway", $navigation_pathway );
      430. $tpl->set( "navigation_childlist", $navigation_childlist );
      431. $tpl->set( "product_reviews", $product_reviews );
      432. $tpl->set( "product_reviewform", $product_reviewform );
      433. $tpl->set( "product_availability", $product_availability );
      434. $tpl->set( "product_availability_data", $product_availability_data );
      435.  
      436. $tpl->set( "related_products", $related_products );
      437. $tpl->set( "vendor_link", $vendor_link );
      438. $tpl->set( "product_type", $product_type ); // Changed Product Type
      439. $tpl->set( "product_packaging", $product_packaging ); // Changed Packaging
      440. $tpl->set( "ask_seller_href", $ask_seller_href ); // Product Enquiry!
      441. $tpl->set( "ask_seller_text", $ask_seller_text ); // Product Enquiry!
      442. $tpl->set( "ask_seller", $ask_seller ); // Product Enquiry!
      443. $tpl->set( "recent_products", $recent_products); // Recent products
      444. /* Finish and Print out the Page */
      445. echo $tpl->fetch( '/product_details/'.$flypage . '.php' );
      446.  
      447. ?>

    вот что предлогают добавить в код на форуме:
    Код (Text):
    1.  
    2. /* MORE IMAGES (Дополнительные изображения) */
    3. $gavMore_Images = "";
    4. $gavMore_Imagess = "";
    5.  if( !empty($images->images) )
    6.    {
    7.     $gavMore_Images = "<hr /><div style=\"font-weight:bold;float:left;\">Дополнительные изображения&nbsp;</div> (нажмите, чтобы увеличить):<br />";
    8.     $database->setQuery( "SELECT * FROM #__vm_product_files WHERE file_product_id='$product_id' AND file_is_image='1'" );
    9.     $images = $database->loadObjectList();
    10.     $i = 1;
    11.     foreach( $images as $image )
    12.      {
    13.        $info = pathinfo( $image->file_name );
    14.        $src = dirname($image->file_url) ."/resized/". basename($image->file_name, ".".$info["extension"])."_".PSHOP_IMG_WIDTH."x".PSHOP_IMG_HEIGHT.".".$info["extension"];
    15.        $alt = $image->file_title;
    16.        $height = empty($image->file_image_thumb_height) ? PSHOP_IMG_HEIGHT : $image->file_image_thumb_height;
    17.        $width = empty($image->file_image_thumb_width) ? PSHOP_IMG_WIDTH : $image->file_image_thumb_width;
    18.        $src_full = str_replace( $mosConfig_absolute_path, $mosConfig_live_site, $image->file_name );
    19.        if( strstr( $src, $mosConfig_live_site.$image->file_name))
    20.        $src_full = str_replace( $mosConfig_live_site.$image->file_name, $mosConfig_live_site."/".$image->file_name, $src_full );
    21.        $alt_full = $image->file_title;
    22.        $height_full = $image->file_image_height+29;
    23.        $width_full = $image->file_image_width+34;
    24.       $border = 1;
    25.       $titlewsp = str_replace(".", "", basename($image->file_name));
    26.       $title = $image->file_title;
    27.       $gavMore_Images .= "<a href=\"javascript:doPic('$src');\" style=\"cursor:hand;cursor:pointer;\"><img src=\"$src\" width=\"$width\" border=0/></a>";      
    28.       ++$i;
    29.      }//end foreach
    30.    }
    31.   /* END MORE IMAGES (Дополнительные изображения) */
    32. ?>
    33. <SCRIPT LANGUAGE="JavaScript">
    34. <!-- Begin
    35. browserName = navigator.appName;
    36. browserVer = parseInt(navigator.appVersion);
    37.  
    38. ns3up = (browserName == "Netscape" && browserVer >= 3);
    39. ie4up = (browserName.indexOf("Microsoft") >= 0 && browserVer >= 4);
    40.  
    41. function doPic(imgName) {
    42. if (ns3up || ie4up) {
    43. imgOn = ("" + imgName);
    44. document.mainpic.src = imgOn;
    45.    }
    46. }
    47. //  End -->
    48. </script>
    49. <?php
    50. $gavMore_Imagess .= "<img name=\"mainpic\" src=\"$imageurl\" width=\"$width_full\"  border=\"0
    51.  
    52. ////////////////////////////////////
    53. $template = str_replace( "{gavMore_Images}", $gavMore_Images, $template );
    54. $template = str_replace( "{gavMore_Imagess}", $gavMore_Imagess, $template );
    Подскажите где ошибка, и как ее лучше исправить.
     
  2. [vs]

    [vs] Суперстар
    Команда форума Модератор

    С нами с:
    27 сен 2007
    Сообщения:
    10.559
    Симпатии:
    632
    Полагаю, самостоятельно переписать.