Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

admin/productsearch.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: productsearch.php 7709 2001-10-09 08:06:02Z ce $
5 //
6 // Created on: <13-Sep-2000 14:56:11 bf>
7 //
8 // This source file is part of Exponential Basic, publishing software.
9 //
10 // Copyright (C) 1999-2001 eZ Systems. All rights reserved.
11 //
12 // This program is free software; you can redistribute it and/or
13 // modify it under the terms of the GNU General Public License
14 // as published by the Free Software Foundation; either version 2
15 // of the License, or (at your option) any later version.
16 //
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 //
22 // You should have received a copy of the GNU General Public License
23 // along with this program; if not, write to the Free Software
24 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US
25 //
26
27 // include_once( "classes/INIFile.php" );
28 // include_once( "classes/eztemplate.php" );
29 // include_once( "classes/ezlocale.php" );
30 // include_once( "classes/ezcurrency.php" );
31 // include_once( "classes/ezlist.php" );
32
33 $ini =& eZINI::instance( 'site.ini' );
34
35 $Language = $ini->variable( "eZTradeMain", "Language" );
36 $Limit = $ini->variable( "eZTradeMain", "ProductSearchLimit" );
37
38 // include_once( "eztrade/classes/ezproductcategory.php" );
39 // include_once( "eztrade/classes/ezproduct.php" );
40
41 $t = new eZTemplate( "kernel/eztrade/admin/" . $ini->variable( "eZTradeMain", "AdminTemplateDir" ),
42 "kernel/eztrade/admin/intl/", $Language, "productsearch.php" );
43
44 $t->setAllStrings();
45
46 $t->set_file( "product_list_page_tpl", "productsearch.tpl" );
47
48 // path
49 $t->set_block( "product_list_page_tpl", "path_item_tpl", "path_item" );
50
51 // product
52 $t->set_block( "product_list_page_tpl", "product_list_tpl", "product_list" );
53 $t->set_block( "product_list_tpl", "product_item_tpl", "product_item" );
54 $t->set_block( "product_item_tpl", "product_active_item_tpl", "product_active_item" );
55 $t->set_block( "product_item_tpl", "product_inactive_item_tpl", "product_inactive_item" );
56
57 $t->set_var( "site_style", $SiteDesign );
58
59 if ( !isset( $Limit ) or !is_numeric( $Limit ) )
60 $Limit = 10;
61 if ( !isset( $Offset ) or !is_numeric( $Offset ) )
62 $Offset = 0;
63
64 $t->set_var( "search_text", $Search );
65
66 // products
67 $product = new eZProduct();
68 $TotalTypes =& $product->activeProductSearchCount( $Search, FALSE );
69 $productList =& $product->activeProductSearch( $Search, $Offset, $Limit, FALSE );
70 // $sortMode="time";
71 // $productList =& $product->activeProductSearch( $sortMode, $Search, $Offset, $Limit );
72
73 $locale = new eZLocale( $Language );
74 $i=0;
75 $t->set_var( "product_list", "" );
76
77 foreach ( $productList as $product )
78 {
79 $t->set_var( "td_class", ( $i % 2 ) == 0 ? "bglight" : "bgdark" );
80
81 $t->set_var( "product_name", $product->name() );
82 $category = $product->categoryDefinition();
83 $t->set_var( "product_category", is_a( $category, "eZProductCategory" ) ?
84 $category->name() : "", "&nbsp;" );
85 $t->set_var( "product_category_id", is_a( $category, "eZProductCategory" ) ?
86 $category->id() : "", "&nbsp;" );
87
88 $price = new eZCurrency( $product->price() );
89
90 $t->set_var( "product_price", $locale->format( $price ) );
91 $t->set_var( "product_active_item", "" );
92 $t->set_var( "product_inactive_item", "" );
93 if ( $product->showProduct() )
94 {
95 $t->parse( "product_active_item", "product_active_item_tpl" );
96 }
97 else
98 {
99 $t->parse( "product_inactive_item", "product_inactive_item_tpl" );
100 }
101
102 if ( $product->productType() == 2 )
103 $t->set_var( "action_url", "voucher" );
104 else
105 $t->set_var( "action_url", "productedit" );
106
107 $t->set_var( "product_id", $product->id() );
108
109 $t->parse( "product_item", "product_item_tpl", true );
110 $i++;
111 }
112
113 $t->set_var( "offset", $Offset );
114
115 $t->set_var( "product_start", $Offset + 1 );
116 $t->set_var( "product_end", min( $Offset + $Limit, $TotalTypes ) );
117 $t->set_var( "product_total", $TotalTypes );
118
119 eZList::drawNavigator( $t, $TotalTypes, $Limit, $Offset, "product_list_tpl" );
120
121 if ( count( $productList ) > 0 )
122 $t->parse( "product_list", "product_list_tpl" );
123 else
124 $t->set_var( "product_list", "" );
125
126 $t->pparse( "output", "product_list_page_tpl" );
127
128 ?>
$category
if( $Action=="Edit") $category
Definition: adedit.php:378
$Limit
$Limit
Definition: admin/productsearch.php:36
$locale
$locale
Definition: admin/productsearch.php:73
$t
$t
Definition: admin/productsearch.php:41
$TotalTypes
$TotalTypes
Definition: admin/productsearch.php:68
$product
$product
Definition: admin/productsearch.php:67
$i
$i
Definition: admin/productsearch.php:74
$Language
$Language
Definition: admin/productsearch.php:35
$ini
$ini
Definition: admin/productsearch.php:33
$productList
$productList
Definition: admin/productsearch.php:69
eZCurrency
Definition: ezcurrency.php:46
eZList\drawNavigator
static drawNavigator(&$t, $total_types, $max_types, $index, $parent=false, $variables=false)
Definition: ezlist.php:401
eZLocale
Definition: ezlocale.php:119
eZProduct
Definition: ezproduct.php:71
eZTemplate
Definition: eztemplate.php:107
$Offset
$Offset
Definition: ezarticle/user/search.php:110
$SiteDesign
$SiteDesign
Definition: ezbulkmail/user/datasupplier.php:31
$price
$price
Definition: pricegroupedit.php:39
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.