Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

customerview.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: customerview.php 8153 2001-11-01 13:05:52Z ce $
5 //
6 // Created on: <21-Sep-2001 16:06:44 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 // include_once( "eztrade/classes/ezorder.php" );
34 // include_once( "eztrade/classes/ezwishlist.php" );
35 // include_once( "eztrade/classes/ezvoucher.php" );
36 // include_once( "eztrade/classes/ezvoucherused.php" );
37 // include_once( "ezuser/classes/ezuser.php" );
38
39 $ini =& eZINI::instance( 'site.ini' );
40 $Language = $ini->variable( "eZTradeMain", "Language" );
41
42 $t = new eZTemplate( "kernel/eztrade/admin/" . $ini->variable( "eZTradeMain", "AdminTemplateDir" ),
43 "kernel/eztrade/admin/intl/", $Language, "customerview.php" );
44
45 $languageINI = new eZINI( "kernel/eztrade/admin/intl/" . $Language . "/customerview.php.ini", false );
46
47 $t->set_file( "customer_view_tpl", "customerview.tpl" );
48 $t->set_block( "customer_view_tpl", "customer_account_number_box_tpl", "customer_account_number_box" );
49
50 // address
51 $t->set_block( "customer_view_tpl", "address_list_tpl", "address_list" );
52 $t->set_block( "address_list_tpl", "address_item_tpl", "address_item" );
53
54 // order
55 $t->set_block( "customer_view_tpl", "order_list_tpl", "order_list" );
56 $t->set_block( "order_list_tpl", "order_item_tpl", "order_item" );
57
58 // wish list
59 $t->set_block( "customer_view_tpl", "wish_list_tpl", "wish_list" );
60 $t->set_block( "wish_list_tpl", "wishlist_image_tpl", "wishlist_image" );
61 $t->set_block( "wish_list_tpl", "wishlist_item_tpl", "wishlist_item" );
62 $t->set_block( "wishlist_item_tpl", "is_bought_tpl", "is_bought" );
63 $t->set_block( "wishlist_item_tpl", "is_not_bought_tpl", "is_not_bought" );
64 $t->set_block( "wishlist_item_tpl", "wishlist_item_option_tpl", "wishlist_item_option" );
65
66 // vouchers
67 $t->set_block( "customer_view_tpl", "voucher_list_tpl", "voucher_list" );
68 $t->set_block( "voucher_list_tpl", "used_item_tpl", "used_item" );
69
70 $t->setAllStrings();
71
72 $customer = new eZUser( $CustomerID );
73
74 $t->set_var( "customer_id", $customer->id() );
75 $t->set_var( "customer_first_name", $customer->firstName() );
76 $t->set_var( "customer_last_name", $customer->lastName() );
77 $t->set_var( "customer_email", $customer->email() );
78
79 if ( $customer->accountNumber() != "" )
80 {
81 $t->set_var( "customer_account_number", $customer->accountNumber() );
82 $t->parse( "customer_account_number_box", "customer_account_number_box_tpl", true );
83 }else {
84 $t->set_var( "customer_account_number", "N/A" );
85 }
86 $order = new eZOrder();
87 $orders =& $order->getByCustomer( $customer );
88
89 $locale = new eZLocale( $Language );
90 $currency = new eZCurrency();
91
92 // address list
93
94 $addressArray =& $customer->addresses();
95
96 foreach ( $addressArray as $address )
97 {
98 $t->set_var( "street1", $address->street1() );
99 $t->set_var( "street2", $address->street2() );
100 $t->set_var( "zip", $address->zip() );
101 $t->set_var( "place", $address->place() );
102
103 $country = $address->country();
104 if( !is_bool( $country ) )
105 {
106 $t->set_var( "country", $country->name() );
107 }
108 else
109 {
110 $t->set_var( "country", "" );
111 }
112 $t->parse( "address_item", "address_item_tpl", true );
113 }
114
115 $t->parse( "address_list", "address_list_tpl" );
116
117
118 // order list
119 $t->set_var( "order_count", count( $orders ) );
120 $t->set_var( "wish_count", "" );
121 $u=0;
122 foreach ( $orders as $order )
123 {
124 if ( ( $i % 2 ) == 0 )
125 $t->set_var( "td_class", "bgdark" );
126 else
127 $t->set_var( "td_class", "bglight" );
128
129 $t->set_var( "order_id", $order->id() );
130 $t->set_var( "order_date", $order->id() );
131
132 $status = $order->initialStatus( );
133 $dateTime = $status->altered();
134 $t->set_var( "order_date", $locale->format( $dateTime ) );
135
136 $statusType = $status->type();
137 $statusName = preg_replace( "#intl-#", "", $statusType->name() );
138 // $statusName = $languageINI->variable( "strings", $statusName );
139 $t->set_var( "order_status", $statusName );
140
141 $currency->setValue( $order->totalPrice() );
142 $t->set_var( "order_price", $locale->format( $currency ) );
143
144 $i++;
145 $t->parse( "order_item", "order_item_tpl", true );
146 }
147
148 $wishlistObject =new eZWishList();
149 $wishlist =& $wishlistObject->getByUser( $customer );
150
151 $t->set_var( "wish_count", "0" );
152 $t->set_var( "wish_list", "" );
153 if ( $wishlist )
154 {
155 $items =& $wishlist->items();
156 $count = count ( $items );
157 $i=0;
158 if ( $count > 0 )
159 {
160 foreach ( $items as $item )
161 {
162 $product =& $item->product();
163 if ( $product )
164 {
165 if ( ( $i % 2 ) == 0 )
166 $t->set_var( "td_class", "bgdark" );
167 else
168 $t->set_var( "td_class", "bglight" );
169
170 $image =& $product->thumbnailImage();
171
172 $t->set_var( "product_id", $product->id() );
173 $t->set_var( "product_name", $product->name() );
174
175 $t->set_var( "wishlist_item_id", $item->id() );
176
177 if ( $image )
178 {
179 $thumbnail =& $image->requestImageVariation( 35, 35 );
180
181 $t->set_var( "product_image_path", "/" . $thumbnail->imagePath() );
182 $t->set_var( "product_image_width", $thumbnail->width() );
183 $t->set_var( "product_image_height", $thumbnail->height() );
184 $t->set_var( "product_image_caption", $image->caption() );
185 $t->parse( "wishlist_image", "wishlist_image_tpl" );
186 }
187 else
188 {
189 $t->set_var( "wishlist_image", "&nbsp;" );
190 }
191
192 if ( $item->isBought() )
193 {
194 $t->set_var( "is_not_bought", "" );
195 $t->parse( "is_bought", "is_bought_tpl" );
196 }
197 else
198 {
199 $t->set_var( "is_bought", "" );
200 $t->parse( "is_not_bought", "is_not_bought_tpl" );
201 }
202
203 // product price
204 $price = $item->price();
205 $currency->setValue( $price );
206 $sum += $price;
207
208 $t->set_var( "product_price", $locale->format( $currency ) );
209
210 $t->set_var( "wishlist_item_count", $item->count() );
211
212 $t->set_var( "product_price", $locale->format( $currency ) );
213
214 $t->set_var( "wishlist_item_option", "" );
215
216 $optionValues =& $item->optionValues();
217
218 foreach ( $optionValues as $optionValue )
219 {
220 $option =& $optionValue->option();
221 $value =& $optionValue->optionValue();
222
223 $t->set_var( "option_name", $option->name() );
224
225 $descriptions =& $value->descriptions();
226 $t->set_var( "option_value", $descriptions[0] );
227
228 $t->parse( "wishlist_item_option", "wishlist_item_option_tpl", true );
229 }
230
231 $i++;
232 $t->parse( "wishlist_item", "wishlist_item_tpl", true );
233 }
234 }
235 $t->set_var( "wish_count", $count );
236 $t->parse( "wish_list", "wish_list_tpl" );
237 }
238 }
239
240 $t->set_var( "voucher_list", "" );
241 $vouchers = "0";
242 $voucherObject = new eZVoucherUsed();
243 $vouchers =& $voucherObject->getByUser( $customer );
244 $count = count ( $vouchers );
245 $t->set_var( "voucher_count", $count );
246 $t->set_var( "used_item", "" );
247 if ( $count > 0 )
248 {
249 $i=0;
250 foreach ( $vouchers as $used )
251 {
252 if ( ( $i % 2 ) == 0 )
253 $t->set_var( "td_class", "bgdark" );
254 else
255 $t->set_var( "td_class", "bglight" );
256
257 $currency->setValue( $used->price() );
258 $t->set_var( "used_price", $locale->format( $currency ) );
259 $t->set_var( "used_used", $locale->format( $used->used() ) );
260
261 $localUser =& $used->user();
262
263 $t->set_var( "user_name", $localUser->firstName() . " " . $localUser->lastName() );
264 $t->set_var( "user_id", $localUser->id() );
265
266 $order =& $used->order();
267 $voucher =& $used->voucher( false );
268 $t->set_var( "voucher_id", $voucher );
269
270 $t->set_var( "order_id", $order->id() );
271 $t->parse( "used_item", "used_item_tpl", true );
272 $i++;
273 }
274 $t->parse( "voucher_list", "voucher_list_tpl" );
275 }
276
277
278 if ( count( $orders ) > 0 )
279 {
280 $t->parse( "order_list", "order_list_tpl" );
281 }
282 else
283 {
284 $t->set_var( "order_list", "" );
285 }
286
287 $t->pparse( "output", "customer_view_tpl" );
288
289 ?>
$i
$i
Definition: admin/adlist.php:91
$items
$items
Definition: admin/orderview.php:211
$localUser
if(! $user) $localUser
Definition: admin/orderview.php:96
$dateTime
$dateTime
Definition: authorview.php:77
$status
$status
Definition: bugedit.php:473
$address
$address
Definition: checkout.php:588
eZCurrency
Definition: ezcurrency.php:46
eZINI
Reads and writes .ini style configuration files.
eZLocale
Definition: ezlocale.php:119
eZOrder
Definition: ezorder.php:52
eZTemplate
Definition: eztemplate.php:107
eZUser
Definition: ezuser.php:76
eZVoucherUsed
Definition: ezvoucherused.php:49
eZWishList
Definition: ezwishlist.php:63
$item
$item
Definition: classes/admin/linklist.php:228
$order
$order
Definition: customerview.php:86
$voucherObject
$voucherObject
Definition: customerview.php:242
$vouchers
$vouchers
Definition: customerview.php:241
$currency
$currency
Definition: customerview.php:90
$locale
$locale
Definition: customerview.php:89
$t
$t
Definition: customerview.php:42
$languageINI
$languageINI
Definition: customerview.php:45
$wishlistObject
foreach( $orders as $order) $wishlistObject
Definition: customerview.php:148
$addressArray
$addressArray
Definition: customerview.php:94
$Language
$Language
Definition: customerview.php:40
$ini
$ini
Definition: customerview.php:39
$customer
$customer
Definition: customerview.php:72
$orders
$orders
Definition: customerview.php:87
$u
$u
Definition: customerview.php:121
$wishlist
$wishlist
Definition: customerview.php:149
$count
$count
Definition: customerview.php:244
$thumbnail
$thumbnail
Definition: ezarticle/admin/imagelist.php:59
$sum
$sum
Definition: fileinfo.php:26
$product
$product
Definition: homepage.php:202
$statusType
if(count( $usedVouchers) > 0) $statusType
Definition: orderedit.php:620
$country
$country
Definition: paypal.php:46
$price
$price
Definition: pricegroupedit.php:39
$image
$image
Definition: user/articlelist.php:242
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.