X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Show Order Details For (4.4.4) / Detail order management (https://forum.x-cart.com/showthread.php?t=61676)

chiactivate 11-17-2011 03:36 PM

Show Order Details For (4.4.4) / Detail order management
 
I love this this mod. Save time for fulfillment staff searching orders.

Detailed Order Management Mod

It used to work at 4.1x, 4.2x, 4.3x, but you need to make changes for 4.4.4.


chiactivate 11-17-2011 05:10 PM

Re: Show Order Details For (4.4.4) / Detail order management
 
It Works in 4.4.4 as Well!! Files are located in different directories, so I had to make some changes.

Here is the complete code for the first part:

your_xcart_dir/skin/common_files/main/order_info.tpl

After:

Quote:

{include file="main/subheader.tpl" title=$lng.lbl_products_info}

Add:
Quote:


{* genbilim *}
<script language=javascript src="../skin/common_files/js/copy_addr.js"></script>
{* genbilim-end *}


../skin/common_files/main/order_info.tpl

After:

Quote:

<td colspan="2"> <br /><i>{$lng.lbl_shipping_address}:</i></td>


Add:

Quote:

{* genbilim *}
{if $usertype eq "A"}

<a href="javascript :void(0)"
ship_to="{$order.s_title}{$order.s_firstname} {$order.s_lastname}"
ship_address="{$order.s_address}"
ship_city="{$order.s_city}"
ship_state="{$order.s_state}"
ship_country="{$order.s_country}"
ship_zipcode="{$order.s_zipcode}"
onclick="copyShipAddr(this, true);return false;">
<img src="{$ImagesDir}/copy.gif" border=0 align=absmiddle>Copy To Clipboard</a>
{/if}
</td>
</tr>

<tr valign="top">
<td width="31%">{if $customer.default_fields.s_firstname}&nbsp;&nbsp;{ $lng.lbl_first_name}{/if}</td>
<td width="13%">{if $customer.default_fields.s_firstname}{$customer.s_ firstname}{/if}</td>
<td width="55%" rowspan="10" align="center">
{* genbilim *}
{if $usertype eq "A"}

<a href="javascript:void(0)"
ship_to="{$order.s_title}{$order.s_firstname} {$order.s_lastname}"
ship_address="{$order.s_address}"
ship_city="{$order.s_city}"
ship_state="{$order.s_state}"
ship_country="{$order.s_country}"
ship_zipcode="{$order.s_zipcode}"
onclick="copyAddrToField(this);return false;">
<img src="{$ImagesDir}/copy.gif" border=0 align=absmiddle>Copy To Field</a>

<br>
<textarea cols=40 rows=6 id=ship_addr>
</textarea>
{/if}
{* genbilim-end *}

../skin/common_files/main/orders_list.tpl

After:

Quote:

{assign var="total_paid" value=0.00}


Add:
Quote:

{*
genbilim :
Javascript functions to copy the address to the clipboard
*}

<script language=javascript src="../skin/common_files/js/copy_addr.js"></script>
<div id="DIV_CopyInform" style="display:none;"></div>
{* genbilim-end *}


../skin/common_files/main/orders_list.tpl

Before:

Quote:

{section name=oid loop=$orders}

Add:
Quote:

{* genbilim
New column for admins to copy the address to the clipboard *}
{if $usertype eq 'A'}
<td align=center width=50>Copy&nbsp;Address</td>
{/if}
{* genbilim-end *}

../skin/common_files/main/orders_list.tpl

After:

Quote:

<a href="order.php?orderid={$orders[oid].orderid}">{currency value=$orders[oid].total}</a>
</td>
</tr>


Add:

Quote:

{* genbilim *}
{if $usertype eq 'A'}
<td align=center ><a href="javascript:void(0)"
ship_to="{$orders[oid].s_title}{$orders[oid].s_firstname} {$orders[oid].s_lastname}"
ship_address="{$orders[oid].s_address}"
ship_city="{$orders[oid].s_city}"
ship_state="{$orders[oid].s_state}"
ship_country="{$orders[oid].s_country}"
ship_zipcode="{$orders[oid].s_zipcode}"
onclick="copyShipAddr(this, false);return false;">
<img src="{$ImagesDir}/copy.gif" border=0 align=absmiddle></a></td>
{/if}
</TR>
<tr>
<td colspan=3></td>
<td colspan=4>
<table width=100% cellpadding=5 style="border-collapse:collapse" border=0>
<tr bgcolor=#DDDDCC>
<td>Ship To</td>
<td>Product</td>
<td>Code</td>
<td align=center>Amount</td>


{if $usertype eq 'A'}
<td align=center>Stock</td>
{/if}


</tr>
{foreach item=item from=$orders[oid].item_list}
<tr bgcolor=#CCCCDD>


<td width="30%" nowrap="nowrap">{$orders[oid].s_firstname} {$orders[oid].s_lastname}</td>
<td width="40%" nowrap="nowrap">{$item.product}</td>
<td width="10%" nowrap="nowrap">{$item.productcode}</td>
<td width="10%" nowrap="nowrap" align=center>{$item.amount}</td>
{if $usertype eq 'A'}
<td width="10%" nowrap="nowrap" align=center>{$item.avail}</td>
{/if}


</tr>
{/foreach}
</table>
</td>
</tr>
<TR>
<TD style="padding-top:3px;border-bottom:1px solid black" colspan=12>&nbsp;</TD>
</TR>
<TR>
<TD style="padding-top:3px;" colspan=12>&nbsp;</TD>
{* genbilim-end *}


in your xcart directory:
../skin/common_files/js

Create copy_addr.js file

Add:

Quote:

var attributes = ['to', 'address', 'city', 'state', 'country', 'zipcode'];
var addrFormat =
"{to}\r\n" +
"{address}\r\n" +
"{city} {state}, {zipcode}";
function findPos(obj)
{
var curleft = curtop = 0;
if (obj.offsetParent) {
curleft = obj.offsetLeft
curtop = obj.offsetTop
while (obj = obj.offsetParent) {
curleft += obj.offsetLeft
curtop += obj.offsetTop
}
}
return [curleft,curtop];
}
function removeInformation()
{
var div = document.getElementById('DIV_CopyInform');
if (! div)
return;
div.style.display = 'none';
div.innerHTML = '';
}

function getAddr(aObj)
{
var str = addrFormat;
for(var i=0; i<attributes.length; i++)
{
var na = 'ship_' + attributes[i];
var val= aObj.getAttribute(na);
if (typeof val != "undefined")
str = str.replace('{' + attributes[i] + '}', aObj.getAttribute(na));
}

return str;
}

function copyAddrToField(aObj)
{
document.getElementById('ship_addr').value = getAddr(aObj);
document.getElementById('ship_addr').focus();
document.getElementById('ship_addr').select();
}

function copyShipAddr(aObj, quickCopy)
{

var str = getAddr(aObj);

if (str.length > 0 )
{
if (! document.getElementById('DIV_CopyInform') )
document.getElementsByTagName('DIV')[0].innerHTML += '<div id="DIV_CopyInform" style="display:none;"></div>';
var div = document.getElementById('DIV_CopyInform');
div.style.position = 'absolute';
div.innerHTML = '';
div.style.left = (findPos(aObj)[0] + aObj.offsetWidth) + 'px';
div.style.top = findPos(aObj)[1] + 'px';
try
{
if (! quickCopy)
// make it throw an exception
genbilim.style = 'dummy';
window.clipboardData.setData("Text", str);

// Inform the user
div.style.width = '75px';

div.style.backgroundColor = 'pink';
div.style.padding = '3px';
div.style.color = 'black';
div.style.border= '1px solid black';
div.innerHTML = 'Copied';
div.style.display = 'inline';

setTimeout('removeInformation()', 1000);
}
catch(e)
{
div.style.left = (findPos(aObj)[0] + aObj.offsetWidth - 300 - 10 ) + 'px';
div.style.top = (findPos(aObj)[1] + aObj.offsetHeight) + 'px';
div.style.backgroundColor = '#DDDDCC';
div.style.padding = '5px';
div.style.color = 'black';
div.style.border= '1px solid black';
div.style.display = 'inline';
div.innerHTML =
'<table width=300 >' +
'<tr><td align=right><a href="javascript :void(0)" onclick="removeInformation()">Close</a></td></tr>' +
'<tr><td>You can copy (Ctrl+C) the adress manually</td></tr> '+
'<tr><td><textarea id=addr_ta rows=6 cols=50 >' + str + '</textarea></td></tr>';
document.getElementById('addr_ta').focus();
document.getElementById('addr_ta').select();
}
}
}
Open this file: …/include/orders.php

After:


Quote:

$orders = func_query("SELECT $sql_tbl[orders].* $search_condition ORDER BY $sort_string LIMIT $first_page, $objects_per_page");



Add:

Quote:

# genbilim
#
# Get the details of each order
#
require_once($xcart_dir . "/include/orders_genbilim.php");
#
# genbilim-end

In this directory: …/include/

create
orders_genbilim.php file

Add:

Quote:

<?php
for($i=0; $i<count($orders); $i++)
{
$items = func_query("SELECT od.productid, od.amount, od.productcode,p.product, p.avail
FROM xcart_order_details od
LEFT OUTER JOIN xcart_products p ON p.productid = od.productid
WHERE od.orderid = " . $orders[$i]['orderid']);
$orders[$i]['item_list'] = $items;
}
?>

That's All for part one. The color part to be continued....

JWait 11-27-2011 07:45 AM

Re: Show Order Details For (4.4.4) / Detail order management
 
Two problems...

1. ../skin/common_files/order_info.tpl doesn't exist. This is in the 2nd step of your guide, where you say to add the long Javascript code. Should it be skin/common_files/main/order_info.tpl instead?

2. The code
Code:

$orders = func_query("SELECT $sql_tbl[orders].* $search_condition ORDER BY $sort_string LIMIT $first_page, $objects_per_page");
doesn't exist in my includes/orders.php. The only thing similar is
Code:

$orders = func_query("SELECT $sql_tbl[orders].*, $sql_tbl[customers].id AS existing_userid, $sql_tbl[customers].login $search_condition ORDER BY $sort_string LIMIT $first_page, $objects_per_page");

The version I have for 4.4.4 is marked
$Id: orders.php,v 1.126.2.12 2011/09/19 05:46:13 aim Exp $

chiactivate 11-29-2011 04:57 PM

Re: Show Order Details For (4.4.4) / Detail order management
 
that's correct. Sorry for the mistakes. Just updated the post.

a1deano 12-31-2011 12:07 PM

Re: Show Order Details For (4.4.4) / Detail order management
 
Hi I see it says - That's All for part one. The color part to be continued....

Do I need the second part if so were can I get code from

Thanks

chiactivate 01-02-2012 12:36 AM

Re: Show Order Details For (4.4.4) / Detail order management
 
no, you don't need the second part. See link of the entire mod for older X-cart version: http://forum.x-cart.com/showthread.php?t=29680

a1deano 01-05-2012 07:05 AM

Re: Show Order Details For (4.4.4) / Detail order management
 
Many thanks managed to get it sorted :)

cedaly1968 01-12-2012 12:01 PM

Re: Show Order Details For (4.4.4) / Detail order management
 
This is a very cool mod, but I do get an error when I close the "Copy Address" window - throws me to a 404 error... thoughts?

https://www.brydenroad.com/admin/javascript%20:void(0)

chiactivate 01-23-2012 02:08 PM

Re: Show Order Details For (4.4.4) / Detail order management
 
hi cedaly,

did you fix the 404 error?

cedaly1968 01-23-2012 02:30 PM

Re: Show Order Details For (4.4.4) / Detail order management
 
No - have not had a chance to look at it to see what the cause is...


All times are GMT -8. The time now is 07:11 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.