Блог в котором есть много интересной информации…
в файле /components/com_virtuemart/themes/vm_mynxx/templates/common/availability.tpl.php есть сделующий код:
// Delivery time! // Ships in 24hrs, 48hrs, .... if ( $product_availability ) { ?> <span style= "font-weight:bold;" > <?php echo $VM_LANG ->_( 'PHPSHOP_DELIVERY_TIME' ) ?>: </span> <br /><br /> <?php if ( CHECK_STOCK == '1' && ! $product_in_stock ) { $product_availability = 'not_available.gif' ; } if ( is_file ( VM_THEMEPATH. "images/availability/" . $product_availability )) { echo vmCommonHTML::imageTag( VM_THEMEURL. "images/availability/" . $product_availability , $product_availability ); } else { echo $product_availability ; } } |
этот код вызывается из administrator/components/com_virtuemart/classes/ps_product.php:
function get_availability( $prod_id ) { $html = '' ; $availArr = $this ->get_availability_data( $prod_id ); if ( ! empty ( $availArr )) { $tpl = vmTemplate::getInstance(); $tpl ->set( 'product_id' , $prod_id ); $tpl ->set( 'product_available_date' , $availArr [ 'product_available_date' ] ); $tpl ->set( 'product_availability' , $availArr [ 'product_availability' ] ); $tpl ->set( 'product_in_stock' , $availArr [ 'product_in_stock' ] ); $html = $tpl ->fetch( 'common/availability.tpl.php' ); } return $html ; } |
vmCommonHTML находится здесь administrator\components\com_virtuemart\classes\htmlTools.class.php:
function imageTag( $src , $alt = '' , $align = '' , $height = '' , $width = '' , $title = '' , $border = '0' , $attributes = '' ) { if ( $align ) { $align = ' align="' . $align . '"' ; } if ( $height ) { $height = ' height="' . $height . '"' ; } if ( $width ) { $width = ' width="' . $width . '"' ; } if ( $title ) { $title = ' title="' . $title . '"' ; } if ( $attributes ) { $attributes = ' ' . $attributes ; } if ( strpos ( $attributes , 'border=' )===false) { $border = ' border="' . $border . '"' ; } // Prevent doubled attributes if ( strpos ( $attributes , 'alt=' )===false) { $alt = ' alt="' . $alt . '"' ; } return '<img src="' . $src . '"' . $alt . $align . $title . $height . $width . $border . $attributes . ' />' ; } |
чтобы в листинге товаров получить картинку заданную в админке на странице Product Status в поле Availability , надо добавить следующий код:
<span style= "color:red" > <?php if ( $product_availability ) { if ( is_file ( VM_THEMEPATH. "images/availability/" . $product_availability )) { echo vmCommonHTML::imageTag( VM_THEMEURL. "images/availability/" . $product_availability , $product_availability ); } else { echo "(" . $product_availability . ")" ; } echo '<br>' ; } ?> </span> |