Annotation of /com_supacart/trunk/admin_files/classes/ps_order_change_html.php
Parent Directory
|
Revision Log
Revision 4 - (view) (download)
| 1 : | andphe | 4 | <?php |
| 2 : | defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); | ||
| 3 : | /** | ||
| 4 : | * | ||
| 5 : | * @version $Id$ | ||
| 6 : | * @author nfischer & kaltokri | ||
| 7 : | * @copyright Copyright (C) 2006 Ingemar Fällman. All rights reserved. | ||
| 8 : | * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL | ||
| 9 : | * | ||
| 10 : | */ | ||
| 11 : | |||
| 12 : | /**************************************************************************** | ||
| 13 : | * ps_order_change_html | ||
| 14 : | * The class acts as a plugin for the order_print page. | ||
| 15 : | *************************************************************************/ | ||
| 16 : | class ps_order_change_html { | ||
| 17 : | var $classname = "ps_order_change_html"; | ||
| 18 : | var $order_id; | ||
| 19 : | var $reload_from_db; | ||
| 20 : | |||
| 21 : | /************************************************************************** | ||
| 22 : | * name: ps_order_change_html (constructor) | ||
| 23 : | * created by: kaltokri | ||
| 24 : | * description: constructor, setup initial variables | ||
| 25 : | * parameters: Order Id | ||
| 26 : | * returns: none | ||
| 27 : | **************************************************************************/ | ||
| 28 : | function ps_order_change_html($order_id) { | ||
| 29 : | $this->order_id = $order_id; | ||
| 30 : | } | ||
| 31 : | |||
| 32 : | /************************************************************************** | ||
| 33 : | * name: html_change_bill_to | ||
| 34 : | * created by: kaltokri | ||
| 35 : | * description: Prints formular to change bill to | ||
| 36 : | * parameters: none | ||
| 37 : | * returns: none | ||
| 38 : | **************************************************************************/ | ||
| 39 : | function html_change_bill_to($user_id) { | ||
| 40 : | global $VM_LANG; | ||
| 41 : | ?><tr> | ||
| 42 : | <td width="35%" align="right"><strong><?php echo $VM_LANG->_PHPSHOP_ORDER_CHANGE_UPD_BILL ?>:</strong></td> | ||
| 43 : | <td width="65%"> | ||
| 44 : | <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"> | ||
| 45 : | <select name="bill_to"> | ||
| 46 : | <?php | ||
| 47 : | $dbs = new ps_DB; | ||
| 48 : | $q = "SELECT user_id, last_name, first_name FROM #__{sc}_user_info WHERE address_type = 'BT' ORDER BY last_name ASC"; | ||
| 49 : | $dbs->query($q); | ||
| 50 : | while ($dbs->next_record()){ | ||
| 51 : | if (!is_null( $dbs->f('last_name') )) { | ||
| 52 : | print '<option value="'.$dbs->f('user_id').'"'; | ||
| 53 : | if($dbs->f('user_id') == $user_id) print " selected "; | ||
| 54 : | print '>'; | ||
| 55 : | print $dbs->f('last_name'); | ||
| 56 : | print ", ".$dbs->f('first_name'); | ||
| 57 : | print '</option>'; | ||
| 58 : | } | ||
| 59 : | } | ||
| 60 : | ?> | ||
| 61 : | </select> | ||
| 62 : | <input type="image" title="<?php echo $VM_LANG->_PHPSHOP_UPDATE ?>" | ||
| 63 : | src="<?php echo IMAGEURL ?>ps_image/edit.png" border="0" alt="<?php echo $VM_LANG->_PHPSHOP_UPDATE ?>" /> | ||
| 64 : | <input type="hidden" value="1" name="change_bill_to" /> | ||
| 65 : | <input type="hidden" name="page" value="order.order_print" /> | ||
| 66 : | <input type="hidden" name="option" value="com_supacart" /> | ||
| 67 : | <input type="hidden" name="func" value="" /> | ||
| 68 : | <input type="hidden" name="order_id" value="<?php echo $this->order_id ?>" /> | ||
| 69 : | </form> | ||
| 70 : | </td> | ||
| 71 : | </tr> <?php | ||
| 72 : | } | ||
| 73 : | |||
| 74 : | /************************************************************************** | ||
| 75 : | * name: html_change_ship_to | ||
| 76 : | * created by: kaltokri | ||
| 77 : | * description: Prints formular to change ship to | ||
| 78 : | * parameters: none | ||
| 79 : | * returns: none | ||
| 80 : | **************************************************************************/ | ||
| 81 : | function html_change_ship_to($user_id) { | ||
| 82 : | global $VM_LANG; | ||
| 83 : | ?> | ||
| 84 : | <tr> | ||
| 85 : | <td align="right"><strong><?php echo $VM_LANG->_PHPSHOP_ORDER_CHANGE_UPD_SHIP ?>:</strong></td> | ||
| 86 : | <td align="left"> | ||
| 87 : | <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"> | ||
| 88 : | <select name="ship_to"> | ||
| 89 : | <?php | ||
| 90 : | $dbs = new ps_DB; | ||
| 91 : | $q = "SELECT user_info_id, address_type_name FROM #__{sc}_user_info WHERE user_id = '" . $user_id . "' ORDER BY address_type_name ASC"; | ||
| 92 : | $dbs->query($q); | ||
| 93 : | while ($dbs->next_record()){ | ||
| 94 : | if (!is_null( $dbs->f('user_info_id') )) { | ||
| 95 : | print '<option value="'.$dbs->f('user_info_id').'">'; | ||
| 96 : | print $dbs->f('address_type_name'); | ||
| 97 : | print '</option>'; | ||
| 98 : | } | ||
| 99 : | } | ||
| 100 : | ?> | ||
| 101 : | </select> | ||
| 102 : | <input type="image" title="<?php echo $VM_LANG->_PHPSHOP_UPDATE ?>" | ||
| 103 : | src="<?php echo IMAGEURL ?>ps_image/edit.png" border="0" alt="<?php echo $VM_LANG->_PHPSHOP_UPDATE ?>" /> | ||
| 104 : | <input type="hidden" value="1" name="change_ship_to" /> | ||
| 105 : | <input type="hidden" name="page" value="order.order_print" /> | ||
| 106 : | <input type="hidden" name="option" value="com_supacart" /> | ||
| 107 : | <input type="hidden" name="func" value="" /> | ||
| 108 : | <input type="hidden" name="order_id" value="<?php echo $this->order_id ?>" /> | ||
| 109 : | </form> | ||
| 110 : | </td> | ||
| 111 : | </tr> <?php | ||
| 112 : | } | ||
| 113 : | |||
| 114 : | /************************************************************************** | ||
| 115 : | * name: html_change_customer_note | ||
| 116 : | * created by: kaltokri | ||
| 117 : | * description: Prints formular to change Customer Note | ||
| 118 : | * parameters: none | ||
| 119 : | * returns: none | ||
| 120 : | **************************************************************************/ | ||
| 121 : | function html_change_customer_note() { | ||
| 122 : | global $VM_LANG; | ||
| 123 : | |||
| 124 : | $db = new ps_DB; | ||
| 125 : | $q = "SELECT * FROM #__{sc}_orders WHERE order_id='".$this->order_id."'"; | ||
| 126 : | $db->query($q); | ||
| 127 : | $db->next_record(); | ||
| 128 : | ?> | ||
| 129 : | <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"> | ||
| 130 : | <textarea name="customer_note" cols="30" rows="5"><?php $db->p("customer_note") ?></textarea> | ||
| 131 : | <input type="image" title="<?php echo $VM_LANG->_PHPSHOP_UPDATE ?>" src="<?php echo IMAGEURL ?>ps_image/edit.png" border="0" alt="<?php echo $VM_LANG->_PHPSHOP_UPDATE ?>" /> | ||
| 132 : | <input type="hidden" value="1" name="change_customer_note" /> | ||
| 133 : | <input type="hidden" name="page" value="order.order_print" /> | ||
| 134 : | <input type="hidden" name="option" value="com_supacart" /> | ||
| 135 : | <input type="hidden" name="func" value="" /> | ||
| 136 : | <input type="hidden" name="order_id" value="<?php echo $this->order_id ?>" /> | ||
| 137 : | </form> <?php | ||
| 138 : | } | ||
| 139 : | |||
| 140 : | /************************************************************************** | ||
| 141 : | * name: html_change_shipping | ||
| 142 : | * created by: ?, modified by kaltokri | ||
| 143 : | * description: Prints formular to change standard shipping | ||
| 144 : | * parameters: none | ||
| 145 : | * returns: none | ||
| 146 : | **************************************************************************/ | ||
| 147 : | function html_change_shipping() { | ||
| 148 : | global $VM_LANG; | ||
| 149 : | |||
| 150 : | $db = new ps_DB; | ||
| 151 : | $q = "SELECT * FROM #__{sc}_orders WHERE order_id='".$this->order_id."'"; | ||
| 152 : | $db->query($q); | ||
| 153 : | $db->next_record(); | ||
| 154 : | |||
| 155 : | $rate_details = explode( "|", $db->f("ship_method_id") ); | ||
| 156 : | |||
| 157 : | ?> | ||
| 158 : | <?php | ||
| 159 : | if($db->f('ship_method_id') == "" OR preg_match('/^standard_shipping/', $db->f('ship_method_id'))) { | ||
| 160 : | ?> | ||
| 161 : | <tr> | ||
| 162 : | <td> | ||
| 163 : | <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"> | ||
| 164 : | <select name="shipping"> | ||
| 165 : | <?php | ||
| 166 : | $dbs = new ps_DB; | ||
| 167 : | $q = 'select shipping_rate_id, shipping_rate_name, shipping_rate_weight_start, shipping_rate_weight_end, shipping_rate_value, shipping_rate_package_fee, tax_rate, currency_name FROM #__{sc}_shipping_rate LEFT JOIN #__{sc}_tax_rate ON #__{sc}_shipping_rate.shipping_rate_vat_id = #__{sc}_tax_rate.tax_rate_id LEFT JOIN #__{sc}_currency ON #__{sc}_shipping_rate.shipping_rate_currency_id = #__{sc}_currency.currency_id order by shipping_rate_list_order'; | ||
| 168 : | $dbs->query($q); | ||
| 169 : | while ($dbs->next_record()){ | ||
| 170 : | if (is_null($dbs->f('tax_rate'))) { | ||
| 171 : | $tax_rate = 0; | ||
| 172 : | } | ||
| 173 : | else { | ||
| 174 : | $tax_rate = $dbs->f('tax_rate'); | ||
| 175 : | } | ||
| 176 : | print '<option value="'.$dbs->f('shipping_rate_id').'"'; | ||
| 177 : | if($dbs->f('shipping_rate_id') == $rate_details[4]) print " selected "; | ||
| 178 : | print '>'; | ||
| 179 : | print $dbs->f('shipping_rate_name'); | ||
| 180 : | print " ---> "; | ||
| 181 : | print " ".round((($dbs->f('shipping_rate_value') * (1+$tax_rate)) + $dbs->f('shipping_rate_package_fee')),2); | ||
| 182 : | print " ".$dbs->f('currency_name'); | ||
| 183 : | print '</option>'; | ||
| 184 : | } ?> | ||
| 185 : | </select> | ||
| 186 : | <input type="image" title="<?php echo $VM_LANG->_PHPSHOP_UPDATE ?>" | ||
| 187 : | src="<?php echo IMAGEURL ?>ps_image/edit.png" border="0" alt="<?php echo $VM_LANG->_PHPSHOP_UPDATE ?>" /> | ||
| 188 : | <input type="hidden" value="1" name="change_standard_shipping" /> | ||
| 189 : | <input type="hidden" name="page" value="order.order_print" /> | ||
| 190 : | <input type="hidden" name="option" value="com_supacart" /> | ||
| 191 : | <input type="hidden" name="func" value="" /> | ||
| 192 : | <input type="hidden" name="order_id" value="<?php echo $this->order_id ?>" /> | ||
| 193 : | </form> | ||
| 194 : | </td> | ||
| 195 : | </tr><?php | ||
| 196 : | } else { | ||
| 197 : | ?> | ||
| 198 : | <tr> | ||
| 199 : | <td align="right"><strong><?php echo $VM_LANG->_PHPSHOP_ORDER_PRINT_SHIPPING ?>: </strong></td> | ||
| 200 : | </tr> | ||
| 201 : | <tr> | ||
| 202 : | <td> | ||
| 203 : | <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"> | ||
| 204 : | <input type="text" value="<?php $db->p("order_shipping") ?>" size="5" name="order_shipping" /> | ||
| 205 : | <input type="image" title="<?php echo $VM_LANG->_PHPSHOP_UPDATE ?>" | ||
| 206 : | src="<?php echo IMAGEURL ?>ps_image/edit.png" border="0" alt="<?php echo $VM_LANG->_PHPSHOP_UPDATE ?>" /> | ||
| 207 : | <input type="hidden" value="1" name="change_shipping" /> | ||
| 208 : | <input type="hidden" name="order_edit_page" value="1" /> | ||
| 209 : | <input type="hidden" name="page" value="order.order_print" /> | ||
| 210 : | <input type="hidden" name="option" value="com_supacart" /> | ||
| 211 : | <input type="hidden" name="func" value="" /> | ||
| 212 : | <input type="hidden" name="order_id" value="<?php echo $this->order_id ?>" /> | ||
| 213 : | </form> | ||
| 214 : | </td> | ||
| 215 : | </tr> | ||
| 216 : | <tr> | ||
| 217 : | <td align="right"><strong><?php echo $VM_LANG->_PHPSHOP_ORDER_PRINT_SHIPPING_TAX ?>: </strong></td> | ||
| 218 : | </tr> | ||
| 219 : | <tr> | ||
| 220 : | <td> | ||
| 221 : | <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"> | ||
| 222 : | <input type="text" value="<?php $db->p("order_shipping_tax") ?>" name="order_shipping_tax" size="5" /> | ||
| 223 : | <input type="image" title="<?php echo $VM_LANG->_PHPSHOP_UPDATE ?>" | ||
| 224 : | src="<?php echo IMAGEURL ?>ps_image/edit.png" border="0" alt="<?php echo $VM_LANG->_PHPSHOP_UPDATE ?>" /> | ||
| 225 : | <input type="hidden" value="1" name="change_shipping_tax" /> | ||
| 226 : | <input type="hidden" name="page" value="order.order_print" /> | ||
| 227 : | <input type="hidden" name="option" value="com_supacart" /> | ||
| 228 : | <input type="hidden" name="func" value="" /> | ||
| 229 : | <input type="hidden" name="order_id" value="<?php echo $this->order_id ?>" /> | ||
| 230 : | </form> | ||
| 231 : | </td> | ||
| 232 : | </tr> | ||
| 233 : | <?php | ||
| 234 : | } | ||
| 235 : | } | ||
| 236 : | |||
| 237 : | /************************************************************************** | ||
| 238 : | * name: html_change_discount | ||
| 239 : | * created by: ?, modified by kaltokri | ||
| 240 : | * description: Prints formular to change discount | ||
| 241 : | * parameters: none | ||
| 242 : | * returns: none | ||
| 243 : | **************************************************************************/ | ||
| 244 : | function html_change_discount() { | ||
| 245 : | global $VM_LANG; | ||
| 246 : | |||
| 247 : | $db = new ps_DB; | ||
| 248 : | $q = "SELECT * FROM #__{sc}_orders WHERE order_id='".$this->order_id."'"; | ||
| 249 : | $db->query($q); | ||
| 250 : | $db->next_record(); | ||
| 251 : | |||
| 252 : | ?><tr> | ||
| 253 : | <td align="right"><strong><?php echo $VM_LANG->_PHPSHOP_PAYMENT_METHOD_LIST_DISCOUNT ?>: </strong></td> | ||
| 254 : | <td colspan="3"> | ||
| 255 : | <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"> | ||
| 256 : | <input type="text" value="<?php $db->p("order_discount") ?>" size="5" name="order_discount" /> | ||
| 257 : | <input type="image" title="<?php echo $VM_LANG->_PHPSHOP_UPDATE ?>" | ||
| 258 : | src="<?php echo IMAGEURL ?>ps_image/edit.png" border="0" alt="<?php echo $VM_LANG->_PHPSHOP_UPDATE ?>" /> | ||
| 259 : | <input type="hidden" value="1" name="change_discount" /> | ||
| 260 : | <input type="hidden" name="page" value="order.order_print" /> | ||
| 261 : | <input type="hidden" name="option" value="com_supacart" /> | ||
| 262 : | <input type="hidden" name="func" value="" /> | ||
| 263 : | <input type="hidden" name="order_id" value="<?php echo $this->order_id ?>" /> | ||
| 264 : | </form> | ||
| 265 : | </td> | ||
| 266 : | </tr> | ||
| 267 : | <?php | ||
| 268 : | } | ||
| 269 : | |||
| 270 : | /************************************************************************** | ||
| 271 : | * name: html_change_coupon_discount | ||
| 272 : | * created by: ?, modified by kaltokri | ||
| 273 : | * description: Prints formular to change coupon discount | ||
| 274 : | * parameters: none | ||
| 275 : | * returns: none | ||
| 276 : | **************************************************************************/ | ||
| 277 : | function html_change_coupon_discount() { | ||
| 278 : | global $VM_LANG; | ||
| 279 : | |||
| 280 : | $db = new ps_DB; | ||
| 281 : | $q = "SELECT * FROM #__{sc}_orders WHERE order_id='".$this->order_id."'"; | ||
| 282 : | $db->query($q); | ||
| 283 : | $db->next_record(); | ||
| 284 : | ?> | ||
| 285 : | <tr> | ||
| 286 : | <td align="right"><strong><?php echo $VM_LANG->_PHPSHOP_COUPON_DISCOUNT ?>: </strong></td> | ||
| 287 : | <td colspan="3"> | ||
| 288 : | <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"> | ||
| 289 : | <input type="text" value="<?php $db->p("coupon_discount") ?>" size="5" name="coupon_discount" /> | ||
| 290 : | <input type="image" title="<?php echo $VM_LANG->_PHPSHOP_UPDATE ?>" | ||
| 291 : | src="<?php echo IMAGEURL ?>ps_image/edit.png" border="0" alt="<?php echo $VM_LANG->_PHPSHOP_UPDATE ?>" /> | ||
| 292 : | <input type="hidden" value="1" name="change_coupon_discount" /> | ||
| 293 : | <input type="hidden" name="page" value="order.order_print" /> | ||
| 294 : | <input type="hidden" name="option" value="com_supacart" /> | ||
| 295 : | <input type="hidden" name="func" value="" /> | ||
| 296 : | <input type="hidden" name="order_id" value="<?php echo $this->order_id ?>" /> | ||
| 297 : | </form> | ||
| 298 : | </td> | ||
| 299 : | </tr> | ||
| 300 : | <?php | ||
| 301 : | } | ||
| 302 : | |||
| 303 : | /************************************************************************** | ||
| 304 : | * name: html_change_delete_item | ||
| 305 : | * created by: ?, modified by kaltokri | ||
| 306 : | * description: Prints formular to delete products | ||
| 307 : | * parameters: $order_item_id | ||
| 308 : | * returns: none | ||
| 309 : | **************************************************************************/ | ||
| 310 : | function html_change_delete_item($order_item_id) { | ||
| 311 : | global $VM_LANG; | ||
| 312 : | |||
| 313 : | $db = new ps_DB; | ||
| 314 : | $q = "SELECT * FROM #__{sc}_orders WHERE order_id='".$this->order_id."'"; | ||
| 315 : | $db->query($q); | ||
| 316 : | $db->next_record(); | ||
| 317 : | ?> | ||
| 318 : | <td width="5%"> | ||
| 319 : | <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" > | ||
| 320 : | <input type="image" title="<?php echo $VM_LANG->_PHPSHOP_DELETE ?>" | ||
| 321 : | src="<?php echo IMAGEURL ?>ps_image/delete.png" border="0" alt="<?php echo $VM_LANG->_PHPSHOP_DELETE ?>" /> | ||
| 322 : | <input type="hidden" value="1" name="change_delete_item" /> | ||
| 323 : | <input type="hidden" name="page" value="order.order_print" /> | ||
| 324 : | <input type="hidden" name="option" value="com_supacart" /> | ||
| 325 : | <input type="hidden" name="func" value="" /> | ||
| 326 : | <input type="hidden" name="order_item_id" value="<?php echo $order_item_id ?>" /> | ||
| 327 : | <input type="hidden" name="order_id" value="<?php echo $this->order_id ?>" /> | ||
| 328 : | </form> | ||
| 329 : | </td> | ||
| 330 : | <?php | ||
| 331 : | } | ||
| 332 : | |||
| 333 : | |||
| 334 : | /************************************************************************** | ||
| 335 : | * name: html_change_item_quantity | ||
| 336 : | * created by: ?, modified by kaltokri | ||
| 337 : | * description: Prints formular to change quantity of an item | ||
| 338 : | * parameters: $order_item_id, $product_quantity | ||
| 339 : | * returns: none | ||
| 340 : | **************************************************************************/ | ||
| 341 : | function html_change_item_quantity($order_item_id, $product_quantity) { | ||
| 342 : | global $VM_LANG; | ||
| 343 : | ?> | ||
| 344 : | <td width="10%"> | ||
| 345 : | <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"> | ||
| 346 : | <input type="text" value="<?php echo $product_quantity ?>" name="product_quantity" size="5" /> | ||
| 347 : | <input type="image" title="<?php echo $VM_LANG->_PHPSHOP_UPDATE ?>" | ||
| 348 : | src="<?php echo IMAGEURL ?>ps_image/edit.png" border="0" alt="<?php echo $VM_LANG->_PHPSHOP_UPDATE ?>" /> | ||
| 349 : | <input type="hidden" value="1" name="change_item_quantity" /> | ||
| 350 : | <input type="hidden" name="page" value="order.order_print" /> | ||
| 351 : | <input type="hidden" name="option" value="com_supacart" /> | ||
| 352 : | <input type="hidden" name="func" value="" /> | ||
| 353 : | <input type="hidden" name="order_item_id" value="<?php echo $order_item_id ?>" /> | ||
| 354 : | <input type="hidden" name="order_id" value="<?php echo $this->order_id ?>" /> | ||
| 355 : | </form> | ||
| 356 : | </td> | ||
| 357 : | <?php | ||
| 358 : | } | ||
| 359 : | |||
| 360 : | /************************************************************************** | ||
| 361 : | * name: html_change_add_item | ||
| 362 : | * created by: ?, modified by kaltokri | ||
| 363 : | * description: Prints formular to change quantity of an item | ||
| 364 : | * parameters: none | ||
| 365 : | * returns: none | ||
| 366 : | **************************************************************************/ | ||
| 367 : | function html_change_add_item() { | ||
| 368 : | global $VM_LANG, $vmLogger; | ||
| 369 : | |||
| 370 : | require_once(CLASSPATH . 'ps_product_attribute.php'); | ||
| 371 : | $ps_product_attribute = new ps_product_attribute; | ||
| 372 : | |||
| 373 : | // Get product_id | ||
| 374 : | $product_id = mosgetparam( $_REQUEST, 'product_id' ); | ||
| 375 : | $product_id_bysku = mosgetparam( $_REQUEST, 'product_id_bysku' ); | ||
| 376 : | |||
| 377 : | // If sku was selected it overwrites the product_id | ||
| 378 : | if ($product_id_bysku > 0) { | ||
| 379 : | $product_id = $product_id_bysku; | ||
| 380 : | } | ||
| 381 : | |||
| 382 : | // Output to generate a "return to parant"-button | ||
| 383 : | $html_return_parent = '<form method="post" action="' . $_SERVER['PHP_SELF'] . '"> | ||
| 384 : | <input type="submit" value="' . $VM_LANG->_PHPSHOP_ORDER_EDIT_RETURN_PARENTS . '" /> | ||
| 385 : | <input type="hidden" name="product_id" value="-1" /> | ||
| 386 : | <input type="hidden" name="add_product_validate" value="0" /> | ||
| 387 : | <input type="hidden" name="add_product_item" value="0" /> | ||
| 388 : | <input type="hidden" name="add_product" value="1" /> | ||
| 389 : | <input type="hidden" name="order_edit_page" value="1" /> | ||
| 390 : | <input type="hidden" name="page" value="order.order_print" /> | ||
| 391 : | <input type="hidden" name="option" value="com_supacart" /> | ||
| 392 : | <input type="hidden" name="func" value="" /> | ||
| 393 : | <input type="hidden" name="order_id" value="' . $this->order_id . '" /></form>'; | ||
| 394 : | |||
| 395 : | // Page reseted = -1 or called first time = "" | ||
| 396 : | if ($product_id < 0 || $product_id == "") { | ||
| 397 : | // Generate product list | ||
| 398 : | ?> | ||
| 399 : | <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"> | ||
| 400 : | <br /><br /> | ||
| 401 : | <table class="adminlist"> | ||
| 402 : | <tr> | ||
| 403 : | <th> <?php echo $VM_LANG->_PHPSHOP_ORDER_EDIT_ADD_PRODUCT ?></th> | ||
| 404 : | </tr> | ||
| 405 : | <tr> | ||
| 406 : | <td><?php echo $this->list_products($product_id, true) ?><?php echo $this->list_products($product_id) ?></td> | ||
| 407 : | </tr> | ||
| 408 : | </table> | ||
| 409 : | <input type="hidden" name="add_product_validate" value="0" /> | ||
| 410 : | <input type="hidden" name="add_product_item" value="0" /> | ||
| 411 : | <input type="hidden" name="add_product" value="1" /> | ||
| 412 : | |||
| 413 : | <input type="hidden" name="page" value="order.order_print" /> | ||
| 414 : | <input type="hidden" name="option" value="com_supacart" /> | ||
| 415 : | <input type="hidden" name="func" value="" /> | ||
| 416 : | <input type="hidden" name="order_id" value="<?php echo $this->order_id ?>" /> | ||
| 417 : | </form> | ||
| 418 : | <?php | ||
| 419 : | } | ||
| 420 : | else { | ||
| 421 : | // Query child products | ||
| 422 : | $db = new ps_DB; | ||
| 423 : | $q = "SELECT product_id FROM #__{sc}_product WHERE "; | ||
| 424 : | $q .= "product_parent_id = '".$product_id."'"; | ||
| 425 : | $db->query($q); | ||
| 426 : | |||
| 427 : | // Are there childs? | ||
| 428 : | if ( $db->num_rows()) { | ||
| 429 : | // Yes! Drop down list to select the child | ||
| 430 : | ?> | ||
| 431 : | <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"> | ||
| 432 : | <br /><br /> | ||
| 433 : | <table class="adminlist"> | ||
| 434 : | <tr> | ||
| 435 : | <th><?php echo $VM_LANG->_PHPSHOP_ORDER_EDIT_ADD_PRODUCT ?></th> | ||
| 436 : | </tr> | ||
| 437 : | </table> | ||
| 438 : | <table class="adminlist"> | ||
| 439 : | <tr> | ||
| 440 : | <th><?php echo $VM_LANG->_PHPSHOP_ORDER_PRINT_NAME ?></th> | ||
| 441 : | </tr> | ||
| 442 : | <tr> | ||
| 443 : | <td> | ||
| 444 : | <input type="hidden" name="add_product" value="1" /> | ||
| 445 : | <input type="hidden" name="add_product_validate" value="0" /> | ||
| 446 : | <input type="hidden" name="add_product_item" value="1" /> | ||
| 447 : | <?php echo $this->list_attribute($product_id) ?> | ||
| 448 : | </td> | ||
| 449 : | </tr> | ||
| 450 : | </table> | ||
| 451 : | <input type="hidden" name="page" value="order.order_print" /> | ||
| 452 : | <input type="hidden" name="option" value="com_supacart" /> | ||
| 453 : | <input type="hidden" name="func" value="" /> | ||
| 454 : | <input type="hidden" name="order_id" value="<?php echo $this->order_id ?>" /> | ||
| 455 : | </form> | ||
| 456 : | <?php echo $html_return_parent; | ||
| 457 : | } | ||
| 458 : | else { | ||
| 459 : | // No Childs or selected child product! Form to add a product that has no childs | ||
| 460 : | ?> | ||
| 461 : | <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"> | ||
| 462 : | <br /><br /> | ||
| 463 : | <table class="adminlist"> | ||
| 464 : | <tr> | ||
| 465 : | <th><?php echo $VM_LANG->_PHPSHOP_ORDER_EDIT_ADD_PRODUCT ?></th> | ||
| 466 : | </tr> | ||
| 467 : | </table> | ||
| 468 : | <table class="adminlist"> | ||
| 469 : | <tr> | ||
| 470 : | <th><?php echo $VM_LANG->_PHPSHOP_ORDER_PRINT_NAME ?></th> | ||
| 471 : | <th><?php echo $VM_LANG->_PHPSHOP_PRODUCT_FORM_CUSTOM_ATTRIBUTE_LIST ?></th> | ||
| 472 : | <th><?php echo $VM_LANG->_PHPSHOP_PRODUCT_FORM_ATTRIBUTE_LIST ?></th> | ||
| 473 : | <th align="left"><?php echo $VM_LANG->_PHPSHOP_ORDER_PRINT_QUANTITY ?></th> | ||
| 474 : | <th align="left"><?php echo $VM_LANG->_PHPSHOP_ORDER_EDIT_ACTIONS?></th> | ||
| 475 : | </tr> | ||
| 476 : | <tr> | ||
| 477 : | <?php | ||
| 478 : | if (mosgetparam( $_REQUEST, 'add_product_item' ) == 1) { | ||
| 479 : | echo '<td>' . $this->list_attribute($product_id,false) . '</td>'; | ||
| 480 : | echo '<input type="hidden" name="add_product_item" value="1" />'; | ||
| 481 : | } | ||
| 482 : | else { | ||
| 483 : | echo '<td>' . $this->list_products($product_id, true) . $this->list_products($product_id) . '</td>'; | ||
| 484 : | }?> | ||
| 485 : | <td><?php echo $ps_product_attribute->list_advanced_attribute($product_id) ?></td> | ||
| 486 : | <td><?php echo $ps_product_attribute->list_custom_attribute($product_id) ?></td> | ||
| 487 : | <td> | ||
| 488 : | <input type="text" value="1" name="product_quantity" size="5" /> | ||
| 489 : | <input type="hidden" name="add_product_validate" value="1" /> | ||
| 490 : | <input type="hidden" name="add_product" value="1" /> | ||
| 491 : | </td> | ||
| 492 : | <td><input type="submit" value="<?php echo $VM_LANG->_PHPSHOP_ORDER_EDIT_ADD ?>" /></td> | ||
| 493 : | </tr> | ||
| 494 : | </table> | ||
| 495 : | <input type="hidden" name="page" value="order.order_print" /> | ||
| 496 : | <input type="hidden" name="option" value="com_supacart" /> | ||
| 497 : | <input type="hidden" name="func" value="" /> | ||
| 498 : | <input type="hidden" name="order_id" value="<?php echo $this->order_id ?>" /> | ||
| 499 : | </form> | ||
| 500 : | <?php | ||
| 501 : | if (mosgetparam( $_REQUEST, 'add_product_item' ) == 1) { | ||
| 502 : | echo $html_return_parent; | ||
| 503 : | } | ||
| 504 : | } | ||
| 505 : | } | ||
| 506 : | return; | ||
| 507 : | } | ||
| 508 : | |||
| 509 : | |||
| 510 : | /************************************************************************** | ||
| 511 : | * name: list_products | ||
| 512 : | * created by: nfischer | ||
| 513 : | * description: Create a list of products | ||
| 514 : | * parameters: product_id | ||
| 515 : | * returns: html to display | ||
| 516 : | **************************************************************************/ | ||
| 517 : | function list_products($product_id, $skumode=false) { | ||
| 518 : | global $VM_LANG; | ||
| 519 : | $db = new ps_DB; | ||
| 520 : | |||
| 521 : | // List all products by sku | ||
| 522 : | if ($skumode) { | ||
| 523 : | $sortby = 'product_sku'; | ||
| 524 : | $select_name = 'product_id_bysku'; | ||
| 525 : | $reset_other_list = 'this.form.product_id.value=-1'; | ||
| 526 : | $first_item = $VM_LANG->_PHPSHOP_ORDER_EDIT_CHOOSE_PRODUCT_BY_SKU; | ||
| 527 : | } | ||
| 528 : | // List all products by name | ||
| 529 : | else { | ||
| 530 : | $sortby = 'product_name'; | ||
| 531 : | $select_name = 'product_id'; | ||
| 532 : | $reset_other_list = 'this.form.product_id_bysku.value=-1'; | ||
| 533 : | $first_item = $VM_LANG->_PHPSHOP_ORDER_EDIT_CHOOSE_PRODUCT; | ||
| 534 : | } | ||
| 535 : | |||
| 536 : | $query_list_products = "SELECT DISTINCT `product_name`,`products_per_row`,`category_browsepage`,`category_flypage`"; | ||
| 537 : | $query_list_products .= ",`#__{sc}_product`.`product_id`,`#__{sc}_category`.`category_id`,`product_full_image`,`product_thumb_image`"; | ||
| 538 : | $query_list_products .= ",`product_s_desc`,`product_parent_id`,`product_publish`,`product_in_stock`,`product_sku`"; | ||
| 539 : | $query_list_products .= " FROM (`#__{sc}_product`, `#__{sc}_category`, `#__{sc}_product_category_xref`"; | ||
| 540 : | $query_list_products .= ",`#__{sc}_shopper_group`) LEFT JOIN `#__{sc}_product_price` ON"; | ||
| 541 : | $query_list_products .= " `#__{sc}_product`.`product_id` = `#__{sc}_product_price`.`product_id`"; | ||
| 542 : | $query_list_products .= " WHERE `#__{sc}_product_category_xref`.`category_id`=`#__{sc}_category`.`category_id`"; | ||
| 543 : | $query_list_products .= " AND `#__{sc}_product`.`product_id`=`#__{sc}_product_category_xref`.`product_id`"; | ||
| 544 : | $query_list_products .= " AND `#__{sc}_product`.`product_parent_id`='0'"; | ||
| 545 : | $query_list_products .= " AND (( `#__{sc}_shopper_group`.`shopper_group_id`=`#__{sc}_product_price`.`shopper_group_id` )"; | ||
| 546 : | $query_list_products .= " OR (`#__{sc}_product_price`.`product_id` IS NULL))"; | ||
| 547 : | $query_list_products .= " GROUP BY `#__{sc}_product`.`product_sku` ORDER BY `#__{sc}_product`.`" . $sortby . "`"; | ||
| 548 : | $db->query($query_list_products); | ||
| 549 : | |||
| 550 : | $display = '<select name="' . $select_name . '" onChange="this.form.add_product_validate.value=0;' . $reset_other_list . ';this.form.submit();">'; | ||
| 551 : | $display .= '<option value="-1">' . $first_item . '</option>'; | ||
| 552 : | while ($db->next_record()) { | ||
| 553 : | $display .= '<option value="' . $db->f("product_id") . '"'; | ||
| 554 : | if ($product_id == $db->f("product_id")) { | ||
| 555 : | $display .= ' selected="yes"'; | ||
| 556 : | } | ||
| 557 : | if ($skumode) { | ||
| 558 : | $display .= '>' . $db->f("product_sku") . '</option>'; | ||
| 559 : | } | ||
| 560 : | else { | ||
| 561 : | $display .= '>' . $db->f("product_name") . '</option>'; | ||
| 562 : | } | ||
| 563 : | } | ||
| 564 : | $display .= '</select>'; | ||
| 565 : | |||
| 566 : | return $display; | ||
| 567 : | } | ||
| 568 : | |||
| 569 : | |||
| 570 : | /************************************************************************** | ||
| 571 : | * name: list_attribute | ||
| 572 : | * created by: nfischer | ||
| 573 : | * description: Lists all child/sister products of the given product | ||
| 574 : | * parameters: $product_id, $fils | ||
| 575 : | * returns: string HTML code with Items, attributes & price | ||
| 576 : | **************************************************************************/ | ||
| 577 : | function list_attribute($product_id, $fils=true) { | ||
| 578 : | global $VM_LANG, $CURRENCY_DISPLAY; | ||
| 579 : | |||
| 580 : | $ps_product = new ps_product; | ||
| 581 : | $db = new ps_DB; | ||
| 582 : | $db_sku = new ps_DB; | ||
| 583 : | $db_item = new ps_DB; | ||
| 584 : | |||
| 585 : | if ($fils) { | ||
| 586 : | // Generate childlist | ||
| 587 : | $q = "SELECT product_id,product_name FROM #__{sc}_product WHERE product_parent_id='$product_id'"; | ||
| 588 : | } | ||
| 589 : | else { | ||
| 590 : | // Child is selected, list siblings | ||
| 591 : | $q = "SELECT product_parent_id FROM #__{sc}_product WHERE product_id='$product_id'"; | ||
| 592 : | $db->setQuery($q); | ||
| 593 : | $db->query(); | ||
| 594 : | $db->next_record(); | ||
| 595 : | $product_parent_id = $db->f("product_parent_id"); | ||
| 596 : | $q = "SELECT product_id,product_name FROM #__{sc}_product WHERE product_parent_id='$product_parent_id'"; | ||
| 597 : | } | ||
| 598 : | |||
| 599 : | $db->setQuery($q); | ||
| 600 : | $db->query(); | ||
| 601 : | if( $db->num_rows() > 0 ) { | ||
| 602 : | $display = '<select name="product_id" onChange="this.form.add_product_validate.value=0;this.form.submit();">'; | ||
| 603 : | $display .= '<option value="-1">' . $VM_LANG->_PHPSHOP_SELECT . '</option>'; | ||
| 604 : | while ($db->next_record()) { | ||
| 605 : | $display .= '<option value="' . $db->f("product_id") . '"'; | ||
| 606 : | if ($product_id == $db->f("product_id")) { | ||
| 607 : | $display .= ' selected="yes"'; | ||
| 608 : | } | ||
| 609 : | $display .= '>' . $db->f("product_name"); | ||
| 610 : | |||
| 611 : | if ($fils) { | ||
| 612 : | $searched_id = $product_id; | ||
| 613 : | } | ||
| 614 : | else { | ||
| 615 : | $searched_id = $product_parent_id; | ||
| 616 : | } | ||
| 617 : | |||
| 618 : | // For each child get attribute values by looping through attribute list | ||
| 619 : | $q = "SELECT product_id, attribute_name FROM #__{sc}_product_attribute_sku "; | ||
| 620 : | $q .= "WHERE product_id='$searched_id' ORDER BY attribute_list ASC"; | ||
| 621 : | $db_sku->setQuery($q); $db_sku->query(); | ||
| 622 : | |||
| 623 : | while ($db_sku->next_record()) { | ||
| 624 : | $q = "SELECT attribute_name, attribute_value, product_id "; | ||
| 625 : | $q .= "FROM #__{sc}_product_attribute WHERE "; | ||
| 626 : | $q .= "product_id='" . $db->f("product_id") . "' AND "; | ||
| 627 : | $q .= "attribute_name='" . $db_sku->f("attribute_name") . "'"; | ||
| 628 : | $db_item->setQuery($q); $db_item->query(); | ||
| 629 : | while ($db_item->next_record()) { | ||
| 630 : | $display .= ' - ' . $db_item->f("attribute_name") . " "; | ||
| 631 : | $display .= "(" . $db_item->f("attribute_value") . ")"; | ||
| 632 : | if( !$db_sku->is_last_record() ) | ||
| 633 : | $display .= '; '; | ||
| 634 : | } | ||
| 635 : | } | ||
| 636 : | // Attributes for this item are done. | ||
| 637 : | // Now get item price | ||
| 638 : | $price = $ps_product->get_price($db->f("product_id")); | ||
| 639 : | if( $_SESSION["auth"]["show_price_including_tax"] == 1 ) { | ||
| 640 : | $tax_rate = 1 + $ps_product->get_product_taxrate($db->f("product_id")); | ||
| 641 : | $price['product_price'] *= $tax_rate; | ||
| 642 : | } | ||
| 643 : | $display .= ' - '.$CURRENCY_DISPLAY->getFullValue($price["product_price"]); | ||
| 644 : | $display .= '</option>'; | ||
| 645 : | } | ||
| 646 : | |||
| 647 : | $display .= '</select>'; | ||
| 648 : | } | ||
| 649 : | else { | ||
| 650 : | $display= "<input type=\"hidden\" name=\"product_id\" value=\"$product_id\" />\n"; | ||
| 651 : | } | ||
| 652 : | |||
| 653 : | return $display; | ||
| 654 : | } | ||
| 655 : | |||
| 656 : | /************************************************************************** | ||
| 657 : | * name: html_change_product_item_price | ||
| 658 : | * created by: kaltokri | ||
| 659 : | * description: change product item price | ||
| 660 : | * parameters: $order_item_id, $product_item_price | ||
| 661 : | * returns: none | ||
| 662 : | **************************************************************************/ | ||
| 663 : | function html_change_product_item_price($order_item_id, $product_item_price) { | ||
| 664 : | global $VM_LANG; | ||
| 665 : | ?> | ||
| 666 : | <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"> | ||
| 667 : | <input type="text" value="<?php echo $product_item_price ?>" name="product_item_price" size="5" /> | ||
| 668 : | <input type="image" title="<?php echo $VM_LANG->_PHPSHOP_UPDATE ?>" | ||
| 669 : | src="<?php echo IMAGEURL ?>ps_image/edit.png" border="0" alt="<?php echo $VM_LANG->_PHPSHOP_UPDATE ?>" /> | ||
| 670 : | <input type="hidden" value="1" name="change_product_item_price" /> | ||
| 671 : | <input type="hidden" name="page" value="order.order_print" /> | ||
| 672 : | <input type="hidden" name="option" value="com_supacart" /> | ||
| 673 : | <input type="hidden" name="func" value="" /> | ||
| 674 : | <input type="hidden" name="order_item_id" value="<?php echo $order_item_id ?>" /> | ||
| 675 : | <input type="hidden" name="order_id" value="<?php echo $this->order_id ?>" /> | ||
| 676 : | </form> | ||
| 677 : | <?php | ||
| 678 : | } | ||
| 679 : | |||
| 680 : | /************************************************************************** | ||
| 681 : | * name: html_change_product_final_price | ||
| 682 : | * created by: kaltokri | ||
| 683 : | * description: change product item price | ||
| 684 : | * parameters: $order_item_id, $product_final_price | ||
| 685 : | * returns: none | ||
| 686 : | **************************************************************************/ | ||
| 687 : | function html_change_product_final_price($order_item_id, $product_final_price) { | ||
| 688 : | global $VM_LANG; | ||
| 689 : | ?> | ||
| 690 : | <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"> | ||
| 691 : | <input type="text" value="<?php echo $product_final_price ?>" name="product_final_price" size="5" /> | ||
| 692 : | <input type="image" title="<?php echo $VM_LANG->_PHPSHOP_UPDATE ?>" | ||
| 693 : | src="<?php echo IMAGEURL ?>ps_image/edit.png" border="0" alt="<?php echo $VM_LANG->_PHPSHOP_UPDATE ?>" /> | ||
| 694 : | <input type="hidden" value="1" name="change_product_final_price" /> | ||
| 695 : | <input type="hidden" name="page" value="order.order_print" /> | ||
| 696 : | <input type="hidden" name="option" value="com_supacart" /> | ||
| 697 : | <input type="hidden" name="func" value="" /> | ||
| 698 : | <input type="hidden" name="order_item_id" value="<?php echo $order_item_id ?>" /> | ||
| 699 : | <input type="hidden" name="order_id" value="<?php echo $this->order_id ?>" /> | ||
| 700 : | </form> | ||
| 701 : | <?php | ||
| 702 : | } | ||
| 703 : | |||
| 704 : | /************************************************************************** | ||
| 705 : | * name: html_change_payment | ||
| 706 : | * created by: kaltokri | ||
| 707 : | * description: Prints formular to change bill to | ||
| 708 : | * parameters: none | ||
| 709 : | * returns: none | ||
| 710 : | **************************************************************************/ | ||
| 711 : | function html_change_payment($payment_id) { | ||
| 712 : | global $VM_LANG, $CURRENCY_DISPLAY; | ||
| 713 : | ?> | ||
| 714 : | <table><tr><td> | ||
| 715 : | <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>"> | ||
| 716 : | <select name="new_payment_id"> | ||
| 717 : | <?php | ||
| 718 : | $dbs = new ps_DB; | ||
| 719 : | $q = "SELECT payment_method_id, payment_method_name, payment_method_discount FROM #__{sc}_payment_method WHERE payment_enabled = 'Y' ORDER BY payment_method_name ASC"; | ||
| 720 : | $dbs->query($q); | ||
| 721 : | while ($dbs->next_record()){ | ||
| 722 : | if (!is_null( $dbs->f('payment_method_id') )) { | ||
| 723 : | print '<option value="'.$dbs->f('payment_method_id').'"'; | ||
| 724 : | if($dbs->f('payment_method_id') == $payment_id) print " selected "; | ||
| 725 : | print '>'; | ||
| 726 : | print $dbs->f('payment_method_name'); | ||
| 727 : | print "-> ". $CURRENCY_DISPLAY->getFullValue(($dbs->f('payment_method_discount') * -1)); | ||
| 728 : | print '</option>'; | ||
| 729 : | } | ||
| 730 : | } | ||
| 731 : | ?> | ||
| 732 : | </select> | ||
| 733 : | </td><td> | ||
| 734 : | <input type="image" title="<?php echo $VM_LANG->_PHPSHOP_UPDATE ?>" | ||
| 735 : | src="<?php echo IMAGEURL ?>ps_image/edit.png" border="0" alt="<?php echo $VM_LANG->_PHPSHOP_UPDATE ?>" /> | ||
| 736 : | <input type="hidden" value="1" name="change_payment" /> | ||
| 737 : | <input type="hidden" name="page" value="order.order_print" /> | ||
| 738 : | <input type="hidden" name="option" value="com_supacart" /> | ||
| 739 : | <input type="hidden" name="func" value="" /> | ||
| 740 : | <input type="hidden" name="order_id" value="<?php echo $this->order_id ?>" /> | ||
| 741 : | </form> | ||
| 742 : | </td></tr></table> | ||
| 743 : | <?php | ||
| 744 : | } | ||
| 745 : | |||
| 746 : | } | ||
| 747 : | ?> |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |
Web Hosting provided by Network Redux.

