Building the orders section.
git-svn-id: http://svn.cleancode.org/svn/pickles@117 4d10bc64-7434-11dc-a737-d2d0f8310089
This commit is contained in:
parent
b8b42b0cce
commit
56d4f60a6c
13 changed files with 856 additions and 3 deletions
|
@ -13,10 +13,10 @@ class store_admin extends Module {
|
|||
'customers',
|
||||
'products',
|
||||
'categories',
|
||||
'coupons',
|
||||
'discounts',
|
||||
'affiliates',
|
||||
'vendors',
|
||||
'gift certs',
|
||||
// 'vendors',
|
||||
'gift certificates',
|
||||
'reports',
|
||||
'settings'
|
||||
);
|
||||
|
|
34
common/modules/store/admin/categories.php
Normal file
34
common/modules/store/admin/categories.php
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
class store_admin_categories extends store_admin {
|
||||
|
||||
public function __default() {
|
||||
// Pulls all the categories and product counts in hierarchial and alphabetical order
|
||||
$all_categories = $this->db->getArray('
|
||||
SELECT c.*, COUNT(xref.category_id) AS product_count
|
||||
FROM categories AS c
|
||||
LEFT JOIN category_xref AS xref
|
||||
ON xref.category_id = c.id
|
||||
GROUP BY c.id
|
||||
ORDER BY c.parent_id, c.name;
|
||||
');
|
||||
|
||||
// Loops through the categories and builds an array of parents and children
|
||||
$categories = array();
|
||||
if (is_array($all_categories)) {
|
||||
foreach ($all_categories as $category) {
|
||||
if ($category['parent_id'] == null) {
|
||||
$categories[$category['id']] = $category;
|
||||
}
|
||||
else {
|
||||
$categories[$category['parent_id']]['children'][] = $category;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Passes the categories to the template
|
||||
$this->setPublic('categories', $categories);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
62
common/modules/store/admin/customers.php
Normal file
62
common/modules/store/admin/customers.php
Normal file
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
|
||||
class store_admin_customers extends store_admin {
|
||||
|
||||
public function __default() {
|
||||
$sql = '
|
||||
SELECT
|
||||
customers.*,
|
||||
|
||||
emails.email,
|
||||
|
||||
billing.company AS billing_company,
|
||||
billing.first_name AS billing_first_name,
|
||||
billing.last_name AS billing_last_name,
|
||||
billing.address1 AS billing_address1,
|
||||
billing.address2 AS billing_address2,
|
||||
billing.city AS billing_city,
|
||||
billing.state AS billing_state,
|
||||
billing.zip_code AS billing_zip_code,
|
||||
billing.country AS billing_country,
|
||||
billing.phone AS billing_phone,
|
||||
billing.fax AS billing_fax,
|
||||
|
||||
shipping.company AS shipping_company,
|
||||
shipping.first_name AS shipping_first_name,
|
||||
shipping.last_name AS shipping_last_name,
|
||||
shipping.address1 AS shipping_address1,
|
||||
shipping.address2 AS shipping_address2,
|
||||
shipping.city AS shipping_city,
|
||||
shipping.state AS shipping_state,
|
||||
shipping.zip_code AS shipping_zip_code,
|
||||
shipping.country AS shipping_country,
|
||||
shipping.phone AS shipping_phone,
|
||||
shipping.fax AS shipping_fax,
|
||||
|
||||
COUNT(orders.id) AS order_count
|
||||
|
||||
FROM customers
|
||||
|
||||
INNER JOIN emails
|
||||
ON emails.id = customers.email_id
|
||||
|
||||
INNER JOIN addresses AS billing
|
||||
ON billing.id = customers.billing_address_id
|
||||
|
||||
INNER JOIN addresses AS shipping
|
||||
ON shipping.id = customers.shipping_address_id
|
||||
|
||||
LEFT JOIN orders
|
||||
ON orders.xref_id = customers.id
|
||||
AND xref_type = "CUSTOMER"
|
||||
|
||||
GROUP BY customers.id
|
||||
|
||||
;
|
||||
';
|
||||
|
||||
$this->setPublic('customers', $this->db->getArray($sql));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
16
common/modules/store/admin/discounts.php
Normal file
16
common/modules/store/admin/discounts.php
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
class store_admin_discounts extends store_admin {
|
||||
|
||||
public function __default() {
|
||||
$sql = '
|
||||
SELECT *
|
||||
FROM discounts
|
||||
ORDER BY valid_through;
|
||||
';
|
||||
|
||||
$this->setPublic('discounts', $this->db->getArray($sql));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
50
common/modules/store/admin/orders.php
Normal file
50
common/modules/store/admin/orders.php
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
class store_admin_orders extends store_admin {
|
||||
|
||||
public function __default() {
|
||||
$sql = '
|
||||
SELECT
|
||||
o.id AS order_id,
|
||||
c.id AS customer_id,
|
||||
CONCAT(a.last_name, ", ", a.first_name) AS customer_name,
|
||||
DATE_FORMAT(o.time_placed, "%m/%d/%Y") AS order_time,
|
||||
o.total_amount,
|
||||
os.name AS status,
|
||||
osu.update_time AS last_update,
|
||||
o.transaction_id,
|
||||
s.name AS shipping_method,
|
||||
o.weight,
|
||||
"This would be the shipping notes" AS memo,
|
||||
os.name AS status
|
||||
|
||||
FROM orders AS o
|
||||
|
||||
LEFT JOIN customers AS c
|
||||
ON o.xref_type = "CUSTOMER" AND o.xref_id = c.id
|
||||
|
||||
INNER JOIN emails AS e
|
||||
ON o.xref_type = "EMAIL" AND e.id = o.xref_id
|
||||
OR o.xref_type = "CUSTOMER" AND e.id = c.email_id
|
||||
|
||||
INNER JOIN addresses AS a
|
||||
ON a.id = o.shipping_address_id
|
||||
|
||||
INNER JOIN shipping AS s
|
||||
ON s.id = o.shipping_id
|
||||
|
||||
LEFT JOIN order_status_updates AS osu
|
||||
ON osu.order_id = o.id
|
||||
AND osu.id = (SELECT MAX(id) FROM order_status_updates WHERE order_id = o.id)
|
||||
|
||||
LEFT JOIN order_statuses AS os
|
||||
ON os.id = osu.status_id
|
||||
|
||||
ORDER BY o.id DESC;
|
||||
';
|
||||
|
||||
$this->setPublic('orders', $this->db->getArray($sql));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
121
common/modules/store/admin/orders/edit.php
Normal file
121
common/modules/store/admin/orders/edit.php
Normal file
|
@ -0,0 +1,121 @@
|
|||
<?php
|
||||
|
||||
class store_admin_orders_edit extends store_admin {
|
||||
|
||||
protected $display = array(DISPLAY_SMARTY, DISPLAY_JSON);
|
||||
|
||||
public function __default() {
|
||||
|
||||
if (isset($_REQUEST['id'])) {
|
||||
$sql = '
|
||||
SELECT
|
||||
o.id AS order_id,
|
||||
c.id AS customer_id,
|
||||
DATE_FORMAT(o.time_placed, "%m/%d/%Y") AS order_time,
|
||||
o.total_amount,
|
||||
os.id AS status_id,
|
||||
osu.update_time AS last_update,
|
||||
o.transaction_id,
|
||||
s.name AS shipping_method,
|
||||
o.weight,
|
||||
"This would be the shipping notes" AS memo,
|
||||
os.name AS status,
|
||||
|
||||
o.cc_type,
|
||||
o.cc_last4,
|
||||
o.cc_expiration,
|
||||
o.shipping_amount,
|
||||
o.shipping_note,
|
||||
o.tracking_number,
|
||||
|
||||
e.email,
|
||||
|
||||
ba.company AS billing_company,
|
||||
ba.first_name AS billing_first_name,
|
||||
ba.last_name AS billing_last_name,
|
||||
ba.address1 AS billing_address1,
|
||||
ba.address2 AS billing_address2,
|
||||
ba.city AS billing_city,
|
||||
ba.state AS billing_state,
|
||||
ba.zip_code AS billing_zip_code,
|
||||
ba.phone AS billing_phone,
|
||||
ba.fax AS billing_fax,
|
||||
|
||||
sa.company AS shipping_company,
|
||||
sa.first_name AS shipping_first_name,
|
||||
sa.last_name AS shipping_last_name,
|
||||
sa.address1 AS shipping_address1,
|
||||
sa.address2 AS shipping_address2,
|
||||
sa.city AS shipping_city,
|
||||
sa.state AS shipping_state,
|
||||
sa.zip_code AS shipping_zip_code,
|
||||
sa.phone AS shipping_phone,
|
||||
sa.fax AS shipping_fax
|
||||
|
||||
FROM orders AS o
|
||||
|
||||
LEFT JOIN customers AS c
|
||||
ON o.xref_type = "CUSTOMER" AND o.xref_id = c.id
|
||||
|
||||
LEFT JOIN emails AS e
|
||||
ON o.xref_type = "EMAIL" AND e.id = o.xref_id
|
||||
OR o.xref_type = "CUSTOMER" AND e.id = c.email_id
|
||||
|
||||
LEFT JOIN addresses AS ba
|
||||
ON ba.id = o.billing_address_id
|
||||
|
||||
LEFT JOIN addresses AS sa
|
||||
ON sa.id = o.shipping_address_id
|
||||
|
||||
LEFT JOIN shipping AS s
|
||||
ON s.id = o.shipping_id
|
||||
|
||||
LEFT JOIN order_status_updates AS osu
|
||||
ON osu.order_id = o.id
|
||||
AND osu.id = (SELECT MAX(id) FROM order_status_updates WHERE order_id = o.id)
|
||||
|
||||
LEFT JOIN order_statuses AS os
|
||||
ON os.id = osu.status_id
|
||||
|
||||
WHERE o.id = "' . $_REQUEST['id'] . '"
|
||||
|
||||
ORDER BY o.id DESC
|
||||
|
||||
LIMIT 1;
|
||||
';
|
||||
|
||||
$order = $this->db->getRow($sql);
|
||||
|
||||
$sql = '
|
||||
SELECT
|
||||
op.quantity,
|
||||
p.*
|
||||
|
||||
FROM order_products AS op
|
||||
|
||||
INNER JOIN products AS p
|
||||
ON p.id = op.product_id
|
||||
|
||||
WHERE op.order_id = "' . $_REQUEST['id'] . '"
|
||||
';
|
||||
|
||||
$order['products'] = $this->db->getArray($sql);
|
||||
|
||||
$this->setPublic('order', $order);
|
||||
|
||||
foreach ($this->db->getArray('SELECT * FROM order_statuses;') as $status) {
|
||||
$statuses[$status['id']] = $status['name'];
|
||||
}
|
||||
|
||||
$this->setPublic('statuses', $statuses);
|
||||
|
||||
foreach ($this->db->getArray('SELECT * FROM shipping;') as $status) {
|
||||
$shipping_methods[$status['id']] = $status['name'];
|
||||
}
|
||||
|
||||
$this->setPublic('shipping_methods', $shipping_methods);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
66
common/modules/store/admin/orders/save.php
Normal file
66
common/modules/store/admin/orders/save.php
Normal file
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
class store_admin_orders_save extends store_admin {
|
||||
|
||||
protected $display = DISPLAY_JSON;
|
||||
|
||||
public function __default() {
|
||||
// Update orders.shipping_id, orders.shipping_note, orders.tracking_number
|
||||
$this->db->execute('
|
||||
UPDATE orders
|
||||
SET
|
||||
shipping_id = "' . $_REQUEST['shipping_method'] . '",
|
||||
shipping_note = "' . $_REQUEST['shipping_note'] . '",
|
||||
tracking_number = "' . $_REQUEST['tracking_number'] . '"
|
||||
WHERE id = "' . $_REQUEST['id'] . '";
|
||||
');
|
||||
|
||||
// Insert a record into the order status updates table
|
||||
$this->db->execute('
|
||||
INSERT INTO order_status_updates (
|
||||
order_id, user_id, status_id, update_time
|
||||
) VALUES (
|
||||
"' . $_REQUEST['id'] . '",
|
||||
"' . $_SESSION['user_id'] . '",
|
||||
"' . $_REQUEST['status'] . '",
|
||||
NOW()
|
||||
);
|
||||
');
|
||||
|
||||
|
||||
/*
|
||||
$affiliate_message = "
|
||||
{$this->config->store->title} Affiliate Program
|
||||
-------------------------------------------------------------------
|
||||
|
||||
Dear {$contact_address['first_name']} {$contact_address['last_name']},
|
||||
|
||||
You have been registered
|
||||
|
||||
Your custom URL:
|
||||
---------------------
|
||||
{$this->config->store->url}/referral/" . md5($affiliate_id) . "
|
||||
|
||||
Your commission rate:
|
||||
---------------------
|
||||
{$_REQUEST['commission_rate']}%
|
||||
|
||||
------------------
|
||||
|
||||
Thank you for your interest in the {$this->config->store->title} Affiliate Program.
|
||||
|
||||
{$this->config->store->title}
|
||||
Phone: {$this->config->store->phone}
|
||||
Fax: {$this->config->store->fax}
|
||||
URL: {$this->config->store->url}
|
||||
";
|
||||
|
||||
mail($_REQUEST['email'], 'Welcome to the ' . $this->config->store->title . ' Affiliate Program', $affiliate_message, 'From: ' . $this->config->store->return_email);
|
||||
*/
|
||||
|
||||
$this->setPublic('status', 'Success');
|
||||
$this->setPublic('message', 'The order has been updated successfully.');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
41
common/templates/store/admin/categories.tpl
Normal file
41
common/templates/store/admin/categories.tpl
Normal file
|
@ -0,0 +1,41 @@
|
|||
<h3>Categories</h3>
|
||||
<div class="float-right">
|
||||
<img src="/static/contrib/silk/icons/add.png" style="margin: 0 5px -4px 0;"/><a href="/store/admin/categories/edit">Add New Category</a>
|
||||
</div>
|
||||
{if is_array($module.categories)}
|
||||
<table style="width: 100%">
|
||||
<tr>
|
||||
<th class="left">Name</th>
|
||||
<th>Sort</th>
|
||||
<th>Products</th>
|
||||
<th>Hidden</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
{foreach from=$module.categories item=category}
|
||||
<tr class="center">
|
||||
<td class="left bold">{$category.name}</td>
|
||||
<td class="bold">{$category.weight}</td>
|
||||
<td>{$category.product_count}</td>
|
||||
<td>{if $category.visible == 'N'}Y{/if}</td>
|
||||
<td>
|
||||
<a href="/store/admin/categories/edit/{$category.id}"><img src="/static/contrib/silk/icons/pencil.png" alt="Edit Discount" title="Edit Discount" /></a>
|
||||
<a href="/store/admin/categories/delete/{$category.id}" onclick="return confirm('Are you sure you want to delete {$category.first_name} {$category.last_name}?')"><img src="/static/contrib/silk/icons/cross.png" alt="Delete Discount" title="Delete Discount" /></a>
|
||||
</td>
|
||||
</tr>
|
||||
{if isset($category.children)}
|
||||
{foreach from=$category.children item=child}
|
||||
<tr class="center">
|
||||
<td class="left"> {$child.name}</td>
|
||||
<td>{$child.weight}</td>
|
||||
<td>{$child.product_count}</td>
|
||||
<td>{if $child.visible == 'N'}Y{/if}</td>
|
||||
<td>
|
||||
<a href="/store/admin/categories/edit/{$child.id}"><img src="/static/contrib/silk/icons/pencil.png" alt="Edit Discount" title="Edit Discount" /></a>
|
||||
<a href="/store/admin/categories/delete/{$child.id}" onclick="return confirm('Are you sure you want to delete {$child.first_name} {$child.last_name}?')"><img src="/static/contrib/silk/icons/cross.png" alt="Delete Discount" title="Delete Discount" /></a>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{/if}
|
||||
{/foreach}
|
||||
</table>
|
||||
{/if}
|
30
common/templates/store/admin/customers.tpl
Normal file
30
common/templates/store/admin/customers.tpl
Normal file
|
@ -0,0 +1,30 @@
|
|||
<h3>Customers</h3>
|
||||
<div class="float-right">
|
||||
<img src="/static/contrib/silk/icons/add.png" style="margin: 0 5px -4px 0;"/><a href="/store/admin/customers/edit">Add New Customer</a>
|
||||
</div>
|
||||
{if is_array($module.customers)}
|
||||
<table style="width: 100%">
|
||||
<tr>
|
||||
<th class="left">Name</th>
|
||||
<th class="left">Company</th>
|
||||
<th class="left">Phone</th>
|
||||
<th class="left">Email</th>
|
||||
<th>Orders</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
{foreach from=$module.customers item=customer}
|
||||
<tr class="center">
|
||||
<td class="left">{$customer.billing_last_name}, {$customer.billing_first_name}</td>
|
||||
<td class="left">{$customer.billing_company}</td>
|
||||
<td class="left">{$customer.billing_phone}</td>
|
||||
<td class="left">{$customer.email}</td>
|
||||
<td>{$customer.order_count}</td>
|
||||
<td>
|
||||
<a href="/store/admin/customers/view/{$customer.id}"><img src="/static/contrib/silk/icons/information.png" alt="View Customer" title="View Customer" /></a>
|
||||
<a href="/store/admin/customers/edit/{$customer.id}"><img src="/static/contrib/silk/icons/pencil.png" alt="Edit Customer" title="Edit Customer" /></a>
|
||||
<a href="/store/admin/customers/delete/{$customer.id}" onclick="return confirm('Are you sure you want to delete {$customer.first_name} {$customer.last_name}?')"><img src="/static/contrib/silk/icons/cross.png" alt="Delete Customer" title="Delete Customer" /></a>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
{/if}
|
33
common/templates/store/admin/discounts.tpl
Normal file
33
common/templates/store/admin/discounts.tpl
Normal file
|
@ -0,0 +1,33 @@
|
|||
<h3>Discounts</h3>
|
||||
<div class="float-right">
|
||||
<img src="/static/contrib/silk/icons/add.png" style="margin: 0 5px -4px 0;"/><a href="/store/admin/discounts/edit">Add New Discount</a>
|
||||
</div>
|
||||
{if is_array($module.discounts)}
|
||||
<table style="width: 100%">
|
||||
<tr>
|
||||
<th class="left">Code</th>
|
||||
<th class="left">Name</th>
|
||||
<th class="left">Description</th>
|
||||
<th>Products</th>
|
||||
<th>Categories</th>
|
||||
<th>Customers</th>
|
||||
<th>Expiration</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
{foreach from=$module.discounts item=discount}
|
||||
<tr class="center">
|
||||
<td class="left">{if $discount.coupon != ''}{$discount.coupon}{else}<em>- n/a -</em>{/if}</td>
|
||||
<td class="left">{$discount.name}</td>
|
||||
<td class="left">{$discount.description}</td>
|
||||
<td>{if $discount.all_products == 'Y'}All{else}Select{/if}</td>
|
||||
<td>{if $discount.all_categories == 'Y'}All{else}Select{/if}</td>
|
||||
<td>{if $discount.all_customers == 'Y'}All{else}Select{/if}</td>
|
||||
<td>{if $discount.valid_through == null}<em>- Never -</em>{else}{$discount.valid_through}{/if}</td>
|
||||
<td>
|
||||
<a href="/store/admin/discounts/edit/{$discount.id}"><img src="/static/contrib/silk/icons/pencil.png" alt="Edit Discount" title="Edit Discount" /></a>
|
||||
<a href="/store/admin/discounts/delete/{$discount.id}" onclick="return confirm('Are you sure you want to delete {$discount.first_name} {$discount.last_name}?')"><img src="/static/contrib/silk/icons/cross.png" alt="Delete Discount" title="Delete Discount" /></a>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
{/if}
|
226
common/templates/store/admin/discounts/edit.tpl
Normal file
226
common/templates/store/admin/discounts/edit.tpl
Normal file
|
@ -0,0 +1,226 @@
|
|||
<script type="text/javascript" src="/static/js/ajax.js" /></script>
|
||||
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
// @todo Move this to an external file so that logic isn't in the template
|
||||
function copyAddress(that) {
|
||||
if (that.checked == true) {
|
||||
// Copy the values
|
||||
document.getElementById('payee_company').value = document.getElementById('contact_company').value;
|
||||
document.getElementById('payee_first_name').value = document.getElementById('contact_first_name').value;
|
||||
document.getElementById('payee_last_name').value = document.getElementById('contact_last_name').value;
|
||||
document.getElementById('payee_address1').value = document.getElementById('contact_address1').value;
|
||||
document.getElementById('payee_address2').value = document.getElementById('contact_address2').value;
|
||||
document.getElementById('payee_city').value = document.getElementById('contact_city').value;
|
||||
document.getElementById('payee_state').value = document.getElementById('contact_state').value;
|
||||
document.getElementById('payee_zip_code').value = document.getElementById('contact_zip_code').value;
|
||||
document.getElementById('payee_phone').value = document.getElementById('contact_phone').value;
|
||||
document.getElementById('payee_fax').value = document.getElementById('contact_fax').value;
|
||||
|
||||
// Disable the fields
|
||||
document.getElementById('payee_company').disabled = true;
|
||||
document.getElementById('payee_first_name').disabled = true;
|
||||
document.getElementById('payee_last_name').disabled = true;
|
||||
document.getElementById('payee_address1').disabled = true;
|
||||
document.getElementById('payee_address2').disabled = true;
|
||||
document.getElementById('payee_city').disabled = true;
|
||||
document.getElementById('payee_state').disabled = true;
|
||||
document.getElementById('payee_zip_code').disabled = true;
|
||||
document.getElementById('payee_phone').disabled = true;
|
||||
document.getElementById('payee_fax').disabled = true;
|
||||
}
|
||||
else {
|
||||
// Clear the values
|
||||
document.getElementById('payee_company').value = '';
|
||||
document.getElementById('payee_first_name').value = '';
|
||||
document.getElementById('payee_last_name').value = '';
|
||||
document.getElementById('payee_address1').value = '';
|
||||
document.getElementById('payee_address2').value = '';
|
||||
document.getElementById('payee_city').value = '';
|
||||
document.getElementById('payee_state').value = '';
|
||||
document.getElementById('payee_zip_code').value = '';
|
||||
document.getElementById('payee_phone').value = '';
|
||||
document.getElementById('payee_fax').value = '';
|
||||
|
||||
// Enable the fields
|
||||
document.getElementById('payee_company').disabled = false;
|
||||
document.getElementById('payee_first_name').disabled = false;
|
||||
document.getElementById('payee_last_name').disabled = false;
|
||||
document.getElementById('payee_address1').disabled = false;
|
||||
document.getElementById('payee_address2').disabled = false;
|
||||
document.getElementById('payee_city').disabled = false;
|
||||
document.getElementById('payee_state').disabled = false;
|
||||
document.getElementById('payee_zip_code').disabled = false;
|
||||
document.getElementById('payee_phone').disabled = false;
|
||||
document.getElementById('payee_fax').disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
function clearForm(responseObject, responseElement) {
|
||||
if (responseObject != null) {
|
||||
switch (responseObject.status) {
|
||||
case 'Success':
|
||||
document.getElementById('contact_company').value = '';
|
||||
document.getElementById('contact_first_name').value = '';
|
||||
document.getElementById('contact_last_name').value = '';
|
||||
document.getElementById('contact_address1').value = '';
|
||||
document.getElementById('contact_address2').value = '';
|
||||
document.getElementById('contact_city').value = '';
|
||||
document.getElementById('contact_state').value = '';
|
||||
document.getElementById('contact_zip_code').value = '';
|
||||
document.getElementById('contact_phone').value = '';
|
||||
document.getElementById('contact_fax').value = '';
|
||||
|
||||
document.getElementById('payee_company').value = '';
|
||||
document.getElementById('payee_first_name').value = '';
|
||||
document.getElementById('payee_last_name').value = '';
|
||||
document.getElementById('payee_address1').value = '';
|
||||
document.getElementById('payee_address2').value = '';
|
||||
document.getElementById('payee_city').value = '';
|
||||
document.getElementById('payee_state').value = '';
|
||||
document.getElementById('payee_zip_code').value = '';
|
||||
document.getElementById('payee_phone').value = '';
|
||||
document.getElementById('payee_fax').value = '';
|
||||
|
||||
document.getElementById('email').value = '';
|
||||
document.getElementById('tax_id').value = '';
|
||||
document.getElementById('tax_class').value = '';
|
||||
document.getElementById('commission_rate').value = '';
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
//alert(responseObject.message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var responseMessage = document.createTextNode(responseObject.message);
|
||||
responseElement.className = responseObject.type;
|
||||
responseElement.appendChild(responseMessage);
|
||||
|
||||
return responseElement;
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
form div {
|
||||
margin-top: 10px;
|
||||
}
|
||||
dl {
|
||||
margin-top: 5px;
|
||||
width: 400px;
|
||||
}
|
||||
dl dt {
|
||||
float: left;
|
||||
padding-top: 4px;
|
||||
text-align: right;
|
||||
width: 100px;
|
||||
}
|
||||
dl dd {
|
||||
float: left;
|
||||
width: 240px;
|
||||
}
|
||||
dl dd input {
|
||||
margin: 2px;
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
</style>
|
||||
{/literal}
|
||||
<h3>{if isset($module.discount.id)}Update{else}Add{/if} Discount</h3>
|
||||
<form method="post" action="/store/admin/discounts/save">
|
||||
<div class="right" style="margin-bottom: -10px;">
|
||||
Same as contact information?
|
||||
<input id="payee_same_as_contact" type="checkbox" onclick="copyAddress(this);" name="payee_same_as_contact" style="margin-top: -2px" />
|
||||
</div>
|
||||
<div class="float-left">
|
||||
<b>Contact Information:</b>
|
||||
<dl>
|
||||
<dt>Company:</dt>
|
||||
<dd><input type='text' name='contact_company' id='contact_company' maxlength="64" value="{$module.discount.contact_company}" /></dd>
|
||||
<dt><span class="pink">*</span>First Name:</dt>
|
||||
<dd><input type='text' name='contact_first_name' id='contact_first_name' title="required" maxlength="50" value="{$module.discount.contact_first_name}" /></dd>
|
||||
<dt><span class="pink">*</span>Last Name:</dt>
|
||||
<dd><input type='text' name='contact_last_name' id='contact_last_name' title="required" maxlength="50" value="{$module.discount.contact_last_name}" /></dd>
|
||||
<dt><span class="pink">*</span>Address:</dt>
|
||||
<dd>
|
||||
<input type='text' name='contact_address1' id='contact_address1' title="required" maxlength="64" value="{$module.discount.contact_address1}" /><br />
|
||||
<input type='text' name='contact_address2' id='contact_address2' maxlength="64" value="{$module.discount.contact_address2}" />
|
||||
</dd>
|
||||
<dt><span class="pink">*</span>City:</dt>
|
||||
<dd><input type='text' name='contact_city' id='contact_city' title="required" maxlength="64" value="{$module.discount.contact_city}" /></dd>
|
||||
<dt><span class="pink">*</span>State:</dt>
|
||||
<dd>{html_select_state prefix="contact_" title="required"}</dd>
|
||||
<dt><span class="pink">*</span>ZIP Code:</dt>
|
||||
<dd><input type='text' name='contact_zip_code' id='contact_zip_code' style="width: 50px;" title="required" maxlength="5" value="{$module.discount.contact_zip_code}" /></dd>
|
||||
<dt><span class="pink">*</span>Phone:</dt>
|
||||
<dd><input type="text" name="contact_phone" id="contact_phone" style="width: 150px" maxlength="32" title="required" value="{$module.discount.contact_phone}" /></dd>
|
||||
<dt>Fax:</dt>
|
||||
<dd><input type="text" name="contact_fax" id="contact_fax" style="width: 150px" maxlength="32" value="{$module.discount.contact_fax}" /></dd>
|
||||
</dl>
|
||||
<br class="clear-left" /><br />
|
||||
<dl>
|
||||
<dt>Email:</dt>
|
||||
<dd><input type="text" name="email" id="email" maxlength="255" value="{$module.discount.email}" /></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
<b>Payee Information:</b>
|
||||
<dl>
|
||||
<dt>Company:</dt>
|
||||
<dd><input type='text' name='payee_company' id='payee_company' maxlength="64" value="{$module.discount.payee_company}" /></dd>
|
||||
<dt><span class="pink">*</span>First Name:</dt>
|
||||
<dd><input type='text' name='payee_first_name' id='payee_first_name' title="required" maxlength="50" value="{$module.discount.payee_first_name}" /></dd>
|
||||
<dt><span class="pink">*</span>Last Name:</dt>
|
||||
<dd><input type='text' name='payee_last_name' id='payee_last_name' title="required" maxlength="50" value="{$module.discount.payee_last_name}" /></dd>
|
||||
<dt><span class="pink">*</span>Address:</dt>
|
||||
<dd>
|
||||
<input type='text' name='payee_address1' id='payee_address1' title="required" maxlength="64" value="{$module.discount.payee_address1}" /><br />
|
||||
<input type='text' name='payee_address2' id='payee_address2' maxlength="64" value="{$module.discount.payee_address2}" />
|
||||
</dd>
|
||||
<dt><span class="pink">*</span>City:</dt>
|
||||
<dd><input type='text' name='payee_city' id='payee_city' title="required" maxlength="64" value="{$module.discount.payee_city}" /></dd>
|
||||
<dt><span class="pink">*</span>State:</dt>
|
||||
<dd>{html_select_state prefix="payee_" title="required"}</dd>
|
||||
<dt><span class="pink">*</span>ZIP Code:</dt>
|
||||
<dd><input type='text' name='payee_zip_code' id='payee_zip_code' style="width: 50px;" title="required" maxlength="5" value="{$module.discount.payee_zip_code}" /></dd>
|
||||
<dt><span class="pink">*</span>Phone:</dt>
|
||||
<dd><input type="text" name="payee_phone" id="payee_phone" style="width: 150px" maxlength="32" title="required" value="{$module.discount.payee_phone}" /></dd>
|
||||
<dt>Fax:</dt>
|
||||
<dd><input type="text" name="payee_fax" id="payee_fax" style="width: 150px" maxlength="32" value="{$module.discount.payee_fax}" /></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<br class="clear-left" /><br />
|
||||
<div class="float-left">
|
||||
<b>Tax Information:</b>
|
||||
<dl>
|
||||
<dt><span class="pink">*</span>Tax ID:</dt>
|
||||
<dd><input type="input" id="tax_id" name="tax_id" title="required" maxlength="12" value="{$module.discount.tax_id}" /></dd>
|
||||
<dt><span class="pink">*</span>Tax Class:</dt>
|
||||
<dd>
|
||||
<select name="tax_class" id="tax_class" title="required">
|
||||
<option value="">-- Select a Class --</option>
|
||||
<option value="I"{if $module.discount.tax_class == 'I'} selected{/if}>Individual</option>
|
||||
<option value="C"{if $module.discount.tax_class == 'C'} selected{/if}>Corporation</option>
|
||||
<option value="P"{if $module.discount.tax_class == 'P'} selected{/if}>Partnership</option>
|
||||
</select>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
<b>Commission:</b>
|
||||
<dl>
|
||||
<dt><span class="pink">*</span>Rate:</dt>
|
||||
<dd><input type="input" id="commission_rate" name="commission_rate" title="required" style="width: 50px" value="{$module.discount.commission_rate}" />%</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<br class="clear-left" />
|
||||
<div class="center">
|
||||
{if isset($module.discount.id)}<input type="hidden" name="id" value="{$module.discount.id}" />{/if}
|
||||
<input type="reset" value="Reset Form" /><input type="button" value="Store Information" onclick="ajaxRequest(this.parentNode.parentNode{if !isset($module.discount.id)}, 'clearForm'{/if}); return false;" />
|
||||
</div>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
document.getElementById('contact_state').value = "{$module.discount.contact_state}";
|
||||
document.getElementById('payee_state').value = "{$module.discount.payee_state}";
|
||||
</script>
|
32
common/templates/store/admin/orders.tpl
Normal file
32
common/templates/store/admin/orders.tpl
Normal file
|
@ -0,0 +1,32 @@
|
|||
<h3>Orders</h3>
|
||||
{if is_array($module.orders)}
|
||||
<table style="width: 100%">
|
||||
<tr>
|
||||
<th class="left" nowrap="nowrap">Order #</th>
|
||||
<th class="left">Customer</th>
|
||||
<th class="left" nowrap="nowrap">Order Date</th>
|
||||
<th class="left">Total</th>
|
||||
<th>Status</th>
|
||||
<th nowrap="nowrap">Last Update</th>
|
||||
<th nowrap="nowrap">Shipping Method</th>
|
||||
<th>Weight</th>
|
||||
<th>Transaction #</th>
|
||||
</tr>
|
||||
{foreach from=$module.orders item=order}
|
||||
<tr class="center">
|
||||
<td class="left">
|
||||
<a href="/store/admin/orders/edit/{$order.order_id}" title="View / Update Order">{$order.order_id}</a></td>
|
||||
<td class="left">
|
||||
{if $order.customer_id != ''}<a href="/store/admin/customers/view/{$order.customer_id}">{/if}{$order.customer_name}{if $order.customer_id != ''}</a>{/if}
|
||||
</td>
|
||||
<td class="left">{$order.order_time}</td>
|
||||
<td class="left">${$order.total_amount}</td>
|
||||
<td>{if $order.status != ''}{$order.status}{else}<em>Unknown</em>{/if}</td>
|
||||
<td>{if $order.last_update != ''}{$order.last_update|date_format:'%m/%d/%Y'}{else}<em>Unknown</em>{/if}</td>
|
||||
<td>{$order.shipping_method}</td>
|
||||
<td>{$order.weight|number_format:2} lbs</td>
|
||||
<td>{if $order.transaction_id != ''}{$order.transaction_id}{else}<em>n/a</em>{/if}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
{/if}
|
142
common/templates/store/admin/orders/edit.tpl
Normal file
142
common/templates/store/admin/orders/edit.tpl
Normal file
|
@ -0,0 +1,142 @@
|
|||
<script type="text/javascript" src="/static/js/ajax.js" /></script>
|
||||
<!--script type="text/javascript" src="/js/processOrder.js" /></script-->
|
||||
|
||||
{assign var='order' value=$module.order}
|
||||
|
||||
<h3>Order #{$order.order_id}</h3>
|
||||
<h3>Date: {$order.order_time}</h3>
|
||||
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
function returnToList(responseObject, responseElement) {
|
||||
if (responseObject != null) {
|
||||
switch (responseObject.status) {
|
||||
case 'Success':
|
||||
document.location.href = '/store/admin/orders';
|
||||
break;
|
||||
|
||||
default:
|
||||
//alert(responseObject.message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var responseMessage = document.createTextNode(responseObject.message);
|
||||
responseElement.className = responseObject.type;
|
||||
responseElement.appendChild(responseMessage);
|
||||
|
||||
return responseElement;
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
form div { margin-top: 10px }
|
||||
dd, dt { float: left }
|
||||
dt { clear: left; width: 90px; padding-right: 10px }
|
||||
dl.status dt { width: 120px }
|
||||
</style>
|
||||
{/literal}
|
||||
|
||||
<form method="post" action="/store/admin/orders/save">
|
||||
{if $order.total_amount > 0}
|
||||
<div class="float-left">
|
||||
<b>Bill To:</b><br />
|
||||
{if $order.billing_company}{$order.billing_company}<br />{/if}
|
||||
{$order.billing_first_name} {$order.billing_last_name}<br />
|
||||
{$order.billing_address1}<br />
|
||||
{if $order.billing_address2}{$order.billing_address2}<br />{/if}
|
||||
{$order.billing_city}, {$order.billing_state} {$order.billing_zip_code}<br /><br />
|
||||
{$order.billing_phone}
|
||||
{if $order.billing_fax != ''}<br />Fax: {$order.billing_fax}{/if}<br /><br />
|
||||
<b>Email:</b> {mailto address=$order.email}
|
||||
</div>
|
||||
{/if}
|
||||
<div class="float-left" style="padding-left: 50px">
|
||||
<b>Ship To:</b><br />
|
||||
{if $order.shipping_company}{$order.shipping_company}<br />{/if}
|
||||
{$order.shipping_first_name} {$order.shipping_last_name}<br />
|
||||
{$order.shipping_address1}<br />
|
||||
{if $order.shipping_address2}{$order.shipping_address2}<br />{/if}
|
||||
{$order.shipping_city}, {$order.shipping_state} {$order.shipping_zip_code}<br /><br />
|
||||
{$order.shipping_phone}
|
||||
{if $order.shipping_fax != ''}<br />Fax: {$order.shipping_fax}{/if}<br /><br />
|
||||
<b>Shipping Method:</b> {$order.shipping_method}<br />
|
||||
<b>Weight:</b> {$order.weight|number_format:2} lbs
|
||||
</div>
|
||||
{if $order.total_amount > 0}
|
||||
<div class="float-left" style="padding-left: 50px">
|
||||
<b>Payment Information:</b><br />
|
||||
<dl>
|
||||
<dt>Card Type:</dt>
|
||||
<dd>{$order.cc_type}</dd>
|
||||
<dt>Card Number:</dt>
|
||||
<dd>XXXX-XXXX-XXXX-{$order.cc_last4}</dd>
|
||||
<dt>Expiration:</dt>
|
||||
<dd>{$order.cc_expiration|date_format:'%m/%Y'}</dd>
|
||||
<dt>Transaction #:</dt>
|
||||
<dd>{$order.transaction_id}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
{/if}
|
||||
<br class="clear-left" />
|
||||
<div>
|
||||
<table class="product-list">
|
||||
<tr>
|
||||
<th class="product-quantity">Qty.</th>
|
||||
<th class="product-sku">SKU</th>
|
||||
<th class="product-description">Product Description</th>
|
||||
<th class="product-price">Price</th>
|
||||
<th class="product-total">Total</th>
|
||||
</tr>
|
||||
{foreach from=$order.products key=id item=product}
|
||||
<tr>
|
||||
<td class="product-quantity">{$product.quantity}</td>
|
||||
<td class="product-sku" style="text-align: center">{$product.sku}</td>
|
||||
<td class="product-description">{$product.name}</td>
|
||||
<td class="product-price">
|
||||
${$product.price|number_format:2}
|
||||
</td>
|
||||
<td class="product-total">
|
||||
${$product.price*$product.quantity|number_format:2}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
</td>
|
||||
<td class="right">
|
||||
<b>Subtotal:</b><br />
|
||||
<b>Shipping:</b><br />
|
||||
<b>Total:</b>
|
||||
</td>
|
||||
<td class="right">
|
||||
${$order.total_amount-$order.shipping_amount|number_format:2}<br />
|
||||
${$order.shipping_amount}<br />
|
||||
${$order.total_amount|number_format:2}<br />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<br class="clear-left" />
|
||||
<div class="float-left" style="width: 500px">
|
||||
<dl class="status">
|
||||
<dt>Order Status:</dt>
|
||||
<dd>{html_options name='status' options=$module.statuses selected=$order.status_id}</dd>
|
||||
<dt>Shipping Method:</dt>
|
||||
<dd>{html_options name='shipping_method' options=$module.shipping_methods selected=$order.shipping_method}</dd>
|
||||
<dt>Tracking Number:</dt>
|
||||
<dd><input type="text" name="tracking_number" id="tracking_number" value="{$order.tracking_number}" /></dd>
|
||||
<dt>Note:</dt>
|
||||
<dd><textarea id="shipping_note" name="shipping_note" style="width: 350px">{$order.shipping_note}</textarea></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
<b>Resend Receipt to:</b> <input type="text" name="email" id="email" value="{$order.email}" /> <input type="button" value="Send" onclick="alert('not yet');"/><br /><br /><br />
|
||||
</div>
|
||||
<br class="clear-left" />
|
||||
<br class="clear-right" />
|
||||
<div class="center" style="width: 500px">
|
||||
<input type="hidden" name="id" value="{$order.order_id}" />
|
||||
<input type="button" value="Save & Return to List" onclick="ajaxRequest(this.parentNode.parentNode, 'returnToList'); return false;" />
|
||||
<input type="button" value="Save & Print Packing Slip" onclick="alert('almost'); return false; ajaxRequest(this.parentNode.parentNode); /*, 'print');*/ return false;" />
|
||||
</div>
|
||||
</form>
|
Loading…
Add table
Add a link
Reference in a new issue