Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

eztrade/admin/attributeedit.php
Go to the documentation of this file.
1 <?php
3 //
4 // $Id: attributeedit.php 6233 2001-07-20 11:42:02Z jakobn $
5 //
6 // Created on: <20-Dec-2000 18:45:08 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/ezhttptool.php" );
28
29 if ( isset( $Cancel ) )
30 {
31 eZHTTPTool::header( "Location: /trade/productedit/edit/$ProductID/" );
32 exit();
33 }
34
35 // include_once( "classes/INIFile.php" );
36 // include_once( "classes/eztemplate.php" );
37 // include_once( "classes/ezlocale.php" );
38 // include_once( "classes/ezcurrency.php" );
39
40 $ini =& eZINI::instance( 'site.ini' );
41 $Language = $ini->variable( "eZTradeMain", "Language" );
42
43 // include_once( "eztrade/classes/ezproductcategory.php" );
44 // include_once( "eztrade/classes/ezproduct.php" );
45
46 // include_once( "eztrade/classes/ezproducttype.php" );
47 // include_once( "eztrade/classes/ezproductattribute.php" );
48
49
50 if ( $Action == "Update" )
51 {
52 $product = new eZProduct( $ProductID );
53
54 // print( "update<br>" );
55
56 // print( $TypeID );
57
58 if ( $TypeID == -1 )
59 {
60 $product->removeType();
61 }
62 else
63 {
64 $product->setType( new eZProductType( $TypeID ) );
65
66 $i =0;
67 if ( count( $AttributeValue ) > 0 )
68 {
69 foreach ( $AttributeValue as $attribute )
70 {
71 $att = new eZProductAttribute( $AttributeID[$i] );
72
73 $att->setValue( $product, $attribute );
74
75 $i++;
76 }
77 }
78 }
79
80 if ( isset( $OK ) )
81 {
82 eZHTTPTool::header( "Location: /trade/productedit/edit/$ProductID/" );
83 exit();
84 }
85 }
86
87 $product = new eZProduct( $ProductID );
88
89 $t = new eZTemplate( "kernel/eztrade/admin/" . $ini->variable( "eZTradeMain", "AdminTemplateDir" ),
90 "kernel/eztrade/admin/intl/", $Language, "attributeedit.php" );
91
92 $t->setAllStrings();
93
94 $t->set_file( array(
95 "attribute_edit_page" => "attributeedit.tpl"
96 ) );
97
98 $t->set_block( "attribute_edit_page", "attribute_list_tpl", "attribute_list" );
99 $t->set_block( "attribute_list_tpl", "attribute_tpl", "attribute" );
100
101 $t->set_block( "attribute_edit_page", "type_tpl", "type" );
102
103
104 //default values
105
106 if ( $Action == "Edit" )
107 {
108
109 }
110
111 $type = new eZProductType( );
112 $types = $type->getAll();
113
114 $type = $product->type();
115
116
117 foreach ( $types as $typeItem )
118 {
119 if ( $type )
120 {
121 if ( $type->id() == $typeItem->id() )
122 {
123 $t->set_var( "selected", "selected" );
124 }
125 else
126 {
127 $t->set_var( "selected", "" );
128 }
129 }
130 else
131 {
132 $t->set_var( "selected", "" );
133 }
134
135 $t->set_var( "type_id", $typeItem->id( ) );
136 $t->set_var( "type_name", $typeItem->name( ) );
137
138 $t->parse( "type", "type_tpl", true );
139 }
140
141
142 if ( $type )
143 {
144 $attributes = $type->attributes();
145
146 foreach ( $attributes as $attribute )
147 {
148 $t->set_var( "attribute_id", $attribute->id( ) );
149 $t->set_var( "attribute_name", $attribute->name( ) );
150 $t->set_var( "attribute_value", $attribute->value( $product ) );
151
152 $t->parse( "attribute", "attribute_tpl", true );
153 }
154 }
155
156 if ( count ( $attributes ) > 0 )
157 {
158 $t->parse( "attribute_list", "attribute_list_tpl" );
159 }
160 else
161 {
162 $t->set_var( "attribute_list", "" );
163 }
164
165 $t->set_var( "product_name", $product->name( ) );
166 $t->set_var( "product_id", $ProductID );
167
168 $t->pparse( "output", "attribute_edit_page" );
169
170 ?>
$i
$i
Definition: admin/adlist.php:91
eZHTTPTool\header
static header( $string)
Definition: ezhttptool.php:96
eZProductAttribute
Definition: ezproductattribute.php:49
eZProductType
Definition: ezproducttype.php:46
eZProduct
Definition: ezproduct.php:71
eZTemplate
Definition: eztemplate.php:107
$Action
$Action
Definition: companysearch.php:80
$t
$t
Definition: eztrade/admin/attributeedit.php:89
$ini
if(isset( $Cancel)) $ini
Definition: eztrade/admin/attributeedit.php:40
$Language
$Language
Definition: eztrade/admin/attributeedit.php:41
$types
$types
Definition: eztrade/admin/attributeedit.php:112
$type
if( $Action=="Edit") $type
Definition: eztrade/admin/attributeedit.php:111
$product
if( $Action=="Update") $product
Definition: eztrade/admin/attributeedit.php:87
exit
exit
Definition: folder.php:81
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.