GX-Bug #45151 » GuestOrdersFix.patch
src/admin/orders.php (revision ) | ||
---|---|---|
208 | 208 |
require (DIR_WS_CLASSES.'order.php'); |
209 | 209 |
if ((($_GET['action'] == 'edit') || ($_GET['action'] == 'update_order')) && ($order_exists)) { |
210 | 210 |
$order = new order($oID); |
211 |
if(empty($order->customer['ID'])) |
|
212 |
{ |
|
213 |
$customerId = $order->customer['csID']; |
|
214 |
} |
|
215 |
else |
|
216 |
{ |
|
211 |
$customerId = $order->customer['ID']; |
|
217 |
$customerId = $order->customer['ID']; |
|
218 |
} |
|
212 | 219 |
|
213 | 220 |
/** |
214 | 221 |
* Fetch data of first order |
215 | 222 |
*/ |
216 | 223 |
$query = xtc_db_query('SELECT `date_purchased` FROM `orders` WHERE `customers_id` = ' . $customerId |
217 |
. ' ORDER BY `date_purchased` ASC LIMIT 1'); |
|
224 |
. ' OR `customers_cid` = ' . $customerId . ' ORDER BY `date_purchased` ASC LIMIT 1');
|
|
218 | 225 |
$result = xtc_db_fetch_array($query); |
219 | 226 |
$firstOrderDate = '-'; |
220 | 227 |
if(count($result) > 0) |
... | ... | |
226 | 233 |
* Fetch data of last order |
227 | 234 |
*/ |
228 | 235 |
$query = xtc_db_query('SELECT `date_purchased` FROM `orders` WHERE `customers_id` = ' . $customerId |
229 |
. ' ORDER BY `date_purchased` DESC LIMIT 1'); |
|
236 |
. ' OR `customers_cid` = ' . $customerId . ' ORDER BY `date_purchased` DESC LIMIT 1');
|
|
230 | 237 |
$result = xtc_db_fetch_array($query); |
231 | 238 |
$lastOrderDate = '-'; |
232 | 239 |
if(count($result) > 0) |
... | ... | |
237 | 244 |
/** |
238 | 245 |
* Fetch amount of orders |
239 | 246 |
*/ |
240 |
$query = xtc_db_query('SELECT COUNT(*) as `count` FROM `orders` WHERE `customers_id` = ' . $customerId); |
|
247 |
$query = xtc_db_query('SELECT COUNT(*) as `count` FROM `orders` WHERE `customers_id` = ' . $customerId . ' OR `customers_cid` = ' . $customerId);
|
|
241 | 248 |
$result = xtc_db_fetch_array($query); |
242 | 249 |
$amountOfOrders = '0'; |
243 | 250 |
if(count($result) > 0) |
... | ... | |
248 | 255 |
/** |
249 | 256 |
* Fetch total sum of customer orders |
250 | 257 |
*/ |
251 |
$query = xtc_db_query('SELECT `value` FROM `orders_total` LEFT JOIN `orders` USING (`orders_id`) WHERE `sort_order` = "99" AND customers_id = "' |
|
252 |
. $customerId . '"'); |
|
258 |
$query = xtc_db_query('SELECT `value` FROM `orders_total` LEFT JOIN `orders` USING (`orders_id`) WHERE `sort_order` = "99" AND (customers_id = "'
|
|
259 |
. $customerId . '" OR `customers_cid` = ' . $customerId.')');
|
|
253 | 260 |
$sumOrderTotal = 0; |
254 | 261 |
while($result = xtc_db_fetch_array($query)) |
255 | 262 |
{ |
src/admin/html/compatibility/order_details.php (revision ) | ||
---|---|---|
549 | 549 |
</div> |
550 | 550 |
</div> |
551 | 551 |
</div> |
552 |
|
|
552 |
|
|
553 | 553 |
<?php |
554 | 554 |
$belowOrderInfo = $orderExtender->get_output('below_order_info'); |
555 |
|
|
555 |
|
|
556 | 556 |
foreach($belowOrderInfo as $moduleContent) |
557 | 557 |
{ |
558 | 558 |
?> |
... | ... | |
697 | 697 |
</div> |
698 | 698 |
<?php endif; ?> |
699 | 699 |
</div> |
700 |
|
|
700 |
|
|
701 | 701 |
<?php |
702 | 702 |
$belowWithdrawal = $orderExtender->get_output('below_history'); |
703 |
|
|
703 |
|
|
704 | 704 |
foreach($belowWithdrawal as $moduleContent) |
705 | 705 |
{ |
706 | 706 |
?> |
... | ... | |
788 | 788 |
<!-- |
789 | 789 |
CUSTOMER INFO BOX |
790 | 790 |
--> |
791 |
|
|
792 |
<?php |
|
793 |
|
|
794 |
$mainCustomerIdEmpty = false; |
|
795 |
|
|
796 |
if(empty($GLOBALS['order']->customer['ID'])) |
|
797 |
{ |
|
798 |
$customerId = $GLOBALS['order']->customer['csID']; |
|
799 |
$mainCustomerIdEmpty = true; |
|
800 |
} |
|
801 |
else if(!empty($GLOBALS['order']->customer['csID']) && $GLOBALS['order']->customer['ID'] != $GLOBALS['order']->customer['csID']) |
|
802 |
{ |
|
803 |
$customerId = $GLOBALS['order']->customer['csID']; |
|
804 |
} |
|
805 |
else |
|
806 |
{ |
|
807 |
$customerId = $GLOBALS['order']->customer['ID']; |
|
808 |
} |
|
809 |
|
|
810 |
?> |
|
791 | 811 |
<div class="frame-wrapper info customers"> |
792 | 812 |
<div class="frame-head info"> |
793 | 813 |
<label class="title"><?php echo str_replace(':', '', ENTRY_CUSTOMER); ?></label> |
794 |
<label class="pull-right head-link"> <a href="<?php echo xtc_href_link('customers.php', 'cID=' |
|
795 |
. $GLOBALS['order']->customer['ID'] |
|
796 |
. '&action=edit'); ?>"> |
|
797 |
<?php echo ENTRY_OPEN_CUSTOMER ?> |
|
814 |
<?php |
|
815 |
if($mainCustomerIdEmpty==false) |
|
816 |
{ |
|
817 |
echo '<label class="pull-right head-link"> |
|
818 |
<a href="'.xtc_href_link('customers.php', 'cID=' . $customerId . '&action=edit').'">'; |
|
819 |
echo ENTRY_OPEN_CUSTOMER; |
|
820 |
} |
|
821 |
?> |
|
822 |
|
|
823 |
|
|
798 | 824 |
</a> </label> |
799 | 825 |
</div> |
800 | 826 |
<div class="frame-content simple-container"> |
... | ... | |
835 | 861 |
<?php endif; ?> |
836 | 862 |
<span><?php echo $GLOBALS['order']->customer['telephone']; ?></span><br /> |
837 | 863 |
<span><?php echo $GLOBALS['order']->info['status_name']; ?></span><br /> |
838 |
<span> |
|
839 |
<?php |
|
840 |
if(empty($GLOBALS['order']->customer['csID'])) |
|
841 |
{ |
|
842 |
echo $GLOBALS['order']->customer['ID']; |
|
843 |
} |
|
844 |
else |
|
845 |
{ |
|
846 |
echo $GLOBALS['order']->customer['csID']; |
|
847 |
} |
|
848 |
|
|
849 |
?></span><br /> |
|
864 |
<span><?php echo $customerId; ?></span><br /> |
|
850 | 865 |
<span><?php echo $GLOBALS['order']->info['language']; ?></span> |
851 | 866 |
</div> |
852 | 867 |
</div> |
... | ... | |
861 | 876 |
<div class="span6"> |
862 | 877 |
<span><?php echo $firstOrderDate; ?></span><br /> <span><?php echo $lastOrderDate; ?></span><br /> |
863 | 878 |
<span class="amount"> |
864 |
<a href="orders.php?cID=<?php echo $GLOBALS['order']->customer['ID']; ?>"> |
|
865 |
<?php echo $amountOfOrders; ?> |
|
866 |
</a> |
|
879 |
<?php |
|
880 |
if($mainCustomerIdEmpty==false) |
|
881 |
{ |
|
882 |
echo '<a href="orders.php?cID=' . $customerId . '">' . $amountOfOrders . '</a>'; |
|
883 |
} |
|
884 |
else |
|
885 |
{ |
|
886 |
echo $amountOfOrders; |
|
887 |
} |
|
888 |
?> |
|
867 | 889 |
</span><br /> |
868 | 890 |
<span><?php echo $sumOrderTotal . ' ' . $GLOBALS['order']->info['currency']; ?></span> |
869 | 891 |
</div> |
... | ... | |
979 | 1001 |
</div> |
980 | 1002 |
<?php endif; ?> |
981 | 1003 |
</div> |
982 |
|
|
1004 |
|
|
983 | 1005 |
<?php |
984 | 1006 |
$belowWithdrawal = $orderExtender->get_output('below_withdrawal'); |
985 |
|
|
1007 |
|
|
986 | 1008 |
foreach($belowWithdrawal as $moduleContent) |
987 | 1009 |
{ |
988 | 1010 |
?> |