8 |
8 |
[http://www.gnu.org/licenses/gpl-2.0.html]
|
9 |
9 |
--------------------------------------------------------------
|
10 |
10 |
|
11 |
|
based on:
|
|
11 |
based on:
|
12 |
12 |
(c) 2000-2001 The Exchange Project (earlier name of osCommerce)
|
13 |
|
(c) 2002-2003 osCommerce(new_attributes_functions); www.oscommerce.com
|
|
13 |
(c) 2002-2003 osCommerce(new_attributes_functions); www.oscommerce.com
|
14 |
14 |
(c) 2003 nextcommerce (new_attributes_include.php,v 1.11 2003/08/21); www.nextcommerce.org
|
15 |
15 |
(c) 2003 XT-Commerce - community made shopping http://www.xt-commerce.com ($Id: new_attributes_include.php 901 2005-04-29 10:32:14Z novalis $)
|
16 |
16 |
|
17 |
|
Released under the GNU General Public License
|
|
17 |
Released under the GNU General Public License
|
18 |
18 |
--------------------------------------------------------------
|
19 |
19 |
Third Party contributions:
|
20 |
20 |
New Attribute Manager v4b Autor: Mike G | mp3man@internetwork.net | http://downloads.ephing.com
|
21 |
21 |
|
22 |
|
Released under the GNU General Public License
|
|
22 |
Released under the GNU General Public License
|
23 |
23 |
--------------------------------------------------------------*/
|
24 |
24 |
defined('_VALID_XTC') or die('Direct Access to this location is not allowed.');
|
25 |
25 |
// include needed functions
|
... | ... | |
73 |
73 |
<?php } ?>
|
74 |
74 |
<tr>
|
75 |
75 |
<td class="attributes-edit-wrapper multi-table-wrapper">
|
76 |
|
|
|
76 |
|
77 |
77 |
<?php
|
78 |
|
|
|
78 |
|
79 |
79 |
require(DIR_WS_MODULES . 'new_attributes_functions.php');
|
80 |
|
|
|
80 |
|
81 |
81 |
// Temp id for text input contribution.. I'll put them in a seperate array.
|
82 |
82 |
$tempTextID = '1999043';
|
83 |
|
|
|
83 |
|
84 |
84 |
// Lets get all of the possible options
|
85 |
85 |
$query = "SELECT * FROM ".TABLE_PRODUCTS_OPTIONS." where products_options_id LIKE '%' AND language_id = '" . $_SESSION['languages_id'] . "'";
|
86 |
86 |
$result = xtc_db_query($query);
|
87 |
87 |
$matches = xtc_db_num_rows($result);
|
88 |
|
|
|
88 |
|
89 |
89 |
$totalOptionCountQuery = 'SELECT * FROM ' . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS;
|
90 |
90 |
$totalOptionCountQueryResult = xtc_db_query($totalOptionCountQuery);
|
91 |
91 |
$totalOptionCount = xtc_db_num_rows($totalOptionCountQueryResult);
|
92 |
|
|
|
92 |
|
93 |
93 |
if ($matches) {
|
94 |
94 |
while ($line = xtc_db_fetch_array($result)) {
|
95 |
95 |
$current_product_option_name = $line['products_options_name'];
|
... | ... | |
112 |
112 |
$query2 = "SELECT * FROM ".TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS." WHERE products_options_id = '" . $current_product_option_id . "' ORDER BY products_options_values_id DESC";
|
113 |
113 |
$result2 = xtc_db_query($query2);
|
114 |
114 |
$matches2 = xtc_db_num_rows($result2);
|
115 |
|
|
|
115 |
|
116 |
116 |
if ($matches2) {
|
117 |
117 |
$i = 0;
|
118 |
118 |
while ($line = xtc_db_fetch_array($result2)) {
|
... | ... | |
120 |
120 |
$rowClass = rowClass($i);
|
121 |
121 |
$current_value_id = $line['products_options_values_id'];
|
122 |
122 |
$isSelected = checkAttribute($current_value_id, $_POST['current_product_id'], $current_product_option_id);
|
123 |
|
|
|
123 |
|
124 |
124 |
$CHECKED = '';
|
125 |
|
if ($isSelected) {
|
|
125 |
if ($isSelected)
|
|
126 |
{
|
126 |
127 |
$CHECKED = ' checked="checked"';
|
127 |
|
}
|
128 |
|
|
|
128 |
|
129 |
|
$gm_get_vpe = xtc_db_query("SELECT products_vpe_id, products_vpe_name FROM products_vpe WHERE language_id = '" . $_SESSION['languages_id'] . "'");
|
|
129 |
$gm_get_vpe = xtc_db_query("SELECT products_vpe_id, products_vpe_name FROM products_vpe WHERE language_id = '"
|
|
130 |
. $_SESSION['languages_id'] . "'");
|
130 |
|
$gm_vpe_data = array();
|
|
131 |
$gm_vpe_data = array();
|
131 |
|
while($gm_vpe = xtc_db_fetch_array($gm_get_vpe)) {
|
132 |
|
$gm_vpe_data[] = array('ID' => $gm_vpe['products_vpe_id'], 'NAME' => $gm_vpe['products_vpe_name']);
|
|
132 |
while($gm_vpe = xtc_db_fetch_array($gm_get_vpe))
|
|
133 |
{
|
|
134 |
$gm_vpe_data[] = array('ID' => $gm_vpe['products_vpe_id'],
|
|
135 |
'NAME' => $gm_vpe['products_vpe_name']
|
|
136 |
);
|
133 |
|
}
|
134 |
|
|
|
137 |
}
|
|
138 |
|
135 |
|
$query3 = "SELECT * FROM ".TABLE_PRODUCTS_OPTIONS_VALUES." WHERE products_options_values_id = '" . $current_value_id . "' AND language_id = '" . $_SESSION['languages_id'] . "'";
|
|
139 |
$query3 = "SELECT * FROM " . TABLE_PRODUCTS_OPTIONS_VALUES
|
|
140 |
. " WHERE products_options_values_id = '" . $current_value_id
|
|
141 |
. "' AND language_id = '" . $_SESSION['languages_id'] . "'";
|
136 |
|
$result3 = xtc_db_query($query3);
|
|
142 |
$result3 = xtc_db_query($query3);
|
137 |
|
while($line = xtc_db_fetch_array($result3)) {
|
|
143 |
while($line = xtc_db_fetch_array($result3))
|
|
144 |
{
|
138 |
|
$current_value_name = $line['products_options_values_name'];
|
139 |
|
// Print the Current Value Name
|
140 |
|
|
141 |
|
$disable = '';
|
|
145 |
$current_value_name = $line['products_options_values_name'];
|
|
146 |
// Print the Current Value Name
|
|
147 |
|
|
148 |
$disable = '';
|
142 |
|
if(empty($CHECKED)){
|
|
149 |
if(empty($CHECKED))
|
|
150 |
{
|
143 |
|
$disable = "disabled='true'";
|
144 |
|
}
|
145 |
|
|
|
151 |
$disable = "disabled='true'";
|
|
152 |
}
|
|
153 |
|
146 |
|
echo '<tr class="' . $rowClass . '">' .
|
147 |
|
'<td class="main">' .
|
148 |
|
'<input type="checkbox" name="optionValues[]" value="' . $current_value_id . '"' . $CHECKED . ' data-single_checkbox />' .
|
149 |
|
' ' . $current_value_name . ' ' .
|
150 |
|
'</td>' .
|
151 |
|
'<td class="main" align="left">' .
|
152 |
|
'<input ' . $disable . ' type="text" name="' . $current_value_id . '_sortorder" value="' . $sortorder . '" size="4" />' .
|
153 |
|
'</td>' .
|
154 |
|
'<td class="main" align="left">' .
|
155 |
|
'<input ' . $disable . ' type="text" name="' . $current_value_id . '_model" value="' . $attribute_value_model . '" size="10" />' .
|
156 |
|
'</td>' .
|
157 |
|
'<td class="main" align="left">' .
|
158 |
|
'<input ' . $disable . ' type="text" name="' . $current_value_id . '_gm_ean" value="' . $gm_attribute_ean . '" size="10" />' .
|
159 |
|
'</td>' .
|
160 |
|
'<td class="main" align="left">' .
|
161 |
|
'<input ' . $disable . ' type="text" name="' . $current_value_id . '_stock" value="' . (double)$attribute_value_stock . '" size="4" />' .
|
162 |
|
'</td>' .
|
163 |
|
'<td class="main" align="left">' .
|
164 |
|
'<input ' . $disable . ' type="text" name="' . $current_value_id . '_vpe_value" value="' . (double)$gm_attribute_vpe_value . '" size="4" /> ' .
|
165 |
|
'<select ' . $disable . ' name="' . $current_value_id . '_vpe_id">';
|
166 |
|
if(empty($gm_attribute_vpe_id)){
|
|
154 |
echo '<tr class="' . $rowClass . '">' . '<td class="main">'
|
|
155 |
. '<input type="checkbox" name="optionValues[]" value="' . $current_value_id . '"'
|
|
156 |
. $CHECKED . ' data-single_checkbox />' . ' ' . $current_value_name
|
|
157 |
. ' ' . '</td>' . '<td class="main" align="left">' . '<input ' . $disable
|
|
158 |
. ' type="text" name="' . $current_value_id . '_sortorder" value="' . $sortorder
|
|
159 |
. '" size="4" />' . '</td>' . '<td class="main" align="left">' . '<input ' . $disable
|
|
160 |
. ' type="text" name="' . $current_value_id . '_model" value="'
|
|
161 |
. $attribute_value_model . '" size="10" />' . '</td>'
|
|
162 |
. '<td class="main" align="left">' . '<input ' . $disable . ' type="text" name="'
|
|
163 |
. $current_value_id . '_gm_ean" value="' . $gm_attribute_ean . '" size="10" />'
|
|
164 |
. '</td>' . '<td class="main" align="left">' . '<input ' . $disable
|
|
165 |
. ' type="text" name="' . $current_value_id . '_stock" value="'
|
|
166 |
. (double)$attribute_value_stock . '" size="4" />' . '</td>'
|
|
167 |
. '<td class="main" align="left">' . '<input ' . $disable . ' type="text" name="'
|
|
168 |
. $current_value_id . '_vpe_value" value="' . (double)$gm_attribute_vpe_value
|
|
169 |
. '" size="4" /> ' . '<select ' . $disable . ' name="' . $current_value_id
|
|
170 |
. '_vpe_id">';
|
|
171 |
if(empty($gm_attribute_vpe_id))
|
|
172 |
{
|
167 |
|
$gm_selected = ' selected="selected"';
|
|
173 |
$gm_selected = ' selected="selected"';
|
168 |
|
}else{
|
|
174 |
}
|
|
175 |
else
|
|
176 |
{
|
169 |
|
$gm_selected = '';
|
170 |
|
}
|
171 |
|
echo '<option value="0"' . $gm_selected . '></option>';
|
|
177 |
$gm_selected = '';
|
|
178 |
}
|
|
179 |
echo '<option value="0"' . $gm_selected . '></option>';
|
172 |
|
for($j = 0; $j < count($gm_vpe_data); $j++){
|
173 |
|
if($gm_vpe_data[$j]['ID'] == $gm_attribute_vpe_id){
|
|
180 |
for($j = 0; $j < count($gm_vpe_data); $j++)
|
|
181 |
{
|
|
182 |
if($gm_vpe_data[$j]['ID'] == $gm_attribute_vpe_id)
|
|
183 |
{
|
174 |
|
$gm_selected = ' selected="selected"';
|
|
184 |
$gm_selected = ' selected="selected"';
|
175 |
|
}else{
|
|
185 |
}
|
|
186 |
else
|
|
187 |
{
|
176 |
|
$gm_selected = '';
|
177 |
|
}
|
|
188 |
$gm_selected = '';
|
|
189 |
}
|
178 |
|
echo '<option value="' . $gm_vpe_data[$j]['ID'] . '"' . $gm_selected . '>' . $gm_vpe_data[$j]['NAME'] . '</option>';
|
|
190 |
echo '<option value="' . $gm_vpe_data[$j]['ID'] . '"' . $gm_selected . '>'
|
|
191 |
. $gm_vpe_data[$j]['NAME'] . '</option>';
|
179 |
|
}
|
|
192 |
}
|
180 |
|
echo '</select>' .
|
181 |
|
'</td>' .
|
182 |
|
'<td class="main" align="left">' .
|
183 |
|
'<input ' . $disable . ' type="text" name="' . $current_value_id . '_weight" value="' . $attribute_value_weight . '" size="10" /> ' .
|
184 |
|
'<select ' . $disable . ' name="' . $current_value_id . '_weight_prefix">' .
|
185 |
|
'<option value="+"' . $posCheck_weight . '>+</option>' .
|
186 |
|
'<option value="-"' . $negCheck_weight . '>-</option>' .
|
187 |
|
'</select>' .
|
188 |
|
'</td>';
|
|
193 |
echo '</select>' . '</td>' . '<td class="main" align="left">' . '<input ' . $disable
|
|
194 |
. ' type="text" name="' . $current_value_id . '_weight" value="'
|
|
195 |
. $attribute_value_weight . '" size="10" /> ' . '<select ' . $disable . ' name="'
|
|
196 |
. $current_value_id . '_weight_prefix">' . '<option value="+"' . $posCheck_weight
|
|
197 |
. '>+</option>' . '<option value="-"' . $negCheck_weight . '>-</option>' . '</select>'
|
|
198 |
. '</td>';
|
189 |
|
|
190 |
|
// brutto Admin
|
|
199 |
|
|
200 |
// brutto Admin
|
191 |
|
if (PRICE_IS_BRUTTO=='true'){
|
192 |
|
$attribute_value_price_calculate = $xtPrice->xtcFormat(xtc_round($attribute_value_price*((100+(xtc_get_tax_rate(xtc_get_tax_class_id($_POST['current_product_id']))))/100),PRICE_PRECISION), false);
|
193 |
|
} else {
|
|
201 |
if(PRICE_IS_BRUTTO == 'true')
|
|
202 |
{
|
|
203 |
$attribute_value_price_calculate = $xtPrice->xtcFormat(xtc_round($attribute_value_price
|
|
204 |
* ((100
|
|
205 |
+ (xtc_get_tax_rate(xtc_get_tax_class_id($_POST['current_product_id']))))
|
|
206 |
/ 100),
|
|
207 |
PRICE_PRECISION),
|
|
208 |
false);
|
|
209 |
}
|
|
210 |
else
|
|
211 |
{
|
194 |
|
$attribute_value_price_calculate = xtc_round($attribute_value_price, PRICE_PRECISION);
|
195 |
|
}
|
|
212 |
$attribute_value_price_calculate = xtc_round($attribute_value_price, PRICE_PRECISION);
|
|
213 |
}
|
196 |
|
echo '<td class="main" align="left">' .
|
197 |
|
'<input ' . $disable . ' type="text" name="' . $current_value_id . '_price" value="' . $attribute_value_price_calculate . '" size="10" />';
|
|
214 |
echo '<td class="main" align="left">' . '<input ' . $disable . ' type="text" name="'
|
|
215 |
. $current_value_id . '_price" value="' . $attribute_value_price_calculate
|
|
216 |
. '" size="10" />';
|
198 |
|
// brutto Admin
|
|
217 |
// brutto Admin
|
199 |
|
if (PRICE_IS_BRUTTO=='true'){
|
200 |
|
echo TEXT_NETTO . '<strong>' . $xtPrice->xtcFormat(xtc_round($attribute_value_price,PRICE_PRECISION),true) . '</strong>';
|
|
218 |
if(PRICE_IS_BRUTTO == 'true')
|
|
219 |
{
|
|
220 |
echo TEXT_NETTO . '<strong>' . $xtPrice->xtcFormat(xtc_round($attribute_value_price,
|
|
221 |
PRICE_PRECISION), true)
|
|
222 |
. '</strong>';
|
201 |
|
}
|
202 |
|
|
|
223 |
}
|
|
224 |
|
203 |
|
echo ' <select ' . $disable . ' name="' . $current_value_id . '_prefix">' .
|
204 |
|
'<option value="+"' . $posCheck . '>+</option>' .
|
205 |
|
'<option value="-"' . $negCheck . '>-</option>' .
|
206 |
|
'</select>' .
|
207 |
|
'</td>' .
|
208 |
|
'</tr>';
|
|
225 |
echo ' <select ' . $disable . ' name="' . $current_value_id . '_prefix">'
|
|
226 |
. '<option value="+"' . $posCheck . '>+</option>' . '<option value="-"' . $negCheck
|
|
227 |
. '>-</option>' . '</select>' . '</td>' . '</tr>';
|
209 |
|
|
|
228 |
|
210 |
|
|
211 |
|
|
212 |
|
// Download function start
|
|
229 |
// Download function start
|
213 |
|
if(strtoupper($current_product_option_name) == 'DOWNLOADS') {
|
214 |
|
echo '<tr>' .
|
215 |
|
'<td colspan="2">' . xtc_draw_pull_down_menu($current_value_id . '_download_file', xtc_getDownloads(), $attribute_value_download_filename, $disable) . '</td>' .
|
216 |
|
'<td class="main" colspan="3">' .
|
217 |
|
' ' . DL_COUNT .
|
218 |
|
' <input ' . $disable . ' type="text" name="' . $current_value_id . '_download_count" value="' . $attribute_value_download_count . '">' .
|
219 |
|
'</td>' .
|
220 |
|
'<td class="main" colspan="3">' .
|
221 |
|
' ' . DL_EXPIRE .
|
222 |
|
'<input ' . $disable . ' type="text" name="' . $current_value_id . '_download_expire" value="' . $attribute_value_download_expire . '">' .
|
223 |
|
'</td>' .
|
224 |
|
'</tr>';
|
|
230 |
if(strtoupper($current_product_option_name) == 'DOWNLOADS')
|
|
231 |
{
|
|
232 |
echo '<tr>' . '<td colspan="2">' . xtc_draw_pull_down_menu($current_value_id
|
|
233 |
. '_download_file',
|
|
234 |
xtc_getDownloads(),
|
|
235 |
$attribute_value_download_filename,
|
|
236 |
$disable) . '</td>'
|
|
237 |
. '<td class="main" colspan="3">' . ' ' . DL_COUNT . ' <input ' . $disable
|
|
238 |
. ' type="text" name="' . $current_value_id . '_download_count" value="'
|
|
239 |
. $attribute_value_download_count . '">' . '</td>'
|
|
240 |
. '<td class="main" colspan="3">' . ' ' . DL_EXPIRE . '<input ' . $disable
|
|
241 |
. ' type="text" name="' . $current_value_id . '_download_expire" value="'
|
|
242 |
. $attribute_value_download_expire . '">' . '</td>' . '</tr>';
|
225 |
|
}
|
226 |
|
}
|
227 |
|
|
228 |
|
// Download function end
|
|
243 |
}
|
|
244 |
}
|
|
245 |
|
|
246 |
// Download function end
|
229 |
|
if ($i == $matches2 ) {
|
|
247 |
if($i == $matches2)
|
|
248 |
{
|
230 |
|
$i = 0;
|
|
249 |
$i = 0;
|
|
250 |
}
|
231 |
251 |
}
|
232 |
252 |
}
|
233 |
253 |
} else {
|
... | ... | |
262 |
282 |
//?>
|
263 |
283 |
</td>
|
264 |
284 |
</tr>
|
265 |
|
|
|
285 |
|
266 |
286 |
|
267 |
287 |
|
268 |
288 |
<script type="text/javascript">
|