[ Index ]
 

Code source de eZ Publish 3.9.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/kernel/shop/ -> productsoverview.php (source)

   1  <?php
   2  //
   3  // Created on: <04-Nov-2005 12:26:52 dl>
   4  //
   5  // SOFTWARE NAME: eZ publish
   6  // SOFTWARE RELEASE: 3.9.0
   7  // BUILD VERSION: 17785
   8  // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS
   9  // SOFTWARE LICENSE: GNU General Public License v2.0
  10  // NOTICE: >
  11  //   This program is free software; you can redistribute it and/or
  12  //   modify it under the terms of version 2.0  of the GNU General
  13  //   Public License as published by the Free Software Foundation.
  14  //
  15  //   This program is distributed in the hope that it will be useful,
  16  //   but WITHOUT ANY WARRANTY; without even the implied warranty of
  17  //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18  //   GNU General Public License for more details.
  19  //
  20  //   You should have received a copy of version 2.0 of the GNU General
  21  //   Public License along with this program; if not, write to the Free
  22  //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  23  //   MA 02110-1301, USA.
  24  //
  25  //
  26  
  27  /*! \file ezproductsoverview.php
  28  */
  29  
  30  include_once ( 'kernel/common/template.php' );
  31  include_once ( 'kernel/classes/ezpreferences.php' );
  32  include_once ( 'kernel/shop/classes/ezshopfunctions.php' );
  33  
  34  $module =& $Params['Module'];
  35  $offset =& $Params['Offset'];
  36  $productClassIdentifier =& $Params['ProductClass'];
  37  $productClass = false;
  38  $priceAttributeIdentifier = false;
  39  
  40  if ( $module->isCurrentAction( 'Sort' ) )
  41  {
  42      $productClassIdentifier = $module->hasActionParameter( 'ProductClass' ) ? $module->actionParameter( 'ProductClass' ) : false;
  43      $sortingField = $module->hasActionParameter( 'SortingField' ) ? $module->actionParameter( 'SortingField' ) : 'none';
  44      $sortingOrder = $module->hasActionParameter( 'SortingOrder' ) ? $module->actionParameter( 'SortingOrder' ) : 'asc';
  45  
  46      eZPreferences::setValue( 'productsoverview_sorting_field', $sortingField );
  47      eZPreferences::setValue( 'productsoverview_sorting_order', $sortingOrder );
  48  }
  49  
  50  if ( $module->isCurrentAction( 'ShowProducts' ) )
  51      $productClassIdentifier = $module->hasActionParameter( 'ProductClass' ) ? $module->actionParameter( 'ProductClass' ) : false;
  52  
  53  $productClassList = eZShopFunctions::productClassList();
  54  
  55  // find selected product class
  56  if ( count( $productClassList ) > 0 )
  57  {
  58      if ( $productClassIdentifier )
  59      {
  60          $keys = array_keys( $productClassList );
  61          foreach( $keys as $key )
  62          {
  63              $productClass =& $productClassList[$key];
  64              if ( $productClass->attribute( 'identifier' ) === $productClassIdentifier )
  65                  break;
  66          }
  67      }
  68      else
  69      {
  70          // use first element of $productClassList
  71          $productClass =& $productClassList[0];
  72      }
  73  }
  74  
  75  if ( is_object( $productClass ) )
  76      $priceAttributeIdentifier = eZShopFunctions::priceAttributeIdentifier( $productClass );
  77  
  78  switch ( eZPreferences::value( 'productsoverview_list_limit' ) )
  79  {
  80      case '2': { $limit = 25; } break;
  81      case '3': { $limit = 50; } break;
  82      default:  { $limit = 10; } break;
  83  }
  84  
  85  $sortingField = eZPreferences::value( 'productsoverview_sorting_field' );
  86  $sortingOrder = eZPreferences::value( 'productsoverview_sorting_order' );
  87  
  88  $viewParameters = array( 'offset' => $offset );
  89  
  90  $tpl =& templateInit();
  91  $tpl->setVariable( 'product_class_list', $productClassList );
  92  $tpl->setVariable( 'product_class', $productClass );
  93  $tpl->setVariable( 'price_attribute_identifier', $priceAttributeIdentifier );
  94  $tpl->setVariable( 'sorting_field', $sortingField );
  95  $tpl->setVariable( 'sorting_order', $sortingOrder );
  96  $tpl->setVariable( 'limit', $limit );
  97  $tpl->setVariable( 'view_parameters', $viewParameters );
  98  
  99  $Result = array();
 100  $Result['content'] =& $tpl->fetch( "design:shop/productsoverview.tpl" );
 101  $Result['path'] = array( array( 'text' => ezi18n( 'kernel/shop', 'Products overview' ),
 102                                  'url' => false ) );
 103  
 104  ?>


Généré le : Sat Feb 24 10:30:04 2007 par Balluche grâce à PHPXref 0.7