Removed common code
* Attempting to remove form the core of PICKLES that shouldn't be there * Removed shared modules and templates
This commit is contained in:
parent
b35ba9fffe
commit
a3bdb86d14
72 changed files with 0 additions and 4460 deletions
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
|
||||
class home extends Module {
|
||||
|
||||
protected $display = DISPLAY_SMARTY;
|
||||
|
||||
public function __default() {
|
||||
|
||||
}
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
<?php
|
||||
|
||||
class post_delete extends Module {
|
||||
|
||||
public function __default() {
|
||||
|
||||
if (isset($_REQUEST['id']) && trim($_REQUEST['id']) != '') {
|
||||
$this->db->delete('posts', array('post_id' => $_REQUEST['id']));
|
||||
|
||||
header('Location: /');
|
||||
}
|
||||
else {
|
||||
// @todo Throw error
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,13 +0,0 @@
|
|||
<?php
|
||||
|
||||
class post_edit extends post_new {
|
||||
|
||||
public function __default() {
|
||||
|
||||
if (isset($_REQUEST['id'])) {
|
||||
$this->setPublic('post', $this->db->getRow('SELECT post_id, title, body, posted_at, hidden FROM posts WHERE post_id = "' . $_REQUEST['id'] . '";'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,11 +0,0 @@
|
|||
<?php
|
||||
|
||||
class post_new extends Module {
|
||||
|
||||
public function __construct(Config $config, DB $db, Mailer $mailer, Error $error) {
|
||||
parent::__construct($config, $db, $mailer, $error);
|
||||
$this->template = 'post/edit';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,52 +0,0 @@
|
|||
<?php
|
||||
|
||||
class post_save extends post_edit {
|
||||
|
||||
public function __default() {
|
||||
parent::__default();
|
||||
|
||||
$existing = $this->public['post'];
|
||||
|
||||
if ($_REQUEST['id'] != '' && $_REQUEST['id'] != $existing['post_id']) {
|
||||
// @todo Throw error
|
||||
}
|
||||
else {
|
||||
// Prepends days 1-9 with a 0 since html_select_date doesn't do so
|
||||
if ($_REQUEST['Date_Day'] < 10) {
|
||||
$_REQUEST['Date_Day'] = '0' . $_REQUEST['Date_Day'];
|
||||
}
|
||||
|
||||
// Converts the hour to military time
|
||||
if ($_REQUEST['Time_Meridian'] == 'pm' && $_REQUEST['Time_Hour'] < 12) {
|
||||
$_REQUEST['Time_Hour'] += 12;
|
||||
}
|
||||
else if ($_REQUEST['Time_Meridian'] == 'am' && $_REQUEST['Time_Hour'] == 12) {
|
||||
$_REQUEST['Time_Hour'] = '00';
|
||||
}
|
||||
|
||||
// Contructs the posted at timestamp
|
||||
$_REQUEST['posted_at'] = $_REQUEST['Date_Year'] . '-' . $_REQUEST['Date_Month'] . '-' . $_REQUEST['Date_Day'] . ' ' . $_REQUEST['Time_Hour'] . ':' . $_REQUEST['Time_Minute'] . ':' . $_REQUEST['Time_Second'];
|
||||
|
||||
// Assembles the data array
|
||||
$data = array(
|
||||
'title' => $_REQUEST['title'],
|
||||
'body' => $_REQUEST['body'],
|
||||
'posted_at' => $_REQUEST['posted_at'],
|
||||
'hidden' => $_REQUEST['hidden']
|
||||
);
|
||||
|
||||
if ($_REQUEST['id'] != '') {
|
||||
if ($_REQUEST['title'] != $existing['title'] || $_REQUEST['body'] != $existing['body'] || $_REQUEST['posted_at'] != $posted_at) {
|
||||
$this->db->update('posts', $data, array('post_id' => $_REQUEST['id']));
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->db->insert('posts', $data);
|
||||
}
|
||||
}
|
||||
|
||||
header('Location: /weblog');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,66 +0,0 @@
|
|||
<?php
|
||||
|
||||
class posts extends Module {
|
||||
|
||||
public function __default() {
|
||||
|
||||
// Sets up the pagination variables (5 per page)
|
||||
$page = isset($_REQUEST['page']) ? $_REQUEST['page'] : 1;
|
||||
$offset = $page > 1 ? ($page - 1) * 5 : 0;
|
||||
|
||||
// Sets up the first (current) and last page numbers
|
||||
$this->setPublic('page', $page);
|
||||
$this->setPublic('last', $this->db->getField('SELECT COUNT(post_id) / 5 FROM posts ' . $where . ';'));
|
||||
|
||||
// Constructions additional WHERE logic for non logged in users
|
||||
if (isset($_SESSION['user_id']) && $_SESSION['user_id'] > 0) {
|
||||
$where = '';
|
||||
$this->setPublic('admin', true);
|
||||
}
|
||||
else {
|
||||
$where = 'WHERE posted_at <= NOW() AND hidden IS FALSE';
|
||||
$this->setPublic('admin', false);
|
||||
}
|
||||
|
||||
// Pulls the posts
|
||||
$posts = $this->db->getArray('
|
||||
SELECT p.post_id, p.title, p.body, p.tags, p.posted_at, p.hidden, u.name AS posted_by, u.email, COUNT(c.comment_id) AS comments
|
||||
FROM posts AS p
|
||||
LEFT JOIN users AS u ON u.user_id = p.user_id
|
||||
LEFT JOIN comments AS c ON c.post_id = p.post_id AND c.approved IS TRUE
|
||||
' . $where . '
|
||||
GROUP BY p.post_id
|
||||
ORDER BY posted_at DESC
|
||||
LIMIT ' . $offset . ', 5;
|
||||
');
|
||||
|
||||
// Pulls all of the tags
|
||||
$all_tags = array();
|
||||
$tags = $this->db->getArray('SELECT tag_id, name FROM tags;');
|
||||
foreach ($tags as $tag) {
|
||||
$all_tags[$tag['tag_id']] = $tag['name'];
|
||||
}
|
||||
|
||||
// Loops through the posts and translates the tags
|
||||
foreach ($posts as $post_id => $post) {
|
||||
$post_tags = array();
|
||||
|
||||
if (strpos($post['tags'], ',') !== false) {
|
||||
$tags = explode(',', $post['tags']);
|
||||
|
||||
if (is_array($tags)) {
|
||||
foreach ($tags as $tag_id) {
|
||||
$post_tags[] = $all_tags[$tag_id];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$posts[$post_id]['tags'] = $post_tags;
|
||||
}
|
||||
|
||||
// Passes the posts to the display class
|
||||
$this->setPublic('posts', $posts);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,71 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Store
|
||||
*
|
||||
* @package PICKLES
|
||||
* @subpackage store
|
||||
* @author Joshua Sherman <josh@phpwithpickles.org>
|
||||
* @copyright 2007-2009 Joshua Sherman
|
||||
*/
|
||||
|
||||
class store extends Module {
|
||||
|
||||
protected $display = DISPLAY_SMARTY;
|
||||
protected $session = true;
|
||||
|
||||
public function __construct(Config $config, DB $db, Mailer $mailer, Error $error) {
|
||||
parent::__construct($config, $db, $mailer, $error);
|
||||
|
||||
// Loads up the cart in case we need it
|
||||
if (!isset($_SESSION['cart'], $_SESSION['cart']['count'], $_SESSION['cart']['products'])) {
|
||||
$_SESSION['cart'] = array();
|
||||
$_SESSION['cart'] = array('count' => 0, 'products' => null);
|
||||
}
|
||||
else {
|
||||
$count = 0;
|
||||
|
||||
if (is_array($_SESSION['cart']['products'])) {
|
||||
foreach ($_SESSION['cart']['products'] as $product_id => $product_info) {
|
||||
$count += $product_info['quantity'];
|
||||
}
|
||||
}
|
||||
|
||||
$_SESSION['cart']['count'] = $count;
|
||||
}
|
||||
|
||||
$this->setPublic('cart', $_SESSION['cart']);
|
||||
|
||||
// Loads the navigation
|
||||
if (isset($config->store->sections)) {
|
||||
$this->setPublic('subnav', $config->store->sections);
|
||||
}
|
||||
|
||||
// Loads the categories
|
||||
$categories = $this->db->getArray('SELECT id, name, permalink FROM categories WHERE parent_id IS NULL AND visible = "Y" ORDER BY weight;');
|
||||
if (is_array($categories)) {
|
||||
foreach ($categories as $key => $category) {
|
||||
$categories[$key]['subcategories'] = $this->db->getArray('
|
||||
SELECT id, name, permalink
|
||||
FROM categories
|
||||
WHERE parent_id = "' . $category['id'] . '"
|
||||
AND visible = "Y"
|
||||
ORDER BY weight;
|
||||
');
|
||||
}
|
||||
}
|
||||
|
||||
$this->setPublic('categories', $categories);
|
||||
}
|
||||
|
||||
public function __default() {
|
||||
// Forces store/home as the first page you get when only /store is called
|
||||
$object = new store_home($this->config, $this->db, $this->mailer, $this->error);
|
||||
$object->__default();
|
||||
|
||||
$this->public = $object->public;
|
||||
$this->name = 'store/home';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,37 +0,0 @@
|
|||
<?php
|
||||
|
||||
class store_admin extends Module {
|
||||
|
||||
protected $authentication = true;
|
||||
|
||||
public function __construct(Config $config, DB $db, Mailer $mailer, Error $error) {
|
||||
parent::__construct($config, $db, $mailer, $error);
|
||||
|
||||
$options = array(
|
||||
'home',
|
||||
'orders',
|
||||
'customers',
|
||||
'products',
|
||||
'categories',
|
||||
'discounts',
|
||||
'affiliates',
|
||||
'gift certificates',
|
||||
'reports',
|
||||
'settings'
|
||||
);
|
||||
$this->setPublic('options', $options);
|
||||
|
||||
$this->shared_template = 'store/admin';
|
||||
}
|
||||
|
||||
public function __default() {
|
||||
// Forces store/admin/home as the first page you get when only /store is called
|
||||
$object = new store_admin_home($this->config, $this->db, $this->mailer, $this->error);
|
||||
$object->__default();
|
||||
|
||||
$this->public = $object->public;
|
||||
$this->name = 'store/admin/home';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,33 +0,0 @@
|
|||
<?php
|
||||
|
||||
class store_admin_affiliates extends store_admin {
|
||||
|
||||
public function __default() {
|
||||
$sql = '
|
||||
SELECT
|
||||
a.id,
|
||||
a.commission_rate,
|
||||
a.order_count,
|
||||
a.unpaid_balance,
|
||||
|
||||
e.email,
|
||||
|
||||
ca.first_name,
|
||||
ca.last_name,
|
||||
ca.phone
|
||||
|
||||
FROM affiliates AS a
|
||||
INNER JOIN emails AS e ON e.id = a.email_id
|
||||
INNER JOIN addresses AS ca ON ca.id = a.contact_address_id
|
||||
|
||||
ORDER BY
|
||||
unpaid_balance DESC,
|
||||
order_count DESC
|
||||
;
|
||||
';
|
||||
|
||||
$this->setPublic('affiliates', $this->db->getArray($sql));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,12 +0,0 @@
|
|||
<?php
|
||||
|
||||
class store_admin_affiliates_delete extends store_admin {
|
||||
|
||||
public function __default() {
|
||||
$this->db->execute('DELETE FROM affiliates WHERE id = "' . $_REQUEST['id'] . '";');
|
||||
|
||||
header('Location: /store/admin/affiliates');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,54 +0,0 @@
|
|||
<?php
|
||||
|
||||
class store_admin_affiliates_edit extends store_admin {
|
||||
|
||||
protected $display = array(DISPLAY_SMARTY, DISPLAY_JSON);
|
||||
|
||||
public function __default() {
|
||||
|
||||
if (isset($_REQUEST['id'])) {
|
||||
$sql = "
|
||||
SELECT
|
||||
a.id,
|
||||
a.tax_id,
|
||||
a.tax_class,
|
||||
a.commission_rate,
|
||||
|
||||
e.email,
|
||||
|
||||
ca.company AS contact_company,
|
||||
ca.first_name AS contact_first_name,
|
||||
ca.last_name AS contact_last_name,
|
||||
ca.address1 AS contact_address1,
|
||||
ca.address2 AS contact_address2,
|
||||
ca.city AS contact_city,
|
||||
ca.state AS contact_state,
|
||||
ca.zip_code AS contact_zip_code,
|
||||
ca.phone AS contact_phone,
|
||||
ca.fax AS contact_fax,
|
||||
|
||||
pa.company AS payee_company,
|
||||
pa.first_name AS payee_first_name,
|
||||
pa.last_name AS payee_last_name,
|
||||
pa.address1 AS payee_address1,
|
||||
pa.address2 AS payee_address2,
|
||||
pa.city AS payee_city,
|
||||
pa.state AS payee_state,
|
||||
pa.zip_code AS payee_zip_code,
|
||||
pa.phone AS payee_phone,
|
||||
pa.fax AS payee_fax
|
||||
|
||||
FROM affiliates AS a
|
||||
INNER JOIN emails AS e ON e.id = a.email_id
|
||||
INNER JOIN addresses AS ca ON ca.id = a.contact_address_id
|
||||
INNER JOIN addresses AS pa ON pa.id = a.payee_address_id
|
||||
|
||||
WHERE a.id = '{$_REQUEST['id']}';
|
||||
";
|
||||
|
||||
$this->setPublic('affiliate', $this->db->getRow($sql));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,54 +0,0 @@
|
|||
<?php
|
||||
|
||||
class store_admin_affiliates_pay extends store_admin {
|
||||
|
||||
protected $display = array(DISPLAY_SMARTY, DISPLAY_JSON);
|
||||
|
||||
public function __default() {
|
||||
|
||||
if (isset($_REQUEST['id'])) {
|
||||
$sql = "
|
||||
SELECT
|
||||
a.id,
|
||||
a.tax_id,
|
||||
a.tax_class,
|
||||
a.unpaid_balance,
|
||||
|
||||
e.email,
|
||||
|
||||
ca.company AS contact_company,
|
||||
ca.first_name AS contact_first_name,
|
||||
ca.last_name AS contact_last_name,
|
||||
ca.address1 AS contact_address1,
|
||||
ca.address2 AS contact_address2,
|
||||
ca.city AS contact_city,
|
||||
ca.state AS contact_state,
|
||||
ca.zip_code AS contact_zip_code,
|
||||
ca.phone AS contact_phone,
|
||||
ca.fax AS contact_fax,
|
||||
|
||||
pa.company AS payee_company,
|
||||
pa.first_name AS payee_first_name,
|
||||
pa.last_name AS payee_last_name,
|
||||
pa.address1 AS payee_address1,
|
||||
pa.address2 AS payee_address2,
|
||||
pa.city AS payee_city,
|
||||
pa.state AS payee_state,
|
||||
pa.zip_code AS payee_zip_code,
|
||||
pa.phone AS payee_phone,
|
||||
pa.fax AS payee_fax
|
||||
|
||||
FROM affiliates AS a
|
||||
INNER JOIN emails AS e ON e.id = a.email_id
|
||||
INNER JOIN addresses AS ca ON ca.id = a.contact_address_id
|
||||
INNER JOIN addresses AS pa ON pa.id = a.payee_address_id
|
||||
|
||||
WHERE a.id = '{$_REQUEST['id']}';
|
||||
";
|
||||
|
||||
$this->setPublic('affiliate', $this->db->getRow($sql));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,57 +0,0 @@
|
|||
<?php
|
||||
|
||||
class store_admin_affiliates_pay_save extends store_admin {
|
||||
|
||||
protected $display = DISPLAY_JSON;
|
||||
|
||||
public function __default() {
|
||||
|
||||
// Checks that the amount is not greater than the unpaid balance
|
||||
if ($_REQUEST['amount'] > $this->db->getField('SELECT unpaid_balance FROM affiliates WHERE id = "' . $_REQUEST['id'] . '";')) {
|
||||
$this->error->addError('The amount of the check is greater than the unpaid balance');
|
||||
}
|
||||
// Checks for zero balance and negative checks
|
||||
else if ($_REQUEST['amount'] <= 0) {
|
||||
$this->error->addError('The amount of the check is not valid');
|
||||
}
|
||||
// Checks that the check number is an integer
|
||||
else if (!is_numeric($_REQUEST['number'])) {
|
||||
$this->error->addError('The number of the check should be an integer (example: 1234)');
|
||||
}
|
||||
// Checks that the date is valid
|
||||
else if (!is_numeric($_REQUEST['date']['mm']) || !is_numeric($_REQUEST['date']['dd']) || !is_numeric($_REQUEST['date']['ccyy'])) {
|
||||
$this->error->addError('The date does not appear to be valid');
|
||||
}
|
||||
// Adds the check to the database and updates the unpaid amount
|
||||
else {
|
||||
$check = array(
|
||||
'affiliate_id' => $_REQUEST['id'],
|
||||
'amount' => $_REQUEST['amount'],
|
||||
'number' => $_REQUEST['number'],
|
||||
'date' => $_REQUEST['date']['ccyy'] . '-' . $_REQUEST['date']['mm'] . '-' . $_REQUEST['date']['dd'],
|
||||
'notes' => $_REQUEST['notes']
|
||||
);
|
||||
|
||||
$this->db->insert('checks', $check);
|
||||
|
||||
$this->db->execute('
|
||||
UPDATE affiliates
|
||||
SET unpaid_balance = unpaid_balance - ' . $_REQUEST['amount'] . '
|
||||
WHERE id = "' . $_REQUEST['id'] . '";
|
||||
');
|
||||
}
|
||||
|
||||
if ($this->error->getErrors()) {
|
||||
$this->setPublic('status', 'Error');
|
||||
$this->setPublic('message', 'There was an error storing the check information: ' . implode('. ', $this->error->getErrors()) . '.');
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
$this->setPublic('status', 'Success');
|
||||
$this->setPublic('message', 'The check information was stored successfully.');
|
||||
$this->setPublic('amount', $_REQUEST['amount']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,160 +0,0 @@
|
|||
<?php
|
||||
|
||||
class store_admin_affiliates_save extends store_admin {
|
||||
|
||||
protected $display = DISPLAY_JSON;
|
||||
|
||||
public function __default() {
|
||||
|
||||
// Adds the contact information into the database
|
||||
if (isset($_REQUEST['contact_address1']) && trim($_REQUEST['contact_address1']) != '') {
|
||||
$contact_address = array(
|
||||
'company' => $_REQUEST['contact_company'],
|
||||
'first_name' => $_REQUEST['contact_first_name'],
|
||||
'last_name' => $_REQUEST['contact_last_name'],
|
||||
'address1' => $_REQUEST['contact_address1'],
|
||||
'address2' => $_REQUEST['contact_address2'],
|
||||
'city' => $_REQUEST['contact_city'],
|
||||
'state' => $_REQUEST['contact_state'],
|
||||
'zip_code' => $_REQUEST['contact_zip_code'],
|
||||
'country' => 'US',
|
||||
'phone' => $_REQUEST['contact_phone'],
|
||||
'fax' => $_REQUEST['contact_fax']
|
||||
);
|
||||
|
||||
$contact_address['hash'] = md5(implode('', $contact_address));
|
||||
|
||||
if ($this->db->getField("SELECT COUNT(*) FROM addresses WHERE hash = '{$contact_address['hash']}';") == 0) {
|
||||
$contact_address_id = $this->db->insert('addresses', $contact_address);
|
||||
}
|
||||
else {
|
||||
$contact_address = $this->db->getRow("SELECT * FROM addresses WHERE hash = '{$contact_address['hash']}';");
|
||||
$contact_address_id = $contact_address['id'];
|
||||
}
|
||||
}
|
||||
|
||||
// Adds the payee information into the database
|
||||
$payee_address_id = null;
|
||||
|
||||
if (isset($_REQUEST['payee_same_as_contact']) && $_REQUEST['payee_same_as_contact'] == 'on') {
|
||||
$payee_address_id = $contact_address_id;
|
||||
$payee_address = $contact_address;
|
||||
}
|
||||
else if (isset($_REQUEST['payee_address1']) && trim($_REQUEST['payee_address1']) != '') {
|
||||
$payee_address = array(
|
||||
'company' => $_REQUEST['payee_company'],
|
||||
'first_name' => $_REQUEST['payee_first_name'],
|
||||
'last_name' => $_REQUEST['payee_last_name'],
|
||||
'address1' => $_REQUEST['payee_address1'],
|
||||
'address2' => $_REQUEST['payee_address2'],
|
||||
'city' => $_REQUEST['payee_city'],
|
||||
'state' => $_REQUEST['payee_state'],
|
||||
'zip_code' => $_REQUEST['payee_zip_code'],
|
||||
'country' => 'US',
|
||||
'phone' => $_REQUEST['payee_phone'],
|
||||
'fax' => $_REQUEST['payee_fax']
|
||||
);
|
||||
|
||||
$payee_address['hash'] = md5(implode('', $payee_address));
|
||||
|
||||
if ($this->db->getField("SELECT COUNT(*) FROM addresses WHERE hash = '{$payee_address['hash']}';") == 0) {
|
||||
$payee_address_id = $this->db->insert('addresses', $payee_address);
|
||||
}
|
||||
else {
|
||||
$payee_address = $this->db->getRow("SELECT * FROM addresses WHERE hash = '{$payee_address['hash']}';");
|
||||
$payee_address_id = $payee_address['id'];
|
||||
}
|
||||
}
|
||||
|
||||
// Adds the affiliate's email into the email database
|
||||
if (isset($_REQUEST['email']) && trim($_REQUEST['email']) != '') {
|
||||
$email = $_REQUEST['email'];
|
||||
|
||||
if ($this->db->getField("SELECT COUNT(*) FROM emails WHERE email = '{$email}';") == 0) {
|
||||
$email_id = $this->db->insert('emails', array('email' => $email));
|
||||
}
|
||||
else {
|
||||
$email_id = $this->db->getField("SELECT id FROM emails WHERE email = '{$email}';");
|
||||
}
|
||||
}
|
||||
|
||||
// Updates the existing affiliate
|
||||
if (isset($_REQUEST['id'])) {
|
||||
|
||||
$affiliate = array(
|
||||
'email_id' => $email_id,
|
||||
'contact_address_id' => $contact_address_id,
|
||||
'payee_address_id' => $payee_address_id,
|
||||
'tax_id' => $_REQUEST['tax_id'],
|
||||
'tax_class' => $_REQUEST['tax_class'],
|
||||
'commission_rate' => $_REQUEST['commission_rate']
|
||||
);
|
||||
|
||||
$this->db->update('affiliates', $affiliate, array('id' => $_REQUEST['id']));
|
||||
|
||||
if ($this->error->getErrors()) {
|
||||
$this->setPublic('status', 'Error');
|
||||
$this->setPublic('message', 'There was an error updating the affiliate account (' . implode('. ', $this->error->getErrors()) . '.)');
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
$this->setPublic('status', 'Success');
|
||||
$this->setPublic('message', 'The affiliate information has been updated successfully.');
|
||||
}
|
||||
}
|
||||
// Adds a brand new affiliate
|
||||
else {
|
||||
$affiliate = array(
|
||||
'email_id' => $email_id,
|
||||
'contact_address_id' => $contact_address_id,
|
||||
'payee_address_id' => $payee_address_id,
|
||||
'tax_id' => $_REQUEST['tax_id'],
|
||||
'tax_class' => $_REQUEST['tax_class'],
|
||||
'date_started' => date('Y-m-d'),
|
||||
'commission_rate' => $_REQUEST['commission_rate']
|
||||
);
|
||||
|
||||
$affiliate_id = $this->db->insert('affiliates', $affiliate);
|
||||
|
||||
if ($this->error->getErrors()) {
|
||||
$this->setPublic('status', 'Error');
|
||||
$this->setPublic('message', 'There was an error adding the affiliate account (' . implode('. ', $this->error->getErrors()) . '.)');
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
$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 new affiliate has been added successfully.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,34 +0,0 @@
|
|||
<?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);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,49 +0,0 @@
|
|||
<?php
|
||||
|
||||
class store_admin_customers extends store_admin {
|
||||
|
||||
public function __default() {
|
||||
$sql = '
|
||||
SELECT
|
||||
customers.*,
|
||||
|
||||
emails.email,
|
||||
|
||||
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
|
||||
|
||||
LEFT 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
|
||||
|
||||
ORDER BY shipping.last_name, shipping.first_name
|
||||
|
||||
;
|
||||
';
|
||||
|
||||
$this->setPublic('customers', $this->db->getArray($sql));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,59 +0,0 @@
|
|||
<?php
|
||||
|
||||
class store_admin_customers_edit extends store_admin {
|
||||
|
||||
protected $display = array(DISPLAY_SMARTY, DISPLAY_JSON);
|
||||
|
||||
public function __default() {
|
||||
|
||||
if (isset($_REQUEST['id'])) {
|
||||
$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
|
||||
|
||||
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
|
||||
|
||||
WHERE customers.id = "' . $_REQUEST['id'] . '";
|
||||
';
|
||||
|
||||
$this->setPublic('customer', $this->db->getRow($sql));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,147 +0,0 @@
|
|||
<?php
|
||||
|
||||
class store_admin_customers_save extends store_admin {
|
||||
|
||||
protected $display = DISPLAY_JSON;
|
||||
|
||||
public function __default() {
|
||||
|
||||
$update_password = false;
|
||||
|
||||
if (isset($_REQUEST['password']) && trim($_REQUEST['password']) != '') {
|
||||
if ($_REQUEST['password'] != $_REQUEST['password_verify']) {
|
||||
$this->setPublic('status', 'Error');
|
||||
$this->setPublic('message', 'The password and verification do not match.');
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
$update_password = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Adds the billing information into the database
|
||||
if (isset($_REQUEST['billing_address1']) && trim($_REQUEST['billing_address1']) != '') {
|
||||
$billing_address = array(
|
||||
'company' => $_REQUEST['billing_company'],
|
||||
'first_name' => $_REQUEST['billing_first_name'],
|
||||
'last_name' => $_REQUEST['billing_last_name'],
|
||||
'address1' => $_REQUEST['billing_address1'],
|
||||
'address2' => $_REQUEST['billing_address2'],
|
||||
'city' => $_REQUEST['billing_city'],
|
||||
'state' => $_REQUEST['billing_state'],
|
||||
'zip_code' => $_REQUEST['billing_zip_code'],
|
||||
'country' => 'US',
|
||||
'phone' => $_REQUEST['billing_phone'],
|
||||
'fax' => $_REQUEST['billing_fax']
|
||||
);
|
||||
|
||||
$billing_address['hash'] = md5(implode('', $billing_address));
|
||||
|
||||
if ($this->db->getField("SELECT COUNT(*) FROM addresses WHERE hash = '{$billing_address['hash']}';") == 0) {
|
||||
$billing_address_id = $this->db->insert('addresses', $billing_address);
|
||||
}
|
||||
else {
|
||||
$billing_address = $this->db->getRow("SELECT * FROM addresses WHERE hash = '{$billing_address['hash']}';");
|
||||
$billing_address_id = $billing_address['id'];
|
||||
}
|
||||
}
|
||||
|
||||
// Adds the shipping information into the database
|
||||
$shipping_address_id = null;
|
||||
|
||||
if (isset($_REQUEST['shipping_same_as_billing']) && $_REQUEST['shipping_same_as_billing'] == 'on') {
|
||||
$shipping_address_id = $billing_address_id;
|
||||
$shipping_address = $billing_address;
|
||||
}
|
||||
else if (isset($_REQUEST['shipping_address1']) && trim($_REQUEST['shipping_address1']) != '') {
|
||||
$shipping_address = array(
|
||||
'company' => $_REQUEST['shipping_company'],
|
||||
'first_name' => $_REQUEST['shipping_first_name'],
|
||||
'last_name' => $_REQUEST['shipping_last_name'],
|
||||
'address1' => $_REQUEST['shipping_address1'],
|
||||
'address2' => $_REQUEST['shipping_address2'],
|
||||
'city' => $_REQUEST['shipping_city'],
|
||||
'state' => $_REQUEST['shipping_state'],
|
||||
'zip_code' => $_REQUEST['shipping_zip_code'],
|
||||
'country' => 'US',
|
||||
'phone' => $_REQUEST['shipping_phone'],
|
||||
'fax' => $_REQUEST['shipping_fax']
|
||||
);
|
||||
|
||||
$shipping_address['hash'] = md5(implode('', $shipping_address));
|
||||
|
||||
if ($this->db->getField("SELECT COUNT(*) FROM addresses WHERE hash = '{$shipping_address['hash']}';") == 0) {
|
||||
$shipping_address_id = $this->db->insert('addresses', $shipping_address);
|
||||
}
|
||||
else {
|
||||
$shipping_address = $this->db->getRow("SELECT * FROM addresses WHERE hash = '{$shipping_address['hash']}';");
|
||||
$shipping_address_id = $shipping_address['id'];
|
||||
}
|
||||
}
|
||||
|
||||
// Adds the customer's email into the email database
|
||||
if (isset($_REQUEST['email']) && trim($_REQUEST['email']) != '') {
|
||||
$email = $_REQUEST['email'];
|
||||
|
||||
if ($this->db->getField("SELECT COUNT(*) FROM emails WHERE email = '{$email}';") == 0) {
|
||||
$email_id = $this->db->insert('emails', array('email' => $email));
|
||||
}
|
||||
else {
|
||||
$email_id = $this->db->getField("SELECT id FROM emails WHERE email = '{$email}';");
|
||||
}
|
||||
}
|
||||
|
||||
// Updates the existing customer
|
||||
if (isset($_REQUEST['id'])) {
|
||||
|
||||
$customer = array(
|
||||
'email_id' => $email_id,
|
||||
'billing_address_id' => $billing_address_id,
|
||||
'shipping_address_id' => $shipping_address_id
|
||||
);
|
||||
|
||||
if ($update_password == true) {
|
||||
$customer['password'] = md5($_REQUEST['password']);
|
||||
}
|
||||
|
||||
$this->db->update('customers', $customer, array('id' => $_REQUEST['id']));
|
||||
|
||||
if ($this->error->getErrors()) {
|
||||
$this->setPublic('status', 'Error');
|
||||
$this->setPublic('message', 'There was an error updating the customer account (' . implode('. ', $this->error->getErrors()) . '.)');
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
$this->setPublic('status', 'Success');
|
||||
$this->setPublic('message', 'The customer information has been updated successfully.');
|
||||
}
|
||||
}
|
||||
// Adds a brand new affiliate
|
||||
else {
|
||||
$customer = array(
|
||||
'email_id' => $email_id,
|
||||
'password' => md5($_REQUEST['password']),
|
||||
'billing_address_id' => $billing_address_id,
|
||||
'shipping_address_id' => $shipping_address_id,
|
||||
'created_at' => time()
|
||||
);
|
||||
|
||||
$customer_id = $this->db->insert('customers', $customer);
|
||||
|
||||
if ($this->error->getErrors()) {
|
||||
$this->setPublic('status', 'Error');
|
||||
$this->setPublic('message', 'There was an error adding the customer account (' . implode('. ', $this->error->getErrors()) . '.)');
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
// @todo Leverage sign up code and reuse here
|
||||
//mail($_REQUEST['email'], 'Welcome to the ' . $this->config->store->title . ' Affiliate Program', $customer_message, 'From: ' . $this->config->store->return_email);
|
||||
|
||||
$this->setPublic('status', 'Success');
|
||||
$this->setPublic('message', 'The new customer has been added successfully.');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,17 +0,0 @@
|
|||
<?php
|
||||
|
||||
class store_admin_discounts extends store_admin {
|
||||
|
||||
public function __default() {
|
||||
$sql = '
|
||||
SELECT d1.*
|
||||
FROM discounts AS d1
|
||||
WHERE d1.sequence = (SELECT MAX(sequence) FROM discounts WHERE id = d1.id)
|
||||
ORDER BY valid_through;
|
||||
';
|
||||
|
||||
$this->setPublic('discounts', $this->db->getArray($sql));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,70 +0,0 @@
|
|||
<?php
|
||||
|
||||
class store_admin_discounts_edit extends store_admin {
|
||||
|
||||
protected $display = array(DISPLAY_SMARTY, DISPLAY_JSON);
|
||||
|
||||
public function __default() {
|
||||
|
||||
$sql = '
|
||||
SELECT c.id, CONCAT(a.last_name, ", ", a.first_name) AS name
|
||||
FROM customers AS c
|
||||
INNER JOIN addresses AS a
|
||||
ON c.shipping_address_id = a.id;
|
||||
';
|
||||
$this->setPublic('customers', $this->flattenArray($this->db->getArray($sql)));
|
||||
$this->setPublic('categories', $this->flattenArray($this->db->getArray('SELECT id, name FROM categories;')));
|
||||
$this->setPublic('products', $this->flattenArray($this->db->getArray('SELECT id, name FROM products;')));
|
||||
|
||||
$this->setPublic('applied_to_options', array('ORDER' => 'Order', 'PRODUCT' => 'Product', 'SHIPPING' => 'Shipping'));
|
||||
$this->setPublic('amount_type_options', array('FLAT' => 'Flat $ Amount', 'PERCENT' => '% of Applied To' ));
|
||||
|
||||
if (isset($_REQUEST['id'])) {
|
||||
$discount = $this->db->getRow('SELECT * FROM discounts WHERE id = "' . $_REQUEST['id'] . '" ORDER BY sequence DESC LIMIT 1;');
|
||||
$this->setPublic('discount', $discount);
|
||||
|
||||
$sql = '
|
||||
SELECT *
|
||||
FROM discount_rules
|
||||
WHERE discount_id = "' . $discount['id'] . '"
|
||||
AND sequence = "' . $discount['sequence'] . '"
|
||||
ORDER BY id;
|
||||
';
|
||||
$this->setPublic('rules', $this->db->getArray($sql));
|
||||
|
||||
$sql = '
|
||||
SELECT *
|
||||
FROM discount_xref
|
||||
WHERE discount_id = "' . $discount['id'] . '"
|
||||
AND sequence = "' . $discount['sequence'] . '"
|
||||
ORDER BY id;
|
||||
';
|
||||
$xrefs = $this->db->getArray($sql);
|
||||
|
||||
$xrefs_grouped = array('CUSTOMER' => array(), 'CATEGORY' => array(), 'PRODUCT' => array());
|
||||
|
||||
if (is_array($xrefs)) {
|
||||
foreach ($xrefs as $xref) {
|
||||
// @todo There's currently no code to handle exclusions
|
||||
if ($xref['eligible'] == 'Y') {
|
||||
$xrefs_grouped[$xref['type']][] = $xref['xref_id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->setPublic('xrefs', $xrefs_grouped);
|
||||
}
|
||||
}
|
||||
|
||||
private function flattenArray($array) {
|
||||
$formatted_array = array();
|
||||
|
||||
foreach ($array as $temp) {
|
||||
$formatted_array[$temp['id']] = $temp['name'];
|
||||
}
|
||||
|
||||
return $formatted_array;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,94 +0,0 @@
|
|||
<?php
|
||||
|
||||
class store_admin_discounts_save extends store_admin {
|
||||
|
||||
protected $display = DISPLAY_JSON;
|
||||
|
||||
public function __default() {
|
||||
|
||||
$discount = array(
|
||||
'name' => $_REQUEST['name'],
|
||||
'coupon' => $_REQUEST['coupon'],
|
||||
'description' => $_REQUEST['description'],
|
||||
'all_customers' => 'Y',
|
||||
'all_categories' => 'N',
|
||||
'all_products' => 'N',
|
||||
'combinable' => 'N',
|
||||
'valid_from' => $_REQUEST['valid_from_Year'] . '-' . $_REQUEST['valid_from_Month'] . '-' . $_REQUEST['valid_from_Day'],
|
||||
'valid_through' => $_REQUEST['valid_through_Year'] . '-' . $_REQUEST['valid_through_Month'] . '-' . $_REQUEST['valid_through_Day'],
|
||||
'max_customer_usage' => $_REQUEST['max_customer_usage'],
|
||||
'max_order_usage' => $_REQUEST['max_order_usage'],
|
||||
'usage_count' => $_REQUEST['usage_count'] == '' ? '0' : $_REQUEST['usage_count'], // @TODO zero is quoted to get around a bug.
|
||||
'remaining_usages' => $_REQUEST['remaining_usages'] == 'unlimited' ? null : $_REQUEST['remaining_usages_count']
|
||||
);
|
||||
|
||||
// Updates the existing discount
|
||||
if (isset($_REQUEST['id'])) {
|
||||
|
||||
// Checks for changes @todo
|
||||
|
||||
// Increments the sequence number
|
||||
$sequence = $this->db->getField('SELECT MAX(sequence) + 1 FROM discounts WHERE id = "' . $_REQUEST['id'] . '";');
|
||||
|
||||
// Inserts row into the discount table
|
||||
$discount['id'] = $_REQUEST['id'];
|
||||
$discount['sequence'] = $sequence;
|
||||
$this->db->insert('discounts', $discount);
|
||||
|
||||
$verb = 'updating';
|
||||
$past = 'updated';
|
||||
}
|
||||
// Adds a brand new discount
|
||||
else {
|
||||
$discount['id'] = $this->db->insert('discounts', $discount);
|
||||
$discount['sequence'] = '0';
|
||||
|
||||
$verb = 'adding';
|
||||
$past = 'added';
|
||||
}
|
||||
|
||||
// Inserts one or more rows into the discount_rules table
|
||||
$discount_rules = array(
|
||||
'discount_id' => $discount['id'],
|
||||
'sequence' => $discount['sequence'],
|
||||
'applied_to' => $_REQUEST['applied_to'],
|
||||
'amount' => $_REQUEST['amount'],
|
||||
'amount_type' => $_REQUEST['amount_type'],
|
||||
'min_subtotal' => $_REQUEST['min_subtotal'],
|
||||
'min_items' => $_REQUEST['min_items'],
|
||||
'max_discount' => $_REQUEST['max_discount']
|
||||
);
|
||||
$this->db->insert('discount_rules', $discount_rules);
|
||||
|
||||
/*
|
||||
$this->setPublic('status', 'Error');
|
||||
$this->setPublic('message', print_r($_REQUEST, true));
|
||||
return false;
|
||||
*/
|
||||
|
||||
// Inserts one or more rows into the discount_xref table
|
||||
foreach ($_REQUEST['products'] as $product_id) {
|
||||
$discount_xref = array(
|
||||
'discount_id' => $discount['id'],
|
||||
'sequence' => $discount['sequence'],
|
||||
'type' => 'PRODUCT',
|
||||
'xref_id' => $product_id,
|
||||
'eligible' => 'Y',
|
||||
'exclusion' => 'N'
|
||||
);
|
||||
$this->db->insert('discount_xref', $discount_xref);
|
||||
}
|
||||
|
||||
if ($this->error->getErrors()) {
|
||||
$this->setPublic('status', 'Error');
|
||||
$this->setPublic('message', 'There was an error ' . $verb . ' the discount (' . implode('. ', $this->error->getErrors()) . '.)');
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
$this->setPublic('status', 'Success');
|
||||
$this->setPublic('message', 'The new discount has been ' . $past . ' successfully.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
|
||||
class store_admin_gift_certificates extends store_admin {
|
||||
|
||||
public function __default() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,23 +0,0 @@
|
|||
<?php
|
||||
|
||||
class store_admin_home extends store_admin {
|
||||
|
||||
public function __default() {
|
||||
|
||||
$sql = '
|
||||
SELECT
|
||||
(SELECT COUNT(id) FROM orders WHERE DATE_FORMAT(time_placed, "%Y%m%d") = DATE_FORMAT(CURDATE(), "%Y%m%d")) AS orders_today,
|
||||
(SELECT COUNT(id) FROM orders WHERE DATE_FORMAT(time_placed, "%Y%m") = DATE_FORMAT(CURDATE(), "%Y%m")) AS orders_mtd,
|
||||
(SELECT COUNT(id) FROM orders WHERE DATE_FORMAT(time_placed, "%Y") = DATE_FORMAT(CURDATE(), "%Y")) AS orders_ytd,
|
||||
|
||||
(SELECT SUM(total_amount) - SUM(shipping_amount) FROM orders WHERE DATE_FORMAT(time_placed, "%Y%m%d") = DATE_FORMAT(CURDATE(), "%Y%m%d")) AS sales_today,
|
||||
(SELECT SUM(total_amount) - SUM(shipping_amount) FROM orders WHERE DATE_FORMAT(time_placed, "%Y%m") = DATE_FORMAT(CURDATE(), "%Y%m")) AS sales_mtd,
|
||||
(SELECT SUM(total_amount) - SUM(shipping_amount) FROM orders WHERE DATE_FORMAT(time_placed, "%Y") = DATE_FORMAT(CURDATE(), "%Y")) AS sales_ytd,
|
||||
(SELECT COUNT(id) FROM customers) AS total_customers;
|
||||
';
|
||||
|
||||
$this->setPublic('statistics', $this->db->getRow($sql));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,66 +0,0 @@
|
|||
<?php
|
||||
|
||||
class store_admin_orders extends store_admin {
|
||||
|
||||
public function __default() {
|
||||
|
||||
$where = null;
|
||||
|
||||
if (isset($_REQUEST['filter'])) {
|
||||
// Validates the filter
|
||||
$status = $this->db->getRow('SELECT id, name FROM order_statuses WHERE LOWER(name) = LOWER("' . str_replace('-', ' ', $_REQUEST['filter']) . '")');
|
||||
|
||||
if ($status != null) {
|
||||
$where = 'WHERE osu.status_id = "' . $status['id'] . '"';
|
||||
|
||||
$this->setPublic('filter', $status['name']);
|
||||
}
|
||||
}
|
||||
|
||||
$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
|
||||
|
||||
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 . '
|
||||
|
||||
ORDER BY o.id DESC;
|
||||
';
|
||||
|
||||
$this->setPublic('orders', $this->db->getArray($sql));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,128 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* @todo Add discounts to the order view
|
||||
* @todo Collapse the updates to the latest 3-5 and then have a "more" option
|
||||
*/
|
||||
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,
|
||||
CONCAT(os.id, "|", os.name) AS status_id,
|
||||
osu.note AS shipping_note,
|
||||
osu.update_time AS last_update,
|
||||
o.transaction_id,
|
||||
CONCAT(s.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.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);
|
||||
|
||||
$sql = 'SELECT * FROM order_status_updates WHERE order_id = "' . $_REQUEST['id'] . '" ORDER BY update_time DESC;';
|
||||
|
||||
$order['updates'] = $this->db->getArray($sql);
|
||||
|
||||
$this->setPublic('order', $order);
|
||||
$this->setPublic('serialized_order', serialize($order));
|
||||
|
||||
foreach ($this->db->getArray('SELECT * FROM order_statuses;') as $status) {
|
||||
$statuses[$status['id']] = $status['name'];
|
||||
$status_options[$status['id'] . '|' . $status['name']] = $status['name'];
|
||||
}
|
||||
|
||||
$this->setPublic('statuses', $statuses);
|
||||
$this->setPublic('status_options', $status_options);
|
||||
|
||||
foreach ($this->db->getArray('SELECT * FROM shipping;') as $shipping_method) {
|
||||
$shipping_methods[$status['id']] = $status['name'];
|
||||
$shipping_method_options[$shipping_method['id'] . '|' . $shipping_method['name']] = $shipping_method['name'];
|
||||
}
|
||||
|
||||
$this->setPublic('shipping_methods', $shipping_methods);
|
||||
$this->setPublic('shipping_method_options', $shipping_method_options);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,18 +0,0 @@
|
|||
<?php
|
||||
|
||||
class store_admin_orders_print extends store_admin {
|
||||
|
||||
protected $display = DISPLAY_JSON;
|
||||
|
||||
public function __default() {
|
||||
$saver = new store_admin_orders_save($this->config, $this->db, $this->mailer, $this->error);
|
||||
$saver->__default();
|
||||
|
||||
$this->setPublic('packing_slip', nl2br($saver->packing_slip));
|
||||
|
||||
$this->setPublic('status', 'Success');
|
||||
$this->setPublic('message', 'The order has been updated successfully.');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,50 +0,0 @@
|
|||
<?php
|
||||
|
||||
class store_admin_orders_save extends store_admin {
|
||||
|
||||
protected $display = DISPLAY_JSON;
|
||||
|
||||
public function __default() {
|
||||
|
||||
// Breaks apart the status into the ID and text
|
||||
list($status_id, $status) = split('\|', $_REQUEST['status']);
|
||||
|
||||
// Breaks apart the shipping method into the ID and text
|
||||
list($shipping_id, $shipping_method) = split('\|', $_REQUEST['shipping_method']);
|
||||
|
||||
// Update orders.shipping_id, orders.shipping_note, orders.tracking_number
|
||||
$this->db->execute('
|
||||
UPDATE orders
|
||||
SET
|
||||
shipping_id = "' . $shipping_id . '",
|
||||
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, note, update_time
|
||||
) VALUES (
|
||||
"' . $_REQUEST['id'] . '",
|
||||
"' . $_SESSION['user_id'] . '",
|
||||
"' . $status_id . '",
|
||||
"' . $_REQUEST['shipping_note'] . '",
|
||||
NOW()
|
||||
);
|
||||
');
|
||||
|
||||
// Generates the email to the customer and the packing slip
|
||||
$sender = new store_admin_orders_send($this->config, $this->db, $this->mailer, $this->error);
|
||||
|
||||
// Sends the message to the customer
|
||||
$sender->send($status_id, $status, $shipping_id, $shipping_method, $_REQUEST['shipping_note']);
|
||||
|
||||
$this->packing_slip = $sender->packing_slip;
|
||||
|
||||
$this->setPublic('status', 'Success');
|
||||
$this->setPublic('message', 'The order has been updated successfully.');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,170 +0,0 @@
|
|||
<?php
|
||||
|
||||
// @todo add logic to determine which name to use, eg. if no billing, use shipping
|
||||
|
||||
class store_admin_orders_send extends store_admin {
|
||||
|
||||
protected $display = DISPLAY_JSON;
|
||||
|
||||
public function __default() {
|
||||
|
||||
$this->send();
|
||||
}
|
||||
|
||||
public function send($status_id = null, $status = null, $shipping_id = null, $shipping_method = null, $shipping_note = null) {
|
||||
|
||||
// Unserializes the order so we can use it
|
||||
$order = unserialize(urldecode($_REQUEST['order']));
|
||||
|
||||
if (!isset($status_id, $status, $shipping_id, $shipping_method)) {
|
||||
|
||||
// Breaks apart the status into the ID and text
|
||||
list($status_id, $status) = split('\|', $order['status_id']);
|
||||
|
||||
// Breaks apart the shipping method into the ID and text
|
||||
list($shipping_id, $shipping_method) = split('\|', $order['shipping_method']);
|
||||
|
||||
$shipping_note = $order['shipping_note'];
|
||||
}
|
||||
|
||||
// Grabs the date
|
||||
$date = date('m/d/Y');
|
||||
|
||||
// Builds the message
|
||||
$message = "
|
||||
{$this->config->store->title}
|
||||
-------------------------------------------------------------------
|
||||
|
||||
Dear {$order['shipping_first_name']} {$order['shipping_last_name']},
|
||||
|
||||
This is an automatic email to let you know that your order was marked as {$status} on: {$date}
|
||||
|
||||
Order Number: {$_REQUEST['id']}";
|
||||
|
||||
if ($status_id == 4) {
|
||||
$message .= "
|
||||
Completion Date: {$date}
|
||||
Ship Via: {$shipping_method}
|
||||
Tracking #: {$_REQUEST['tracking_number']}
|
||||
|
||||
Shipped to:
|
||||
---------------------------";
|
||||
|
||||
if (trim($order['shipping_company']) != '') {
|
||||
$message .= "
|
||||
{$order['shipping_company']}";
|
||||
}
|
||||
|
||||
$message .= "
|
||||
{$order['shipping_first_name']} {$order['shipping_last_name']}
|
||||
{$order['shipping_address1']}";
|
||||
|
||||
if (trim($order['shipping_address2']) != '') {
|
||||
$message .= "
|
||||
{$order['shipping_address2']}";
|
||||
}
|
||||
|
||||
$message .= "
|
||||
{$order['shipping_city']}, {$order['shipping_state']} {$order['shipping_zip_code']}";
|
||||
}
|
||||
|
||||
$message .= "
|
||||
|
||||
Order Summary
|
||||
---------------------------
|
||||
";
|
||||
|
||||
$total_items = 0;
|
||||
|
||||
$packing_slip_rows = null;
|
||||
|
||||
// Loops through products
|
||||
foreach ($order['products'] as $product) {
|
||||
$message .= "
|
||||
{$product['quantity']} - [{$product['sku']}] {$product['name']} {$product['description']} @ \${$product['price']} each";
|
||||
|
||||
$packing_slip_rows .= "<tr><td class='center'>{$product['quantity']}</td><td class='center'>{$product['sku']}</td><td>{$product['name']} {$product['description']}</td></tr>";
|
||||
|
||||
$total_items += $product['quantity'];
|
||||
}
|
||||
|
||||
$message .= "
|
||||
|
||||
--
|
||||
{$total_items}: Total Items";
|
||||
|
||||
if ($status_id == 4) {
|
||||
$message .= "
|
||||
|
||||
According to our records, this order is now complete.";
|
||||
}
|
||||
|
||||
if (trim($_REQUEST['shipping_note']) != '') {
|
||||
$message .= "
|
||||
|
||||
Additional Notes
|
||||
---------------------------
|
||||
{$shipping_note}";
|
||||
}
|
||||
|
||||
$message .= "
|
||||
|
||||
------------------
|
||||
|
||||
Thank you for your interest in {$this->config->store->title}
|
||||
|
||||
{$this->config->store->title}
|
||||
Phone: {$this->config->store->phone}
|
||||
Fax: {$this->config->store->fax}
|
||||
URL: {$this->config->store->url}
|
||||
";
|
||||
|
||||
if ($_REQUEST['email_customer'] == 'on') {
|
||||
mail($_REQUEST['email'], $this->config->store->title . ' - Order #' . $_REQUEST['id'] . ' - ' . $status, $message, 'From: ' . $this->config->store->return_email);
|
||||
mail('josh.sherman@gmail.com, dekin@ribbonnutrition.com', 'CC: ' . $this->config->store->title . ' - Order #' . $_REQUEST['id'] . ' - ' . $status, $message, 'From: ' . $this->config->store->return_email);
|
||||
}
|
||||
|
||||
$this->packing_slip = str_replace("\n", "", "
|
||||
<h2>{$this->config->store->title} — Packing Slip</h2>
|
||||
<table class='packing-slip'>
|
||||
<tr>
|
||||
<td width='50%'>
|
||||
<h3>*{$_REQUEST['tracking_number']}*</h3><br />
|
||||
" . ($order['total_amount'] > 0 ? "
|
||||
<b>BILL TO</b><br /><br />
|
||||
" . (trim($order['billing_company']) != '' ? $order['billing_company'] . '<br />' : '') . "
|
||||
{$order['billing_first_name']} {$order['billing_last_name']}<br />
|
||||
{$order['billing_address1']}<br />
|
||||
" . (trim($order['billing_address2']) != '' ? $order['billing_address2'] . '<br />' : '') . "
|
||||
{$order['billing_city']}, {$order['billing_state']} {$order['billing_zip_code']}<br /><br />
|
||||
{$order['billing_phone']}<br /><br />" : '') . "
|
||||
</td>
|
||||
<td width='50%'>
|
||||
<h3>{$shipping_method}</h3><br />
|
||||
<b>SHIP TO</b><br /><br />
|
||||
" . (trim($order['shipping_company']) != '' ? $order['shipping_company'] . '<br />' : '') . "
|
||||
{$order['shipping_first_name']} {$order['shipping_last_name']}<br />
|
||||
{$order['shipping_address1']}<br />
|
||||
" . (trim($order['shipping_address2']) != '' ? $order['shipping_address2'] . '<br />' : '') . "
|
||||
{$order['shipping_city']}, {$order['shipping_state']} {$order['shipping_zip_code']}<br /><br />
|
||||
{$order['shipping_phone']}<br /><br />
|
||||
{$_REQUEST['email']}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class='packing-slip'>
|
||||
<tr>
|
||||
<th class='center'>Qty</th>
|
||||
<th class='center'>SKU</th>
|
||||
<th>Product Name</th>
|
||||
</tr>
|
||||
{$packing_slip_rows}
|
||||
</table>
|
||||
");
|
||||
|
||||
$this->setPublic('status', 'Success');
|
||||
$this->setPublic('message', 'The latest update has been successfully resent to the customer.');
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,16 +0,0 @@
|
|||
<?php
|
||||
|
||||
class store_admin_products extends store_admin {
|
||||
|
||||
public function __default() {
|
||||
$sql = '
|
||||
SELECT DISTINCT id, sku, name, price, in_stock
|
||||
FROM products
|
||||
ORDER BY sequence DESC;
|
||||
';
|
||||
|
||||
$this->setPublic('products', $this->db->getArray($sql));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,59 +0,0 @@
|
|||
<?php
|
||||
|
||||
class store_admin_products_edit extends store_admin {
|
||||
|
||||
protected $display = array(DISPLAY_SMARTY, DISPLAY_JSON);
|
||||
|
||||
public function __default() {
|
||||
|
||||
if (isset($_REQUEST['id'])) {
|
||||
$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
|
||||
|
||||
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
|
||||
|
||||
WHERE customers.id = "' . $_REQUEST['id'] . '";
|
||||
';
|
||||
|
||||
$this->setPublic('customer', $this->db->getRow($sql));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
|
||||
class store_admin_reports extends store_admin {
|
||||
|
||||
public function __default() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
|
||||
class store_admin_settings extends store_admin {
|
||||
|
||||
public function __default() {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,93 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Store cart view
|
||||
*
|
||||
* Displays the contents of the shopping cart and gives the user the
|
||||
* ability to update quantities, remove items, apply discount codes and
|
||||
* proceed to the checkout.
|
||||
*
|
||||
* @package PICKLES
|
||||
* @subpackage store
|
||||
* @author Joshua Sherman <josh@phpwithpickles.org>
|
||||
* @copyright 2007-2008 Joshua Sherman
|
||||
*/
|
||||
|
||||
class store_cart extends store {
|
||||
|
||||
protected $display = DISPLAY_SMARTY;
|
||||
|
||||
public function __default() {
|
||||
|
||||
if (isset($_SESSION['cart'])) {
|
||||
$this->setPublic('cart', $_SESSION['cart']);
|
||||
}
|
||||
|
||||
$discounts = null;
|
||||
|
||||
if (isset($_SESSION['cart']['discounts']) && is_array($_SESSION['cart']['discounts'])) {
|
||||
|
||||
foreach ($_SESSION['cart']['discounts'] as $code => $discount) {
|
||||
|
||||
if (isset($discount['rules']) && is_array($discount['rules'])) {
|
||||
|
||||
foreach ($discount['rules'] as $rule) {
|
||||
|
||||
switch ($rule['applied_to']) {
|
||||
case 'ORDER':
|
||||
// Takes the discount from the subtotal
|
||||
break;
|
||||
|
||||
case 'PRODUCT':
|
||||
// Takes the discount from the product
|
||||
if (isset($discount['xref']) && is_array($discount['xref'])) {
|
||||
foreach ($discount['xref'] as $xref) {
|
||||
switch ($xref['type']) {
|
||||
case 'CATEGORY':
|
||||
break;
|
||||
|
||||
case 'CUSTOMER':
|
||||
break;
|
||||
|
||||
case 'PRODUCT':
|
||||
// Checks if the product referenced is in the cart
|
||||
if (array_key_exists($xref['xref_id'], $_SESSION['cart']['products'])) {
|
||||
$quantity = $_SESSION['cart']['products'][$xref['xref_id']]['quantity'];
|
||||
|
||||
$total = $_SESSION['cart']['products'][$xref['xref_id']]['total'];
|
||||
$price = $_SESSION['cart']['products'][$xref['xref_id']]['price'];
|
||||
|
||||
switch ($rule['amount_type']) {
|
||||
case 'FLAT':
|
||||
break;
|
||||
|
||||
case 'PERCENT':
|
||||
$discounts[$xref['xref_id']]['price'] = round($price * ($rule['amount'] * 0.01), 2);
|
||||
$discounts[$xref['xref_id']]['total'] = $discounts[$xref['xref_id']]['price'] * $quantity;
|
||||
break;
|
||||
}
|
||||
var_dump($discounts);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case 'SHIPPING':
|
||||
// Takes the discount from the shipping
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->setPublic('discounts', $discounts);
|
||||
|
||||
//var_dump($_SESSION['cart']);
|
||||
//var_dump($_SESSION['cart']['discounts']['inPink']);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,125 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Adds an item to the cart
|
||||
*
|
||||
* Adds the passed item to the cart with a quantity of 1.
|
||||
*
|
||||
* @package PICKLES
|
||||
* @subpackage store
|
||||
* @author Joshua Sherman <josh@phpwithpickles.org>
|
||||
* @copyright 2007, 2008, 2009 Joshua Sherman
|
||||
*/
|
||||
|
||||
class store_cart_add extends store {
|
||||
|
||||
public function __default() {
|
||||
|
||||
if ($this->db->getField('SELECT COUNT(id) FROM products WHERE id = "' . $_REQUEST['id'] . '";') != 1) {
|
||||
/**
|
||||
* @todo Add handling for an invalid product
|
||||
*/
|
||||
}
|
||||
else {
|
||||
// References the product in the cart
|
||||
$product =& $_SESSION['cart']['products'][$_REQUEST['id']];
|
||||
|
||||
// If the data is not set then grab it and set it
|
||||
if (!isset($product['name'], $product['sku'], $product['price'])) {
|
||||
$data = $this->db->getRow('
|
||||
SELECT sku, name, description, price, limit_per_customer
|
||||
FROM products
|
||||
WHERE id ="' . $_REQUEST['id'] . '";
|
||||
');
|
||||
|
||||
$product['sku'] = $data['sku'];
|
||||
$product['name'] = $data['name'] . ' ' . $data['description'];
|
||||
$product['description'] = $data['description'];
|
||||
$product['price'] = $data['price'];
|
||||
$product['limit_per_customer'] = $data['limit_per_customer'];
|
||||
|
||||
$product['discounts'] = $this->db->getArray('
|
||||
SELECT discounts.* , discount_rules.*
|
||||
FROM discounts
|
||||
INNER JOIN discount_xref ON discounts.id = discount_xref.discount_id
|
||||
INNER JOIN discount_rules ON discounts.id = discount_rules.discount_id
|
||||
WHERE discount_xref.xref_id = "' . $_REQUEST['id'] . '"
|
||||
AND discounts.disabled = "N";
|
||||
');
|
||||
|
||||
// @todo Should do a look up on the shipping table
|
||||
// @todo Not sure how we want to handle flat rate shipping
|
||||
$product['shipping'] = 4.99;
|
||||
|
||||
if (is_array($product['discounts'])) {
|
||||
foreach ($product['discounts'] as $discount) {
|
||||
|
||||
switch ($discount['applied_to']) {
|
||||
|
||||
case 'SHIPPING':
|
||||
switch ($discount['amount_type']) {
|
||||
case 'FLAT':
|
||||
if ($product['shipping'] < $discount['amount']) {
|
||||
$discount['amount'] = $product['shipping'];
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'PERCENT':
|
||||
if ($discount['amount'] > 100) {
|
||||
$discount['amount'] = 100;
|
||||
}
|
||||
|
||||
$discount['amount'] = $product['shipping'] * ($discount['amount'] / 100);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
$product['shipping'] -= $discount['amount'];
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Increment the quantity and update the total
|
||||
// @todo Add per customer limits across all orders.
|
||||
if (empty($product['quantity']) || $product['limit_per_customer'] == 0 || $product['quantity'] < $product['limit_per_customer']) {
|
||||
if (empty($product['quantity'])) {
|
||||
$product['quantity'] = 0;
|
||||
}
|
||||
|
||||
$increment = isset($_REQUEST['quantity']) && preg_match('/^[0-9]+$/', $_REQUEST['quantity']) && trim($_REQUEST['quantity']) != '' ? $_REQUEST['quantity'] : 1;
|
||||
$product['quantity'] += $increment;
|
||||
$product['total'] = round($product['price'] * $product['quantity'], 2);
|
||||
}
|
||||
|
||||
unset($product);
|
||||
|
||||
// References the cart as a whole
|
||||
$cart =& $_SESSION['cart'];
|
||||
$subtotal = 0;
|
||||
$shipping = 0;
|
||||
|
||||
// Loops through the products and totals them up
|
||||
if (is_array($cart['products'])) {
|
||||
foreach ($cart['products'] as $product) {
|
||||
$subtotal += $product['total'];
|
||||
$shipping += $product['shipping'];
|
||||
}
|
||||
}
|
||||
|
||||
// Set the subtotal in the cart
|
||||
$cart['subtotal'] = round($subtotal, 2);
|
||||
$cart['shipping'] = round($shipping, 2);
|
||||
unset($cart);
|
||||
|
||||
// Redirect to the cart
|
||||
header('Location: /store/cart');
|
||||
//exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,113 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Applies a discount to the cart
|
||||
*
|
||||
* @package PICKLES
|
||||
* @subpackage store
|
||||
* @author Joshua Sherman <josh@phpwithpickles.org>
|
||||
* @copyright 2007-2008 Joshua Sherman
|
||||
*/
|
||||
|
||||
class store_cart_discount_apply extends store {
|
||||
|
||||
public function __default() {
|
||||
|
||||
$error = false;
|
||||
$coupon = $_POST['coupon'];
|
||||
|
||||
try {
|
||||
if (trim($coupon) == '') {
|
||||
throw new Exception('is blank');
|
||||
}
|
||||
|
||||
// Check if the discount is already in the cart
|
||||
if (in_array($coupon, $_SESSION['cart']['discounts'])) {
|
||||
throw new Exception('has already been applied');
|
||||
}
|
||||
|
||||
// Pulls the discount from the database (null if it's not there)
|
||||
$discount = $this->db->getRow("
|
||||
SELECT
|
||||
id,
|
||||
name,
|
||||
all_products,
|
||||
all_categories,
|
||||
all_customers,
|
||||
combinable,
|
||||
valid_from,
|
||||
valid_through,
|
||||
max_customer_usage,
|
||||
max_order_usage,
|
||||
usage_count,
|
||||
remaining_usages,
|
||||
disabled
|
||||
FROM
|
||||
discounts
|
||||
WHERE
|
||||
coupon = '{$coupon}';
|
||||
");
|
||||
|
||||
if ($discount == null) {
|
||||
throw new Exception('was not found.');
|
||||
}
|
||||
|
||||
// Check combinability against if another discount is in the session
|
||||
|
||||
// Checks if the discount is being used during the right time
|
||||
if (isset($valid_from) || isset($valid_through)) {
|
||||
$today = date('Y-m-d');
|
||||
|
||||
if ($today < $valid_from) {
|
||||
throw new Exception('is associated with a promotion that has not yet started.');
|
||||
}
|
||||
else if ($today > $valid_through) {
|
||||
throw new Exception('has expired.');
|
||||
}
|
||||
}
|
||||
|
||||
// @todo
|
||||
// check if the customer already used the coupon on a previous order
|
||||
// check if the customer already used the coupon this order
|
||||
|
||||
// Checks if the discount still has remaining usages
|
||||
if ($discount['remaining_usages'] <= 0) {
|
||||
throw new Exception('has no more remaining usages');
|
||||
}
|
||||
|
||||
// Checks if the discount is disabled
|
||||
if ($discount['disabled'] == 'Y') {
|
||||
throw new Exception('is currently disabled');
|
||||
}
|
||||
|
||||
// Pulls any associated discount rules
|
||||
$discount['rules'] = $this->db->getArray("
|
||||
SELECT applied_to, amount, amount_type, min_subtotal, min_items, max_discount
|
||||
FROM discount_rules
|
||||
WHERE discount_id = '{$discount['id']}';
|
||||
");
|
||||
|
||||
// Pulls any associated discount cross-references
|
||||
$discount['xref'] = $this->db->getArray("
|
||||
SELECT type, xref_id, eligible, exclusion
|
||||
FROM discount_xref
|
||||
WHERE discount_id = '{$discount['id']}';
|
||||
");
|
||||
|
||||
// Adds the discount to the session
|
||||
// Calculations aren't done here, they are done on the cart view module
|
||||
$_SESSION['cart']['discounts'][$coupon] = $discount;
|
||||
|
||||
}
|
||||
catch (Exception $e) {
|
||||
// @todo Get the error message to the user.
|
||||
var_dump('The specified discount code ' . $e->getMessage());
|
||||
}
|
||||
|
||||
// Redirect to the cart
|
||||
header('Location: /store/cart');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Empties the cart
|
||||
*
|
||||
* Removes all the items from the cart completely
|
||||
*
|
||||
* @package PICKLES
|
||||
* @subpackage store
|
||||
* @author Joshua Sherman <josh@phpwithpickles.org>
|
||||
* @copyright 2008 Joshua Sherman
|
||||
*/
|
||||
|
||||
class store_cart_empty extends store {
|
||||
|
||||
public function __default() {
|
||||
|
||||
// Unsets the products array if products are there.
|
||||
if (isset($_SESSION['cart'])) {
|
||||
unset($_SESSION['cart']);
|
||||
}
|
||||
|
||||
// Redirect to the cart
|
||||
header('Location: /store/cart');
|
||||
exit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,58 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Removes an item from the cart
|
||||
*
|
||||
* Removes the passed item from the cart completely
|
||||
*
|
||||
* @package PICKLES
|
||||
* @subpackage store
|
||||
* @author Joshua Sherman <josh@phpwithpickles.org>
|
||||
* @copyright 2008 Joshua Sherman
|
||||
*/
|
||||
|
||||
class store_cart_remove extends store {
|
||||
|
||||
/**
|
||||
* @todo Add handling for an invalid product
|
||||
*/
|
||||
public function __default() {
|
||||
|
||||
if ($this->db->getField('SELECT COUNT(id) FROM products WHERE id = "' . $_REQUEST['id'] . '";') != 1) {
|
||||
|
||||
}
|
||||
else {
|
||||
// Unsets the product from the cart
|
||||
unset($_SESSION['cart']['products'][$_REQUEST['id']]);
|
||||
|
||||
if (count($_SESSION['cart']['products']) == 0) {
|
||||
unset($_SESSION['cart']['products']);
|
||||
}
|
||||
|
||||
// References the cart as a whole
|
||||
$cart =& $_SESSION['cart'];
|
||||
$subtotal = 0;
|
||||
$shipping = 0;
|
||||
|
||||
// Loops through the products and totals them up
|
||||
if (is_array($cart['products'])) {
|
||||
foreach ($cart['products'] as $product) {
|
||||
$subtotal += $product['total'];
|
||||
$shipping += $product['shipping'];
|
||||
}
|
||||
}
|
||||
|
||||
// Set the subtotal in the cart
|
||||
$cart['subtotal'] = $subtotal;
|
||||
$cart['shipping'] = $shipping;
|
||||
unset($cart);
|
||||
|
||||
// Redirect to the cart
|
||||
header('Location: /store/cart');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,76 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Updates the cart
|
||||
*
|
||||
* Updates the submitted data for the cart
|
||||
*
|
||||
* @package PICKLES
|
||||
* @subpackage store
|
||||
* @author Joshua Sherman <josh@phpwithpickles.org>
|
||||
* @copyright 2008 Joshua Sherman
|
||||
*/
|
||||
|
||||
class store_cart_update extends store {
|
||||
|
||||
/**
|
||||
* @todo Add handling for an invalid product
|
||||
*/
|
||||
public function __default() {
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
|
||||
|
||||
if (isset($_POST['quantity']) && is_array($_POST['quantity'])) {
|
||||
|
||||
// Updates the quantities
|
||||
foreach ($_POST['quantity'] as $id => $quantity) {
|
||||
// References the product in the cart
|
||||
$product = $_SESSION['cart']['products'][$id];
|
||||
|
||||
if ($quantity <= 0) {
|
||||
unset($_SESSION['cart']['products'][$id]);
|
||||
}
|
||||
else {
|
||||
if ($product['limit_per_customer'] != 0 && $quantity > $product['limit_per_customer']) {
|
||||
$quantity = $product['limit_per_customer'];
|
||||
}
|
||||
|
||||
// The ceil() is to force up any fractions
|
||||
$product['quantity'] = ceil($quantity);
|
||||
$product['total'] = round($product['price'] * $product['quantity'], 2);
|
||||
$_SESSION['cart']['products'][$id] = $product;
|
||||
}
|
||||
}
|
||||
|
||||
if (count($_SESSION['cart']['products']) <= 0) {
|
||||
unset($_SESSION['cart']['products']);
|
||||
}
|
||||
|
||||
// References the cart as a whole
|
||||
$cart =& $_SESSION['cart'];
|
||||
$subtotal = 0;
|
||||
$shipping = 0;
|
||||
|
||||
// Loops through the products and totals them up
|
||||
if (is_array($cart['products'])) {
|
||||
foreach ($cart['products'] as $product) {
|
||||
$subtotal += $product['total'];
|
||||
$shipping += $product['shipping'];
|
||||
}
|
||||
}
|
||||
|
||||
// Set the subtotal in the cart
|
||||
$cart['subtotal'] = round($subtotal, 2);
|
||||
$cart['shipping'] = round($shipping, 2);
|
||||
unset($cart);
|
||||
}
|
||||
}
|
||||
|
||||
// Redirect to the cart
|
||||
header('Location: /store/cart');
|
||||
exit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,29 +0,0 @@
|
|||
<?php
|
||||
|
||||
class store_category extends store {
|
||||
|
||||
protected $display = DISPLAY_SMARTY;
|
||||
|
||||
public function __default() {
|
||||
|
||||
$category = $this->db->getRow("
|
||||
SELECT id, name, permalink, description
|
||||
FROM categories
|
||||
WHERE permalink = '{$_REQUEST['permalink']}';
|
||||
");
|
||||
|
||||
$this->setPublic('category', $category);
|
||||
|
||||
$sql = "
|
||||
SELECT p.*
|
||||
FROM products AS p
|
||||
INNER JOIN category_xref as c
|
||||
ON p.id = c.product_id
|
||||
WHERE c.category_id = '{$category['id']}';
|
||||
";
|
||||
|
||||
$this->setPublic('products', $this->db->getArray($sql));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,548 +0,0 @@
|
|||
<?php
|
||||
|
||||
// @todo Add more error checking, basically against all queries
|
||||
|
||||
class store_checkout extends store {
|
||||
|
||||
protected $display = DISPLAY_JSON;
|
||||
|
||||
public function __default() {
|
||||
|
||||
// Required fields
|
||||
$required = array(
|
||||
'email',
|
||||
'shipping_first_name',
|
||||
'shipping_last_name',
|
||||
'shipping_address1',
|
||||
'shipping_city',
|
||||
'shipping_state',
|
||||
'shipping_zip_code',
|
||||
'shipping_phone',
|
||||
'referred_by',
|
||||
'other_source',
|
||||
'billing_first_name',
|
||||
'billing_last_name',
|
||||
'billing_address1',
|
||||
'billing_city',
|
||||
'billing_state',
|
||||
'billing_zip_code',
|
||||
'billing_phone',
|
||||
'cc_type',
|
||||
'cc_number',
|
||||
'cc_expiration'
|
||||
);
|
||||
|
||||
// Double safety in case the Javascript fails
|
||||
if (isset($_REQUEST) && is_array($_REQUEST)) {
|
||||
foreach ($_REQUEST as $key => $value) {
|
||||
if (in_array($key, $required)) {
|
||||
$values = is_array($value) ? $value : array($value);
|
||||
|
||||
foreach ($values as $value) {
|
||||
if (trim($value) == '') {
|
||||
$this->setPublic('message', 'Error: The ' . strtr($key, '_', ' ') . ' field is required.');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Checks that the password and confirmation are the same
|
||||
if (isset($_REQUEST['password']) && trim($_REQUEST['password']) != '') {
|
||||
if ($_REQUEST['password'] != $_REQUEST['confirm_password']) {
|
||||
$this->setPublic('message', 'Error: The password and confirm password fields must match.');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Adds the shipping information into the database
|
||||
if (isset($_REQUEST['shipping_address1']) && trim($_REQUEST['shipping_address1']) != '') {
|
||||
$shipping_address = array(
|
||||
'company' => $_REQUEST['shipping_company'],
|
||||
'first_name' => $_REQUEST['shipping_first_name'],
|
||||
'last_name' => $_REQUEST['shipping_last_name'],
|
||||
'address1' => $_REQUEST['shipping_address1'],
|
||||
'address2' => $_REQUEST['shipping_address2'],
|
||||
'city' => $_REQUEST['shipping_city'],
|
||||
'state' => $_REQUEST['shipping_state'],
|
||||
'zip_code' => $_REQUEST['shipping_zip_code'],
|
||||
'country' => 'US',
|
||||
'phone' => $_REQUEST['shipping_phone'],
|
||||
'fax' => $_REQUEST['shipping_fax']
|
||||
);
|
||||
|
||||
$shipping_address['hash'] = md5(implode('', $shipping_address));
|
||||
|
||||
if ($this->db->getField("SELECT COUNT(*) FROM addresses WHERE hash = '{$shipping_address['hash']}';") == 0) {
|
||||
$shipping_address_id = $this->db->insert('addresses', $shipping_address);
|
||||
}
|
||||
else {
|
||||
$shipping_address = $this->db->getRow("SELECT * FROM addresses WHERE hash = '{$shipping_address['hash']}';");
|
||||
$shipping_address_id = $shipping_address['id'];
|
||||
}
|
||||
}
|
||||
|
||||
// Adds the billing information into the database
|
||||
$billing_address_id = null;
|
||||
|
||||
if (isset($_REQUEST['billing_same_as_shipping']) && $_REQUEST['billing_same_as_shipping'] == 'on') {
|
||||
$billing_address_id = $shipping_address_id;
|
||||
$billing_address = $shipping_address;
|
||||
}
|
||||
else if (isset($_REQUEST['billing_address1']) && trim($_REQUEST['billing_address1']) != '') {
|
||||
$billing_address = array(
|
||||
'company' => $_REQUEST['billing_company'],
|
||||
'first_name' => $_REQUEST['billing_first_name'],
|
||||
'last_name' => $_REQUEST['billing_last_name'],
|
||||
'address1' => $_REQUEST['billing_address1'],
|
||||
'address2' => $_REQUEST['billing_address2'],
|
||||
'city' => $_REQUEST['billing_city'],
|
||||
'state' => $_REQUEST['billing_state'],
|
||||
'zip_code' => $_REQUEST['billing_zip_code'],
|
||||
'country' => 'US',
|
||||
'phone' => $_REQUEST['billing_phone'],
|
||||
'fax' => $_REQUEST['billing_fax']
|
||||
);
|
||||
|
||||
$billing_address['hash'] = md5(implode('', $billing_address));
|
||||
|
||||
if ($this->db->getField("SELECT COUNT(*) FROM addresses WHERE hash = '{$billing_address['hash']}';") == 0) {
|
||||
$billing_address_id = $this->db->insert('addresses', $billing_address);
|
||||
}
|
||||
else {
|
||||
$billing_address = $this->db->getRow("SELECT * FROM addresses WHERE hash = '{$billing_address['hash']}';");
|
||||
$billing_address_id = $billing_address['id'];
|
||||
}
|
||||
}
|
||||
|
||||
// @todo Remove this when I figure out how I want to control certain code inside the common modules
|
||||
$this->error->resetErrors();
|
||||
|
||||
// Gets a reference to the cart in the session
|
||||
$cart =& $_SESSION['cart'];
|
||||
|
||||
// Adds the addresses to the cart
|
||||
if (isset($shipping_address, $shipping_address_id)) {
|
||||
$cart['shipping_address'] = $shipping_address;
|
||||
$cart['shipping_address']['id'] = $shipping_address_id;
|
||||
}
|
||||
|
||||
if (isset($billing_address, $billing_address_id)) {
|
||||
$cart['billing_address'] = $billing_address;
|
||||
$cart['billing_address']['id'] = $billing_address_id;
|
||||
}
|
||||
|
||||
// Adds the customer's email into the email database
|
||||
if (isset($_REQUEST['email']) && trim($_REQUEST['email']) != '') {
|
||||
$email = $_REQUEST['email'];
|
||||
|
||||
if ($this->db->getField("SELECT COUNT(*) FROM emails WHERE email = '{$email}';") == 0) {
|
||||
$email_id = $this->db->insert('emails', array('email' => $email));
|
||||
}
|
||||
else {
|
||||
$email_id = $this->db->getField("SELECT id FROM emails WHERE email = '{$email}';");
|
||||
}
|
||||
}
|
||||
else if (isset($cart['email'])) {
|
||||
$email = $cart['email'];
|
||||
}
|
||||
|
||||
// Adds the customer's reference into the database
|
||||
if (isset($_REQUEST['referred_by'])) {
|
||||
$referrer = strtolower($_REQUEST['referred_by']) == 'other' ? $_REQUEST['other_source'] : $_REQUEST['referred_by'];
|
||||
|
||||
if ($this->db->getField("SELECT COUNT(*) FROM referrers WHERE referrer = '{$referrer}';") == 0) {
|
||||
$referrer_id = $this->db->insert('referrers', array('referrer' => $referrer));
|
||||
}
|
||||
else {
|
||||
$referrer_id = $this->db->getField("SELECT id FROM referrers WHERE referrer = '{$referrer}';");
|
||||
}
|
||||
}
|
||||
else {
|
||||
$referrer_id = null;
|
||||
}
|
||||
|
||||
// If a password exists, try to create a customer account
|
||||
if (isset($_REQUEST['password']) && trim($_REQUEST['password']) != '') {
|
||||
$customer = array(
|
||||
'email_id' => $email_id,
|
||||
'password' => md5($_REQUEST['password']),
|
||||
'billing_address_id' => $billing_address_id,
|
||||
'shipping_address_id' => $shipping_address_id,
|
||||
'created_at' => date('Y-m-d H:i:s')
|
||||
);
|
||||
|
||||
if (!isset($cart['customer_id']) || $cart['customer_id'] == 0) {
|
||||
// Adds the customer account
|
||||
if ($this->db->getField("SELECT COUNT(*) FROM customers WHERE email_id = '{$email_id}';") == 0) {
|
||||
$cart['customer_id'] = $this->db->insert('customers', $customer);
|
||||
$cart['email'] = $email;
|
||||
|
||||
// Contacts the user to advise them of their sign up
|
||||
$registration_message = "
|
||||
{$this->config->store->title}
|
||||
-------------------------------------------------------------------
|
||||
|
||||
Dear {$shipping_address['first_name']} {$shipping_address['last_name']},
|
||||
|
||||
You have been registered
|
||||
|
||||
Your profile:
|
||||
---------------------
|
||||
Login Information:
|
||||
---------------------
|
||||
Username: {$email}
|
||||
Password: {$_REQUEST['password']}
|
||||
|
||||
" . (isset($billing_address) ? "Billing Address:
|
||||
----------------
|
||||
Company: {$billing_address['company']}
|
||||
First Name: {$billing_address['first_name']}
|
||||
Last Name: {$billing_address['last_name']}
|
||||
Address: {$billing_address['address1']}
|
||||
Address2: {$billing_address['address2']}
|
||||
City: {$billing_address['city']}
|
||||
State: {$billing_address['state']}
|
||||
Postal Code: {$billing_address['zip_code']}
|
||||
Country: {$billing_address['country']}
|
||||
Phone: {$billing_address['phone']}
|
||||
Fax: {$billing_address['fax']}
|
||||
|
||||
" : '') . "Shipping Address:
|
||||
-----------------
|
||||
Company: {$shipping_address['company']}
|
||||
First Name: {$shipping_address['first_name']}
|
||||
Last Name: {$shipping_address['last_name']}
|
||||
Address: {$shipping_address['address1']}
|
||||
Address2: {$shipping_address['address2']}
|
||||
City: {$shipping_address['city']}
|
||||
State: {$shipping_address['state']}
|
||||
Postal Code: {$shipping_address['zip_code']}
|
||||
Country: {$shipping_address['country']}
|
||||
Phone: {$shipping_address['phone']}
|
||||
Fax: {$shipping_address['fax']}
|
||||
|
||||
------------------
|
||||
|
||||
Thank you for your interest in {$this->config->store->title}.
|
||||
|
||||
{$this->config->store->title}
|
||||
Phone: {$this->config->store->phone}
|
||||
Fax: {$this->config->store->fax}
|
||||
URL: {$this->config->store->url}
|
||||
";
|
||||
|
||||
// @todo
|
||||
mail($email, 'Welcome to ' . $this->config->store->title, $registration_message, 'From: ' . $this->config->store->return_email);
|
||||
/*
|
||||
$status = $this->mailer->send(
|
||||
$email,
|
||||
$this->config->store->return_email,
|
||||
'Welcome to ' . $this->config->store->title,
|
||||
$registration_message
|
||||
);
|
||||
*/
|
||||
}
|
||||
else {
|
||||
// @todo Change this out for a confirmation box and re-submit
|
||||
// $this->status = 'ExistingCustomer';
|
||||
$this->setPublic('message', 'Error: The email address you supplied is already in use. There is an existing customer login form on the right-hand side of the page. If you wish to continue without logging in, please provide a different email address or delete the contents of the password box (this will skip the process of creating a new account).');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Updates the existing customer account
|
||||
else if (isset($cart['customer_id']) && $cart['customer_id'] != 0) {
|
||||
$customer = array(
|
||||
'billing_address_id' => $billing_address_id,
|
||||
'shipping_address_id' => $shipping_address_id,
|
||||
'updated_at' => date('Y-m-d H:i:s')
|
||||
);
|
||||
|
||||
$this->db->update('customers', $customer, array('id' => $cart['customer_id']));
|
||||
}
|
||||
|
||||
if ($this->error->getErrors()) {
|
||||
$this->setPublic('status', 'Error');
|
||||
$this->setPublic('message', 'There was an error adding the customer account (' . implode('. ', $this->error->getErrors()) . '.)');
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
// Totals the subtotal and shipping cost (the grand total)
|
||||
$total_amount = $cart['subtotal'] + $cart['shipping'];
|
||||
|
||||
// Determines what sort of cross reference we need to use
|
||||
if (isset($cart['customer_id'])) {
|
||||
$xref_id = $cart['customer_id'];
|
||||
$xref_type = 'CUSTOMER';
|
||||
}
|
||||
else if (isset($email_id)) {
|
||||
$xref_id = $email_id;
|
||||
$xref_type = 'EMAIL';
|
||||
}
|
||||
else {
|
||||
$this->setPublic('status', 'Error');
|
||||
$this->setPublic('message', 'There was an internal error.');
|
||||
return false;
|
||||
}
|
||||
|
||||
$affiliate_id = null;
|
||||
if (isset($cart['affiliate'])) {
|
||||
if ($this->db->getField("SELECT COUNT(id) FROM affiliates WHERE MD5(id) = '{$cart['affiliate']}';") == 1) {
|
||||
$affiliate = $this->db->getRow("SELECT id, commission_rate FROM affiliates WHERE MD5(id) = '{$cart['affiliate']}';");
|
||||
$affiliate_id = $affiliate['id'];
|
||||
}
|
||||
}
|
||||
|
||||
// Assembles the order array
|
||||
$order = array(
|
||||
'xref_id' => $xref_id,
|
||||
'xref_type' => $xref_type,
|
||||
'shipping_address_id' => $shipping_address_id,
|
||||
'billing_address_id' => $billing_address_id,
|
||||
'referrer_id' => $referrer_id,
|
||||
'affiliate_id' => $affiliate_id,
|
||||
'cc_type' => isset($_REQUEST['cc_type']) ? $_REQUEST['cc_type'] : null,
|
||||
'cc_last4' => isset($_REQUEST['cc_number']) ? substr($_REQUEST['cc_number'], -4) : null,
|
||||
'cc_expiration' => isset($_REQUEST['cc_expiration']) ? '20' . $_REQUEST['cc_expiration']['year'] . '-' . $_REQUEST['cc_expiration']['month'] . '-01' : null,
|
||||
'total_amount' => "{$total_amount}",
|
||||
'shipping_amount' => "{$cart['shipping']}"
|
||||
);
|
||||
|
||||
// Inserts the order into the database
|
||||
if (!isset($cart['order_id']) || $cart['order_id'] == 0) {
|
||||
$cart['order_id'] = $this->db->insert('orders', $order);
|
||||
}
|
||||
// Updates an existing order
|
||||
else {
|
||||
$this->db->update('orders', $order, array('id' => $cart['order_id']));
|
||||
|
||||
// Cleans out the order_* tables
|
||||
$this->db->execute("DELETE FROM order_products WHERE order_id = '{$cart['order_id']}';");
|
||||
$this->db->execute("DELETE FROM order_discounts WHERE order_id = '{$cart['order_id']}';");
|
||||
}
|
||||
|
||||
// Populates the order_* tables and generates the line items for the receipt
|
||||
$receipt_products = null;
|
||||
foreach ($cart['products'] as $product_id => $product) {
|
||||
$order_product = array(
|
||||
'order_id' => $cart['order_id'],
|
||||
'product_id' => $product_id,
|
||||
'sequence' => '0',
|
||||
'quantity' => $product['quantity']
|
||||
);
|
||||
$this->db->insert('order_products', $order_product);
|
||||
|
||||
if (isset($product['discounts']) && is_array($product['discounts'])) {
|
||||
foreach ($product['discounts'] as $discount) {
|
||||
$order_discount = array(
|
||||
'order_id' => $cart['order_id'],
|
||||
'discount_id' => $discount['id'],
|
||||
'sequence' => '0'
|
||||
);
|
||||
$this->db->insert('order_discounts', $order_discount);
|
||||
}
|
||||
}
|
||||
|
||||
$receipt_products .= "
|
||||
Item : {$product['sku']}
|
||||
Description : >
|
||||
{$product['name']}
|
||||
Quantity : {$product['quantity']}
|
||||
Unit Price : US \${$product['price']}
|
||||
";
|
||||
}
|
||||
|
||||
$receipt = "
|
||||
========= ORDER INFORMATION =========
|
||||
Invoice Number : {$cart['order_id']}
|
||||
Description : Menopause Solutions
|
||||
Total : US \${$total_amount}
|
||||
Shipping : US \${$cart['shipping']}
|
||||
|
||||
{$receipt_products}
|
||||
|
||||
" . (isset($billing_address) ? "==== BILLING INFORMATION ===
|
||||
Customer ID : " . (isset($cart['customer_id']) ? $cart['customer_id'] : 'N/A') . "
|
||||
First Name : {$billing_address['first_name']}
|
||||
Last Name : {$billing_address['last_name']}
|
||||
Company : {$billing_address['company']}
|
||||
Address : {$billing_address['address1']}
|
||||
Address2 : {$billing_address['address2']}
|
||||
City : {$billing_address['city']}
|
||||
State/Province : {$billing_address['state']}
|
||||
Zip/Postal Code : {$billing_address['zip_code']}
|
||||
Country : {$billing_address['country']}
|
||||
Phone : {$billing_address['phone']}
|
||||
Fax : {$billing_address['fax']}
|
||||
Email : {$email}
|
||||
|
||||
" : '') . "==== SHIPPING INFORMATION ===
|
||||
Customer ID : " . (isset($cart['customer_id']) ? $cart['customer_id'] : 'N/A') . "
|
||||
First Name : {$shipping_address['first_name']}
|
||||
Last Name : {$shipping_address['last_name']}
|
||||
Company : {$shipping_address['company']}
|
||||
Address : {$shipping_address['address1']}
|
||||
Address2 : {$shipping_address['address2']}
|
||||
City : {$shipping_address['city']}
|
||||
State/Province : {$shipping_address['state']}
|
||||
Zip/Postal Code : {$shipping_address['zip_code']}
|
||||
Country : {$shipping_address['country']}
|
||||
Phone : {$shipping_address['phone']}
|
||||
Fax : {$shipping_address['fax']}
|
||||
Email : {$email}
|
||||
";
|
||||
|
||||
// Checks if the transaction ID exists for the order, if not, process the order
|
||||
if ($this->db->getField("SELECT transaction_id FROM orders WHERE id = '{$cart['order_id']}';") == NULL) {
|
||||
if ($total_amount > 0) {
|
||||
$gateway = new WebService_AuthorizeNet_AIM($this->config, $this->error);
|
||||
|
||||
// Customer and order information
|
||||
$gateway->order_id = $cart['order_id'];
|
||||
$gateway->customer_id = isset($cart['customer_id']) ? $cart['customer_id'] : 'N/A';
|
||||
$gateway->customer_ip = $_SERVER['REMOTE_ADDR'];
|
||||
|
||||
// Payment information
|
||||
$gateway->total_amount = $total_amount;
|
||||
$gateway->shipping = $cart['shipping'];
|
||||
$gateway->card_number = $_REQUEST['cc_number'];
|
||||
$gateway->expiration_month = $_REQUEST['cc_expiration']['month'];
|
||||
$gateway->expiration_year = $_REQUEST['cc_expiration']['year'];
|
||||
|
||||
if (isset($_REQUEST['ccv2'])) {
|
||||
$gateway->cvv2 = $_REQUEST['ccv2'];
|
||||
}
|
||||
|
||||
// Billing information
|
||||
$gateway->billing_company = $billing_address['company'];
|
||||
$gateway->billing_first_name = $billing_address['first_name'];
|
||||
$gateway->billing_last_name = $billing_address['last_name'];
|
||||
$gateway->billing_address1 = $billing_address['address1'];
|
||||
$gateway->billing_address2 = $billing_address['address2'];
|
||||
$gateway->billing_city = $billing_address['city'];
|
||||
$gateway->billing_state = $billing_address['state'];
|
||||
$gateway->billing_zip_code = $billing_address['zip_code'];
|
||||
$gateway->billing_country = $billing_address['country'];
|
||||
$gateway->billing_email = $email;
|
||||
$gateway->billing_phone = $billing_address['phone'];
|
||||
$gateway->billing_fax = $billing_address['fax'];
|
||||
|
||||
// Shipping information
|
||||
$gateway->shipping_company = $shipping_address['company'];
|
||||
$gateway->shipping_first_name = $shipping_address['first_name'];
|
||||
$gateway->shipping_last_name = $shipping_address['last_name'];
|
||||
$gateway->shipping_address1 = $shipping_address['address1'];
|
||||
$gateway->shipping_address2 = $shipping_address['address2'];
|
||||
$gateway->shipping_city = $shipping_address['city'];
|
||||
$gateway->shipping_state = $shipping_address['state'];
|
||||
$gateway->shipping_zip_code = $shipping_address['zip_code'];
|
||||
$gateway->shipping_country = $shipping_address['country'];
|
||||
$gateway->shipping_email = $email;
|
||||
$gateway->shipping_phone = $shipping_address['phone'];
|
||||
$gateway->shipping_fax = $shipping_address['fax'];
|
||||
|
||||
// Order information
|
||||
$gateway->products = $cart['products'];
|
||||
|
||||
/*
|
||||
$gateway->tax = '';
|
||||
$gateway->order_number = '';
|
||||
$gateway->session_number = '';
|
||||
*/
|
||||
|
||||
$response = $gateway->process();
|
||||
|
||||
// If the transaction was approved, update the order
|
||||
if ($response['response_code'] == 'Approved') {
|
||||
$this->db->execute("
|
||||
UPDATE orders
|
||||
SET transaction_id = '{$response['transaction_id']}', time_placed = NOW()
|
||||
WHERE id = '{$response['invoice_number']}';
|
||||
");
|
||||
|
||||
// Updates the affiliates profile
|
||||
if ($affiliate_id != null) {
|
||||
$commission = round($cart['subtotal'] * ($affiliate['commission_rate'] / 100), 2);
|
||||
|
||||
$this->db->execute("
|
||||
UPDATE affiliates
|
||||
SET
|
||||
order_count = order_count + 1,
|
||||
commission_earned = commission_earned + {$commission},
|
||||
unpaid_balance = unpaid_balance + {$commission}
|
||||
WHERE id = '{$affiliate_id}';
|
||||
");
|
||||
}
|
||||
|
||||
// Does some clean up to avoid duplicate transactions
|
||||
unset($_SESSION['cart']);
|
||||
|
||||
// Emails the shipping department
|
||||
// @todo
|
||||
mail($this->config->store->order_notification->recipient, $this->config->store->title . ' Order Notification', $receipt, 'From: ' . $this->config->store->return_email);
|
||||
/*
|
||||
$this->mailer->send(
|
||||
$this->config->store->order_notification->recipient,
|
||||
$this->config->store->return_email,
|
||||
$this->config->store->title . ' Order Notification',
|
||||
$receipt
|
||||
);
|
||||
*/
|
||||
}
|
||||
|
||||
$this->setPublic('status', $response['response_code']);
|
||||
$this->setPublic('message', $response['response_reason_text']);
|
||||
}
|
||||
// Free order (no payment processing necessary)
|
||||
else {
|
||||
$this->setPublic('status', 'Approved');
|
||||
|
||||
$this->db->execute("
|
||||
UPDATE orders
|
||||
SET transaction_id = '', time_placed = NOW()
|
||||
WHERE id = '{$cart['order_id']}';
|
||||
");
|
||||
|
||||
// Does some clean up to avoid duplicate transactions
|
||||
unset($_SESSION['cart']);
|
||||
|
||||
// Emails the user a receipt
|
||||
// @todo
|
||||
mail($email, $this->config->store->title . ' Customer Receipt', $receipt, 'From: ' . $this->config->store->return_email);
|
||||
/*
|
||||
$this->mailer->send(
|
||||
$email,
|
||||
$this->config->store->return_email,
|
||||
$this->config->store->title . ' Customer Receipt',
|
||||
$receipt,
|
||||
false
|
||||
);
|
||||
*/
|
||||
|
||||
// Emails the shipping department
|
||||
// @todo
|
||||
mail($this->config->store->order_notification->recipient, $this->config->store->title . ' Order Notification', $receipt, 'From: ' . $this->config->store->return_email);
|
||||
/*
|
||||
$this->mailer->send(
|
||||
$this->config->store->order_notification->recipient,
|
||||
$this->config->store->return_email,
|
||||
$this->config->store->title . ' Order Notification',
|
||||
$receipt
|
||||
);
|
||||
*/
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->setPublic('status', 'Error');
|
||||
$this->setPublic('message', 'A duplicate transaction has been submitted.');
|
||||
}
|
||||
|
||||
// Unsets the cart variable
|
||||
unset($cart);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,76 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Customer Login
|
||||
*
|
||||
* Logs an existing customer into the store and loads their previous
|
||||
* shopping cart (if they had one).
|
||||
*
|
||||
* @package PICKLES
|
||||
* @subpackage store
|
||||
* @author Joshua Sherman <josh@phpwithpickles.org>
|
||||
* @copyright 2009 Joshua Sherman
|
||||
*
|
||||
* @todo I'm assuming that the index is working correctly and that only 1 or 0 rows will be returned, I should be better checking this.
|
||||
*/
|
||||
|
||||
class store_customer_login extends store {
|
||||
|
||||
protected $display = DISPLAY_JSON;
|
||||
|
||||
public function __default() {
|
||||
|
||||
// Checks that the email address is valid
|
||||
$sql = "FROM emails WHERE email = '{$_REQUEST['email']}';";
|
||||
if ($this->db->getField("SELECT COUNT(id) {$sql}") != 0) {
|
||||
// Pulls the email ID
|
||||
$email_id = $this->db->getField("SELECT id {$sql}");
|
||||
|
||||
// Checks that the password is valid
|
||||
$password = md5($_REQUEST['password']);
|
||||
$sql = "FROM customers WHERE email_id = '{$email_id}' AND password = '{$password}';";
|
||||
if ($this->db->getField("SELECT COUNT(id) {$sql}") == 0) {
|
||||
$this->setPublic('status', 'error');
|
||||
$this->setPublic('message', 'Invalid logon credentials, please try again.');
|
||||
}
|
||||
else {
|
||||
// Pulls the customer and address IDs
|
||||
$customer = $this->db->getRow("SELECT id, shipping_address_id, billing_address_id {$sql}");
|
||||
|
||||
// Pulls the email
|
||||
$email = $this->db->getField("SELECT email FROM emails WHERE id = '{$email_id}';");
|
||||
|
||||
// Pulls the shipping address
|
||||
$shipping_address = $this->db->getRow("SELECT * FROM addresses WHERE id = '{$customer['shipping_address_id']}';");
|
||||
|
||||
// Pulls or syncs the billing address
|
||||
if ($customer['shipping_address_id'] == $customer['billing_address_id']) {
|
||||
$billing_address = $shipping_address;
|
||||
}
|
||||
else {
|
||||
$billing_address = $this->db->getRow("SELECT * FROM addresses WHERE id = '{$customer['billing_address_id']}';");
|
||||
}
|
||||
|
||||
// Adds the customer ID to the session
|
||||
$_SESSION['cart']['customer_id'] = $customer['id'];
|
||||
$_SESSION['cart']['email'] = $email;
|
||||
$_SESSION['cart']['shipping_address'] = $shipping_address;
|
||||
$_SESSION['cart']['billing_address'] = $billing_address;
|
||||
|
||||
// Sets up our variables to be returned in the JSON object
|
||||
$this->setPublic('status', 'success');
|
||||
$this->setPublic('customer_id', $customer['id']);
|
||||
$this->setPublic('shipping_address', $shipping_address);
|
||||
$this->setPublic('billing_address', $billing_address);
|
||||
|
||||
$this->billing_same_as_shipping = $shipping_address == $billing_address;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$this->setPublic('status', 'error');
|
||||
$this->setPublic('message', 'There is no customer account associated with that email address.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,25 +0,0 @@
|
|||
<?php
|
||||
|
||||
class store_home extends store {
|
||||
|
||||
protected $display = DISPLAY_SMARTY;
|
||||
|
||||
public function __construct(Config $config, DB $db, Mailer $mailer, Error $error) {
|
||||
parent::__construct($config, $db, $mailer, $error);
|
||||
}
|
||||
|
||||
public function __default() {
|
||||
$featured = $this->db->getRow('SELECT id, name, teaser FROM products WHERE featured = "Y" AND id = 30 ORDER BY RAND() LIMIT 1;');
|
||||
|
||||
foreach (array('gif', 'jpg', 'png') as $extension) {
|
||||
if (file_exists(getcwd() . '/images/products/' . $featured['id'] . '/medium.' . $extension)) {
|
||||
$featured['image'] = $extension;
|
||||
}
|
||||
}
|
||||
|
||||
$this->setPublic('featured', $featured);
|
||||
$this->setPublic('top_sellers', $this->db->getArray('SELECT id, name FROM products ORDER BY RAND() LIMIT 10;'));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,18 +0,0 @@
|
|||
<?php
|
||||
|
||||
class store_product extends store {
|
||||
|
||||
protected $display = DISPLAY_SMARTY;
|
||||
|
||||
public function __default() {
|
||||
|
||||
$sql = "
|
||||
SELECT *
|
||||
FROM products
|
||||
WHERE product_id = '{$_REQUEST['id']}';
|
||||
";
|
||||
$this->setPublic('product', $this->db->getArray($sql));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
|
@ -1 +0,0 @@
|
|||
Seems like PHP with PICKLES is all set up but you haven't set up your site level files correctly.
|
|
@ -1,31 +0,0 @@
|
|||
<script type="text/javascript" src="/static/contrib/fckeditor/fckeditor.js"></script>
|
||||
|
||||
<form method="post" action="/post/save">
|
||||
<dl class="post">
|
||||
<dt>Title:</dt>
|
||||
<dd><input type="text" name="title" value="{$module.post.title}" /></dd>
|
||||
<dt>Body:</dt>
|
||||
<dd><textarea name="body" rows="5" class="form_input">{$module.post.body}</textarea></dd>
|
||||
<dt>Date:</dt>
|
||||
<dd>{html_select_date time=$module.post.posted_at}</dd>
|
||||
<dt>Time:</dt>
|
||||
<dd>{html_select_time time=$module.post.posted_at use_24_hours=false}</dd>
|
||||
<dt>Hidden:</dt>
|
||||
<dd>
|
||||
<input type="radio" name="hidden" value="1" {if $module.post.hidden == 1} checked="checked"{/if} /> Yes
|
||||
<input type="radio" name="hidden" value="0" {if $module.post.hidden != 1} checked="checked"{/if} /> No
|
||||
</dd>
|
||||
</dl>
|
||||
<input type="hidden" name="id" value="{$module.post.post_id}" />
|
||||
<input type="reset" value="Reset" /> <input type="submit" value="Save Post" />
|
||||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
var oFCKeditor = new FCKeditor('body');
|
||||
oFCKeditor.BasePath = "/static/contrib/fckeditor/";
|
||||
oFCKeditor.ToolbarSet = "ThatGirlJen";
|
||||
oFCKeditor.Width = "500px";
|
||||
oFCKeditor.Height = "250px";
|
||||
oFCKeditor.ReplaceTextarea();
|
||||
console.debug(oFCKeditor);
|
||||
</script>
|
|
@ -1,18 +0,0 @@
|
|||
{if is_array($module.posts)}
|
||||
{foreach from=$module.posts item=post}
|
||||
<h2>{$post.title}</h2>
|
||||
<div class="post-info">Posted by {mailto text=$post.posted_by address=$post.email encode='javascript'} on {$post.posted_at|date_format:"%A, %B %e, %Y"}</div>
|
||||
<div class="post-body">{$post.body}</div>
|
||||
<div class="tags">
|
||||
{if is_array($post.tags)}
|
||||
{foreach from=$post.tags item=tag name=tags}{if !$smarty.foreach.tags.first}, {/if}<a href="/category/{$tag}" onclick="alert('Not yet... soon.'); return false;">{$tag}</a>{/foreach}
|
||||
{/if}
|
||||
</div>
|
||||
<div class="comments"><a href="#" onclick="alert('Not yet... soon.'); return false;">{$post.comments} Comment{if $post.comments != 1}s{/if}</a></div>
|
||||
{/foreach}
|
||||
{if $module.page > 1}<div style="float: left"><a href="/{$module_name.0}/{$module.page-1}">« Newer</a></div>{/if}
|
||||
{if $module.page < $module.last}<div style="float: right"><a href="/{$module_name.0}/{$module.page+1}">Older »</a></div>{/if}
|
||||
<br style="clear: both" />
|
||||
{else}
|
||||
<em>There are currently no posts.</em>
|
||||
{/if}
|
|
@ -1,12 +0,0 @@
|
|||
<h1>Store Administration</h1>
|
||||
<ol class="store-admin-navigation">
|
||||
{foreach from=$module.options item=option name=options}
|
||||
<li class="{if ($smarty.foreach.options.first && $module_name.3 == '') || ($module_name.3 == $option)}selected{/if}"><a href="/store/admin/{$option|replace:' ':'-'}">{$option|ucwords}</a></li>
|
||||
{/foreach}
|
||||
<li class="logout">
|
||||
<a href="/store/admin/logout">Logout</a><img src="/static/contrib/silk/icons/door_in.png" alt="Logout" title="Logout" style="margin: 0 0 -3px 5px;" />
|
||||
</li>
|
||||
</ol>
|
||||
<div class="store-admin-content">
|
||||
{include file="../../pickles/common/templates/$module_name[0].tpl"}
|
||||
</div>
|
|
@ -1,32 +0,0 @@
|
|||
<h3>Affiliates</h3>
|
||||
<div class="float-right">
|
||||
<img src="/static/contrib/silk/icons/add.png" style="margin: 0 5px -4px 0;"/><a href="/store/admin/affiliates/edit">Add New Affiliate</a>
|
||||
</div>
|
||||
{if is_array($module.affiliates)}
|
||||
<table style="width: 100%">
|
||||
<tr>
|
||||
<th class="left">Affiliate</th>
|
||||
<th class="left">Phone</th>
|
||||
<th class="left">Email</th>
|
||||
<th>Commission</th>
|
||||
<th>Orders</th>
|
||||
<th>Balance</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
{foreach from=$module.affiliates item=affiliate}
|
||||
<tr class="center">
|
||||
<td class="left">{$affiliate.last_name}, {$affiliate.first_name}</td>
|
||||
<td class="left">{$affiliate.phone}</td>
|
||||
<td class="left">{$affiliate.email}</td>
|
||||
<td>{$affiliate.commission_rate}%</td>
|
||||
<td>{$affiliate.order_count}</td>
|
||||
<td>${$affiliate.unpaid_balance}</td>
|
||||
<td>
|
||||
<a href="/store/admin/affiliates/edit/{$affiliate.id}"><img src="/static/contrib/silk/icons/pencil.png" alt="Edit Affiliate" title="Edit Affiliate" /></a>
|
||||
<a href="/store/admin/affiliates/pay/{$affiliate.id}"><img src="/static/contrib/silk/icons/money.png" alt="Pay Affiliate" title="Pay Affiliate" /></a>
|
||||
<a href="/store/admin/affiliates/delete/{$affiliate.id}" onclick="return confirm('Are you sure you want to delete {$affiliate.first_name} {$affiliate.last_name}?')"><img src="/static/contrib/silk/icons/delete.png" alt="Delete Affiliate" title="Delete Affiliate" /></a>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
{/if}
|
|
@ -1,227 +0,0 @@
|
|||
<script type="text/javascript" src="/static/js/ajax.js" /></script>
|
||||
<script type="text/javascript" src="/js/processOrder.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.affiliate.id)}Update{else}Add{/if} Affiliate</h3>
|
||||
<form method="post" action="/store/admin/affiliates/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.affiliate.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.affiliate.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.affiliate.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.affiliate.contact_address1}" /><br />
|
||||
<input type='text' name='contact_address2' id='contact_address2' maxlength="64" value="{$module.affiliate.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.affiliate.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.affiliate.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.affiliate.contact_phone}" /></dd>
|
||||
<dt>Fax:</dt>
|
||||
<dd><input type="text" name="contact_fax" id="contact_fax" style="width: 150px" maxlength="32" value="{$module.affiliate.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.affiliate.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.affiliate.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.affiliate.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.affiliate.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.affiliate.payee_address1}" /><br />
|
||||
<input type='text' name='payee_address2' id='payee_address2' maxlength="64" value="{$module.affiliate.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.affiliate.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.affiliate.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.affiliate.payee_phone}" /></dd>
|
||||
<dt>Fax:</dt>
|
||||
<dd><input type="text" name="payee_fax" id="payee_fax" style="width: 150px" maxlength="32" value="{$module.affiliate.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.affiliate.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.affiliate.tax_class == 'I'} selected{/if}>Individual</option>
|
||||
<option value="C"{if $module.affiliate.tax_class == 'C'} selected{/if}>Corporation</option>
|
||||
<option value="P"{if $module.affiliate.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.affiliate.commission_rate}" />%</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<br class="clear-left" />
|
||||
<div class="center">
|
||||
{if isset($module.affiliate.id)}<input type="hidden" name="id" value="{$module.affiliate.id}" />{/if}
|
||||
<input type="reset" value="Reset Form" /><input type="button" value="Store Information" onclick="ajaxRequest(this.parentNode.parentNode{if !isset($module.affiliate.id)}, 'clearForm'{/if}); return false;" />
|
||||
</div>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
document.getElementById('contact_state').value = "{$module.affiliate.contact_state}";
|
||||
document.getElementById('payee_state').value = "{$module.affiliate.payee_state}";
|
||||
</script>
|
|
@ -1,93 +0,0 @@
|
|||
<script type="text/javascript" src="/static/js/ajax.js" /></script>
|
||||
<!--script type="text/javascript" src="/js/processOrder.js" /></script-->
|
||||
|
||||
{literal}
|
||||
<style>
|
||||
form div {
|
||||
margin-top: 10px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<script type="text/javascript">
|
||||
function updateTotal(responseObject, responseElement) {
|
||||
if (responseObject != null) {
|
||||
switch (responseObject.status) {
|
||||
case 'Success':
|
||||
var unpaid_balance = (document.getElementById('unpaid_balance').innerHTML.substr(1) - responseObject.amount).toFixed(2);
|
||||
|
||||
document.getElementById('unpaid_balance').innerHTML = '$' + unpaid_balance;
|
||||
document.getElementById('amount').value = unpaid_balance;
|
||||
document.getElementById('number').value = '';
|
||||
{/literal}
|
||||
document.getElementById('date_mm').value = '{$smarty.now|date_format:'%m'}';
|
||||
document.getElementById('date_dd').value = '{$smarty.now|date_format:'%d'}';
|
||||
document.getElementById('date_ccyy').value = '{$smarty.now|date_format:'%Y'}';
|
||||
{literal}
|
||||
document.getElementById('notes').value = '';
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
//alert(responseObject.message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
var responseMessage = document.createTextNode(responseObject.message);
|
||||
responseElement.className = responseObject.type;
|
||||
responseElement.appendChild(responseMessage);
|
||||
|
||||
return responseElement;
|
||||
}
|
||||
</script>
|
||||
{/literal}
|
||||
<h3>Pay Affiliate</h3>
|
||||
<form method="post" action="/store/admin/affiliates/pay/save">
|
||||
<div class="float-left">
|
||||
<b>Payee Information:</b><br /e
|
||||
<div style="padding: 0 80px 0 25px">
|
||||
{$module.affiliate.payee_company}<br />
|
||||
{$module.affiliate.payee_first_name} {$module.affiliate.payee_last_name}<br />
|
||||
{$module.affiliate.payee_address1}<br />
|
||||
{$module.affiliate.payee_address2}<br />
|
||||
{$module.affiliate.payee_city}, {$module.affiliate.payee_state} {$module.affiliate.payee_zip_code}<br /><br />
|
||||
{$module.affiliate.payee_phone}<br /><br />
|
||||
Tax ID: {$module.affiliate.tax_id} ({$module.affiliate.tax_class})<br /><br />
|
||||
Unpaid Balance: <span id="unpaid_balance">${$module.affiliate.unpaid_balance|number_format:2}</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="float-left">
|
||||
<b>Commission Check:</b>
|
||||
<div style="padding-left: 25px; margin-top: -10px;">
|
||||
<table>
|
||||
<tr>
|
||||
<td align="right">Check Amount:</td>
|
||||
<td>$<input type="text" style="width: 60px" value="{$module.affiliate.unpaid_balance|number_format:2}" name="amount" id="amount" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Check Number:</td>
|
||||
<td><input type="text" style="width: 50px" name="number" id="number" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right">Date Cut:</td>
|
||||
<td>
|
||||
<input type="text" style="width: 20px" value="{$smarty.now|date_format:'%m'}" name="date[mm]" id="date_mm" />/
|
||||
<input type="text" style="width: 20px" value="{$smarty.now|date_format:'%d'}" name="date[dd]" id="date_dd" />/
|
||||
<input type="text" style="width: 40px" value="{$smarty.now|date_format:'%Y'}" name="date[ccyy]" id="date_ccyy" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="right" style="vertical-align: top">Notes:</td>
|
||||
<td>
|
||||
<textarea name="notes" id="notes"></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<br class="clear-left" />
|
||||
<div class="center">
|
||||
{if isset($module.affiliate.id)}<input type="hidden" name="id" value="{$module.affiliate.id}" />{/if}
|
||||
<input type="reset" value="Reset Form" /><input type="button" value="Store Information" onclick="ajaxRequest(this.parentNode.parentNode, 'updateTotal'); return false;" />
|
||||
</div>
|
||||
</form>
|
|
@ -1,41 +0,0 @@
|
|||
<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>Visible</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><img src="/static/contrib/silk/icons/{if $category.visible == 'Y'}tick{else}cross{/if}.png" /></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/delete.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><img src="/static/contrib/silk/icons/{if $child.visible == 'Y'}tick{else}cross{/if}.png" /></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/delete.png" alt="Delete Discount" title="Delete Discount" /></a>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
{/if}
|
||||
{/foreach}
|
||||
</table>
|
||||
{/if}
|
|
@ -1,27 +0,0 @@
|
|||
<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">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"><a href="/store/admin/customers/view/{$customer.id}">{$customer.shipping_last_name}, {$customer.shipping_first_name}</a></td>
|
||||
<td class="left">{$customer.shipping_phone}</td>
|
||||
<td class="left">{mailto address=$customer.email}</td>
|
||||
<td>{$customer.order_count}</td>
|
||||
<td>
|
||||
<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="alert('Customer deletion has not yet been implemented.'); return false; return confirm('Are you sure you want to delete {$customer.billing_first_name} {$customer.billing_last_name}?')"><img src="/static/contrib/silk/icons/delete.png" alt="Delete Customer" title="Delete Customer" /></a>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
{/if}
|
|
@ -1,215 +0,0 @@
|
|||
<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('shipping_company').value = document.getElementById('billing_company').value;
|
||||
document.getElementById('shipping_first_name').value = document.getElementById('billing_first_name').value;
|
||||
document.getElementById('shipping_last_name').value = document.getElementById('billing_last_name').value;
|
||||
document.getElementById('shipping_address1').value = document.getElementById('billing_address1').value;
|
||||
document.getElementById('shipping_address2').value = document.getElementById('billing_address2').value;
|
||||
document.getElementById('shipping_city').value = document.getElementById('billing_city').value;
|
||||
document.getElementById('shipping_state').value = document.getElementById('billing_state').value;
|
||||
document.getElementById('shipping_zip_code').value = document.getElementById('billing_zip_code').value;
|
||||
document.getElementById('shipping_phone').value = document.getElementById('billing_phone').value;
|
||||
document.getElementById('shipping_fax').value = document.getElementById('billing_fax').value;
|
||||
|
||||
// Disable the fields
|
||||
document.getElementById('shipping_company').disabled = true;
|
||||
document.getElementById('shipping_first_name').disabled = true;
|
||||
document.getElementById('shipping_last_name').disabled = true;
|
||||
document.getElementById('shipping_address1').disabled = true;
|
||||
document.getElementById('shipping_address2').disabled = true;
|
||||
document.getElementById('shipping_city').disabled = true;
|
||||
document.getElementById('shipping_state').disabled = true;
|
||||
document.getElementById('shipping_zip_code').disabled = true;
|
||||
document.getElementById('shipping_phone').disabled = true;
|
||||
document.getElementById('shipping_fax').disabled = true;
|
||||
}
|
||||
else {
|
||||
// Clear the values
|
||||
document.getElementById('shipping_company').value = '';
|
||||
document.getElementById('shipping_first_name').value = '';
|
||||
document.getElementById('shipping_last_name').value = '';
|
||||
document.getElementById('shipping_address1').value = '';
|
||||
document.getElementById('shipping_address2').value = '';
|
||||
document.getElementById('shipping_city').value = '';
|
||||
document.getElementById('shipping_state').value = '';
|
||||
document.getElementById('shipping_zip_code').value = '';
|
||||
document.getElementById('shipping_phone').value = '';
|
||||
document.getElementById('shipping_fax').value = '';
|
||||
|
||||
// Enable the fields
|
||||
document.getElementById('shipping_company').disabled = false;
|
||||
document.getElementById('shipping_first_name').disabled = false;
|
||||
document.getElementById('shipping_last_name').disabled = false;
|
||||
document.getElementById('shipping_address1').disabled = false;
|
||||
document.getElementById('shipping_address2').disabled = false;
|
||||
document.getElementById('shipping_city').disabled = false;
|
||||
document.getElementById('shipping_state').disabled = false;
|
||||
document.getElementById('shipping_zip_code').disabled = false;
|
||||
document.getElementById('shipping_phone').disabled = false;
|
||||
document.getElementById('shipping_fax').disabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
function clearForm(responseObject, responseElement) {
|
||||
if (responseObject != null) {
|
||||
switch (responseObject.status) {
|
||||
case 'Success':
|
||||
document.getElementById('billing_company').value = '';
|
||||
document.getElementById('billing_first_name').value = '';
|
||||
document.getElementById('billing_last_name').value = '';
|
||||
document.getElementById('billing_address1').value = '';
|
||||
document.getElementById('billing_address2').value = '';
|
||||
document.getElementById('billing_city').value = '';
|
||||
document.getElementById('billing_state').value = '';
|
||||
document.getElementById('billing_zip_code').value = '';
|
||||
document.getElementById('billing_phone').value = '';
|
||||
document.getElementById('billing_fax').value = '';
|
||||
|
||||
document.getElementById('shipping_company').value = '';
|
||||
document.getElementById('shipping_first_name').value = '';
|
||||
document.getElementById('shipping_last_name').value = '';
|
||||
document.getElementById('shipping_address1').value = '';
|
||||
document.getElementById('shipping_address2').value = '';
|
||||
document.getElementById('shipping_city').value = '';
|
||||
document.getElementById('shipping_state').value = '';
|
||||
document.getElementById('shipping_zip_code').value = '';
|
||||
document.getElementById('shipping_phone').value = '';
|
||||
document.getElementById('shipping_fax').value = '';
|
||||
|
||||
document.getElementById('email').value = '';
|
||||
document.getElementById('password').value = '';
|
||||
document.getElementById('password_verify').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, dl dd select {
|
||||
margin: 2px;
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
</style>
|
||||
{/literal}
|
||||
<h3>{if isset($module.customer.id)}Update{else}Add{/if} Customer</h3>
|
||||
<form method="post" action="/store/admin/customers/save">
|
||||
<div class="right" style="margin-bottom: -10px;">
|
||||
Same as billing information?
|
||||
<input id="shipping_same_as_billing" type="checkbox" onclick="copyAddress(this);" name="shipping_same_as_contact" style="margin-top: -2px" />
|
||||
</div>
|
||||
<div class="float-left">
|
||||
<b>Billing Information:</b>
|
||||
<dl>
|
||||
<dt>Company:</dt>
|
||||
<dd><input type='text' name='billing_company' id='billing_company' maxlength="64" value="{$module.customer.billing_company}" /></dd>
|
||||
<dt><span class="pink">*</span>First Name:</dt>
|
||||
<dd><input type='text' name='billing_first_name' id='billing_first_name' title="required" maxlength="50" value="{$module.customer.billing_first_name}" /></dd>
|
||||
<dt><span class="pink">*</span>Last Name:</dt>
|
||||
<dd><input type='text' name='billing_last_name' id='billing_last_name' title="required" maxlength="50" value="{$module.customer.billing_last_name}" /></dd>
|
||||
<dt><span class="pink">*</span>Address:</dt>
|
||||
<dd>
|
||||
<input type='text' name='billing_address1' id='billing_address1' title="required" maxlength="64" value="{$module.customer.billing_address1}" /><br />
|
||||
<input type='text' name='billing_address2' id='billing_address2' maxlength="64" value="{$module.customer.billing_address2}" />
|
||||
</dd>
|
||||
<dt><span class="pink">*</span>City:</dt>
|
||||
<dd><input type='text' name='billing_city' id='billing_city' title="required" maxlength="64" value="{$module.customer.billing_city}" /></dd>
|
||||
<dt><span class="pink">*</span>State:</dt>
|
||||
<dd>{html_select_state prefix="billing_" title="required"}</dd>
|
||||
<dt><span class="pink">*</span>ZIP Code:</dt>
|
||||
<dd><input type='text' name='billing_zip_code' id='billing_zip_code' style="width: 50px;" title="required" maxlength="5" value="{$module.customer.billing_zip_code}" /></dd>
|
||||
<dt><span class="pink">*</span>Phone:</dt>
|
||||
<dd><input type="text" name="billing_phone" id="billing_phone" style="width: 150px" maxlength="32" title="required" value="{$module.customer.billing_phone}" /></dd>
|
||||
<dt>Fax:</dt>
|
||||
<dd><input type="text" name="billing_fax" id="billing_fax" style="width: 150px" maxlength="32" value="{$module.customer.billing_fax}" /></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
<b>Shipping Information:</b>
|
||||
<dl>
|
||||
<dt>Company:</dt>
|
||||
<dd><input type='text' name='shipping_company' id='shipping_company' maxlength="64" value="{$module.customer.shipping_company}" /></dd>
|
||||
<dt><span class="pink">*</span>First Name:</dt>
|
||||
<dd><input type='text' name='shipping_first_name' id='shipping_first_name' title="required" maxlength="50" value="{$module.customer.shipping_first_name}" /></dd>
|
||||
<dt><span class="pink">*</span>Last Name:</dt>
|
||||
<dd><input type='text' name='shipping_last_name' id='shipping_last_name' title="required" maxlength="50" value="{$module.customer.shipping_last_name}" /></dd>
|
||||
<dt><span class="pink">*</span>Address:</dt>
|
||||
<dd>
|
||||
<input type='text' name='shipping_address1' id='shipping_address1' title="required" maxlength="64" value="{$module.customer.shipping_address1}" /><br />
|
||||
<input type='text' name='shipping_address2' id='shipping_address2' maxlength="64" value="{$module.customer.shipping_address2}" />
|
||||
</dd>
|
||||
<dt><span class="pink">*</span>City:</dt>
|
||||
<dd><input type='text' name='shipping_city' id='shipping_city' title="required" maxlength="64" value="{$module.customer.shipping_city}" /></dd>
|
||||
<dt><span class="pink">*</span>State:</dt>
|
||||
<dd>{html_select_state prefix="shipping_" title="required"}</dd>
|
||||
<dt><span class="pink">*</span>ZIP Code:</dt>
|
||||
<dd><input type='text' name='shipping_zip_code' id='shipping_zip_code' style="width: 50px;" title="required" maxlength="5" value="{$module.customer.shipping_zip_code}" /></dd>
|
||||
<dt><span class="pink">*</span>Phone:</dt>
|
||||
<dd><input type="text" name="shipping_phone" id="shipping_phone" style="width: 150px" maxlength="32" title="required" value="{$module.customer.shipping_phone}" /></dd>
|
||||
<dt>Fax:</dt>
|
||||
<dd><input type="text" name="shipping_fax" id="shipping_fax" style="width: 150px" maxlength="32" value="{$module.customer.shipping_fax}" /></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<br class="clear-left" /><br />
|
||||
<div class="float-left">
|
||||
<b>Email Address:</b><br />
|
||||
This is what the customer uses as their login ID
|
||||
<dl>
|
||||
<dt><span class="pink">*</span>Email:</dt>
|
||||
<dd><input type="text" name="email" id="email" maxlength="255" value="{$module.customer.email}" /></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
<b>Password Change?</b><br />
|
||||
If you do not wish to update the customer's password, leave blank.
|
||||
<dl>
|
||||
<dt>Password:</dt>
|
||||
<dd><input type="password" id="password" name="password" maxlength="12" value="" /></dd>
|
||||
<dt>Verify:</dt>
|
||||
<dd><input type="password" id="password_verify" name="password_verify" maxlength="12" value="" /></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<br class="clear-right" /><br />
|
||||
<div class="center">
|
||||
{if isset($module.customer.id)}<input type="hidden" name="id" value="{$module.customer.id}" />{/if}
|
||||
<input type="reset" value="Reset Form" /><input type="button" value="Store Information" onclick="ajaxRequest(this.parentNode.parentNode{if !isset($module.customer.id)}, 'clearForm'{/if}); return false;" />
|
||||
</div>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
document.getElementById('billing_state').value = "{$module.customer.billing_state}";
|
||||
document.getElementById('shipping_state').value = "{$module.customer.shipping_state}";
|
||||
</script>
|
|
@ -1,33 +0,0 @@
|
|||
<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">Name</th>
|
||||
<th class="left">Code</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">{$discount.name}</td>
|
||||
<td class="left">{$discount.coupon}</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="alert('This function is not yet implemented'); return false; return confirm('Are you sure you want to delete {$discount.first_name} {$discount.last_name}?')"><img src="/static/contrib/silk/icons/delete.png" alt="Delete Discount" title="Delete Discount" /></a>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
{/if}
|
|
@ -1,208 +0,0 @@
|
|||
<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 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: 650px;
|
||||
}
|
||||
dl dt {
|
||||
float: left;
|
||||
padding-top: 4px;
|
||||
text-align: right;
|
||||
width: 100px;
|
||||
}
|
||||
dl dd {
|
||||
float: left;
|
||||
width: 510px;
|
||||
padding: 2px;
|
||||
}
|
||||
dl dd input {
|
||||
width: 250px;
|
||||
}
|
||||
dl dd textarea {
|
||||
width: 500px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
table#applicable, table#rules {
|
||||
margin-top: 0px
|
||||
}
|
||||
table#applicable td, table#rules td {
|
||||
padding: 0px;
|
||||
}
|
||||
</style>
|
||||
{/literal}
|
||||
<h3>{if isset($module.discount.id)}Update{else}Add{/if} Discount</h3>
|
||||
<form method="post" action="/store/admin/discounts/save">
|
||||
<div class="float-left">
|
||||
<dl>
|
||||
<dt><span class="pink">*</span>Name:</dt>
|
||||
<dd>
|
||||
<input type="text" name="name" id="name" style="margin-right: 53px" value="{$module.discount.name}" title="required" />
|
||||
Coupon Code:
|
||||
<input type="text" name="coupon" id="coupon" style="width: 100px;" value="{$module.discount.coupon}" />
|
||||
</dd>
|
||||
<dt>Description:</dt>
|
||||
<dd><textarea name="description" id="description" style="height: 100px">{$module.discount.description}</textarea></dd>
|
||||
<dt><span class="pink">*</span>Valid From:</dt>
|
||||
<dd>
|
||||
{html_select_date prefix='valid_from_'}
|
||||
to
|
||||
{html_select_date prefix='valid_through_'}
|
||||
</dd>
|
||||
<dt><span class="pink">*</span>Applicable:</dt>
|
||||
<dd>
|
||||
<table cellspacing="0" cellpadding="0" id="applicable">
|
||||
<tr>
|
||||
<td><input type="checkbox" checked="checked" style="" disabled="disabled" /> All Customers</td>
|
||||
<!--td><input type="checkbox" checked="checked" style="" disabled="disabled" /> All Categories</td-->
|
||||
<td><input type="checkbox" checked="checked" style="" disabled="disabled" /> All Products</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>(CTRL + click to select multiple)</td>
|
||||
<!--td>(CTRL + click to select multiple)</td-->
|
||||
<td>(CTRL + click to select multiple)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="vertical-align: top; padding-right: 10px;">
|
||||
<select multiple="multiple" id="customers" name="customers" style="height: 200px; width: 250px;" disabled="disabled">
|
||||
{html_options options=$module.customers}
|
||||
</select>
|
||||
</td>
|
||||
<!--td style="vertical-align: top; padding-right: 10px;">
|
||||
<select multiple="multiple" id="categories" name="categories" style="height: 200px; width: 230px;" disabled="disabled">
|
||||
{html_options options=$module.categories|truncate:32}
|
||||
</select>
|
||||
</td-->
|
||||
<td style="vertical-align: top;">
|
||||
<select multiple="multiple" id="products" name="products" style="height: 200px; width: 450px;">
|
||||
{html_options options=$module.products}
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</dd>
|
||||
<dt>Max Usage:</dt>
|
||||
<dd>
|
||||
<input type="text" style="width: 40px" name="max_customer_usage" />
|
||||
Per Customer
|
||||
<input type="text" style="width: 40px" name="max_order_usage" />
|
||||
Per Order
|
||||
</dd>
|
||||
<dt><span class="pink">*</span>Remaining:</dt>
|
||||
<dd>
|
||||
<input type="radio" checked="checked" name="remaining_usages" value="unlimited" /> Unlimited <input type="radio" name="remaining_usages" value="other" /> Other <input type="text" style="width: 60px;" name="remaining_usages_count" /> Uses <span style="color: #666; margin-left: 20px;">Already Used {$module.discount.usage_count} times</span>
|
||||
<input type="hidden" name="usage_count" value="{$module.discount.usage_count}" />
|
||||
</dd>
|
||||
<dt><span class="pink">*</span>Rules:</dt>
|
||||
<dd>
|
||||
<table id="rules" style="width: 700px">
|
||||
<tr>
|
||||
<th>Applied To</td>
|
||||
<th>Amount</th>
|
||||
<th>Min Subtotal</th>
|
||||
<th>Min Items</th>
|
||||
<th>Max Discount</th>
|
||||
<th>
|
||||
<img src="/static/contrib/silk/icons/add.png" onclick="alert('The ability to add more than one rule to the discount is currently unavailable');" />
|
||||
</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="center">
|
||||
<select name="applied_to" id="applied_to">
|
||||
{html_options options=$module.applied_to_options selected=$module.rules.0.applied_to}
|
||||
</select>
|
||||
</td>
|
||||
<td class="center">
|
||||
<select name="amount_type" id="amount_type">
|
||||
{html_options options=$module.amount_type_options selected=$module.rules.0.amount_type}
|
||||
</select>
|
||||
<input type="text" name="amount" id="amount" style="width: 60px" value="{$module.rules.0.amount}" />
|
||||
</td>
|
||||
<td class="center">$<input type="text" name="min_subtotal" id="minimum_subtotal" style="width: 60px" value="{$module.rules.0.min_subtotal}" /></td>
|
||||
<td class="center"><input type="text" name="min_items" id="minimum_items" style="width: 60px" value="{$module.rules.0.min_items}" /></td>
|
||||
<td class="center">$<input type="text" name="max_discount" id="maximum_discount" style="width: 60px" value="{$module.rules.0.max_discount}" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<br style="clear: left" /><br />
|
||||
<div class="center">
|
||||
{if isset($module.discount.id)}
|
||||
<input type="hidden" name="id" value="{$module.discount.id}" />
|
||||
<input type="hidden" name="sequence" value="{$module.discount.sequence}" />
|
||||
{/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>
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
var select_box = document.getElementById('products');
|
||||
var option_count = select_box.options.length;
|
||||
|
||||
for (var i = 0; i < option_count; i++) {
|
||||
{/literal}
|
||||
{foreach from=$module.xrefs.PRODUCT item=product_id}
|
||||
if (select_box.options[i].value == {$product_id}) {literal}{{/literal}
|
||||
select_box.options[i].selected = 'selected';
|
||||
{literal}}{/literal}
|
||||
{/foreach}
|
||||
{literal}
|
||||
}
|
||||
</script>
|
||||
{/literal}
|
|
@ -1,2 +0,0 @@
|
|||
<h3>Gift Certificates</h3>
|
||||
<em>Gift certificates are currently unavailable.</em>
|
|
@ -1,58 +0,0 @@
|
|||
{literal}
|
||||
<style>
|
||||
table#stats {
|
||||
border: 1px solid #999;
|
||||
width: 250px;
|
||||
float: right;
|
||||
}
|
||||
</style>
|
||||
{/literal}
|
||||
<div style="float: left; padding-right: 80px;">
|
||||
<img src="/static/contrib/silk/icons/package.png" style="float: left; padding-right: 10px" />
|
||||
<ol style="float: left">
|
||||
<li><h3><a href="/store/admin/orders">Orders</a></h3></li>
|
||||
<li> <a href="/store/admin/orders/filter/pending">Pending</a></li>
|
||||
<li> <a href="/store/admin/orders/filter/approved">Approved</a></li>
|
||||
<li> <a href="/store/admin/orders/filter/partially-shipped">Partially Shipped</a></li>
|
||||
<li> <a href="/store/admin/orders/filter/shipped/completed">Shipped/Completed</a></li>
|
||||
<li> <a href="/store/admin/orders/filter/backorder">Backorder</a></li>
|
||||
<li> <a href="/store/admin/orders/filter/declined">Declined</a></li>
|
||||
<li> <a href="/store/admin/orders/filter/void">Void</a></li>
|
||||
</ol>
|
||||
</div>
|
||||
<div style="float: left">
|
||||
<b>Today's Orders</b><br /><br />
|
||||
There are <b>No New Orders</b> today.
|
||||
</div>
|
||||
<table id="stats">
|
||||
<tr><th colspan="2">Statistics</th></tr>
|
||||
<tr>
|
||||
<td>Sales Today:</td>
|
||||
<td>${$module.statistics.sales_today|number_format:2}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Year-To-Date Sales:</td>
|
||||
<td>${$module.statistics.sales_ytd|number_format:2}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Month-To-Date Sales:</td>
|
||||
<td>${$module.statistics.sales_mtd|number_format:2}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Orders Today:</td>
|
||||
<td>{$module.statistics.orders_today}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Year-To-Date Orders:</td>
|
||||
<td>{$module.statistics.orders_ytd}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Month-To-Date Orders:</td>
|
||||
<td>{$module.statistics.orders_mtd}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Customers:</td>
|
||||
<td>{$module.statistics.total_customers}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br clear="both" />
|
|
@ -1,32 +0,0 @@
|
|||
<h3>{if $module.filter}{$module.filter} {/if}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 nowrap="nowrap">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 nowrap="nowrap">{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>{if $order.shipping_method != ''}{$order.shipping_method}{else}<em>Unknown</em>{/if}</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}
|
|
@ -1,202 +0,0 @@
|
|||
<script type="text/javascript" src="/static/js/ajax.js" /></script>
|
||||
|
||||
{assign var='order' value=$module.order}
|
||||
|
||||
<h3>Order #{$order.order_id}</h3>
|
||||
<h3 style="padding-bottom: 15px">Date: {$order.order_time}</h3>
|
||||
|
||||
{literal}
|
||||
<script type="text/javascript">
|
||||
function returnToOrders(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;
|
||||
}
|
||||
|
||||
function displayPackingSlip(responseObject, responseElement) {
|
||||
if (responseObject != null) {
|
||||
switch (responseObject.status) {
|
||||
case 'Success':
|
||||
var body = document.body;
|
||||
body.style.backgroundColor = '#FFF';
|
||||
body.style.color = '#000';
|
||||
|
||||
body.innerHTML = responseObject.packing_slip;
|
||||
|
||||
// Launch the print dialog
|
||||
window.print();
|
||||
|
||||
// Prompt the user for the print status
|
||||
while (!confirm('Did the packing slip print successfully?')) {
|
||||
window.print();
|
||||
}
|
||||
|
||||
// Loads the orders list
|
||||
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}
|
||||
|
||||
{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" {if $order.total_amount > 0}style="padding-left: 50px"{/if}>
|
||||
<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">
|
||||
<form method="post" action="">
|
||||
<dl class="status">
|
||||
<dt>Customer's Email:</dt>
|
||||
<dd><input type="text" name="email" id="email" value="{$order.email}" /> <input type="button" value="Resend Last Update" onclick="this.parentNode.parentNode.parentNode.action = '/store/admin/orders/send'; ajaxRequest(this.parentNode.parentNode.parentNode, null, 'after'); return false" /></dd>
|
||||
<dt>Order Status:</dt>
|
||||
<dd>{html_options name='status' options=$module.status_options selected=$order.status_id}</dd>
|
||||
<dt>Shipping Method:</dt>
|
||||
<dd>{html_options name='shipping_method' options=$module.shipping_method_options 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"></textarea></dd>
|
||||
<dt> </dt>
|
||||
<dd>
|
||||
<input type="checkbox" name="email_customer" id="email_customer" checked="checked" /> Send update email to customer
|
||||
</dd>
|
||||
</dl>
|
||||
<br class="clear-left" />
|
||||
<br class="clear-right" />
|
||||
<div class="center" style="width: 500px">
|
||||
<input type="hidden" name="parameter" id="parameter" value="" />
|
||||
<input type="hidden" name="id" value="{$order.order_id}" />
|
||||
<input type="hidden" name="order" value="{$module.serialized_order|urlencode}" />
|
||||
<input type="button" value="Save & Return to List" onclick="this.parentNode.parentNode.action = '/store/admin/orders/save'; ajaxRequest(this.parentNode.parentNode, 'returnToOrders', 'after'); return false;" />
|
||||
<input type="button" value="Save & Print Packing Slip" onclick="this.parentNode.parentNode.action = '/store/admin/orders/print'; ajaxRequest(this.parentNode.parentNode, 'displayPackingSlip', 'after'); return false;" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{if is_array($order.updates)}
|
||||
<div class="float-right" style="width: 300px;">
|
||||
<table style="margin-top: 0px;">
|
||||
<tr>
|
||||
<th class="left">Status Update</th>
|
||||
<th>Date</th>
|
||||
<th>Note</th>
|
||||
</tr>
|
||||
{foreach from=$order.updates item="update"}
|
||||
<tr>
|
||||
<td>{$module.statuses[$update.status_id]}</td>
|
||||
<td class="center">{$update.update_time|date_format:'%m/%d/%Y'}</td>
|
||||
<td class="center">{if trim($update.note) != ''}<img src="/static/contrib/silk/icons/note.png" title="{$update.note}" />{/if}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
</div>
|
||||
{/if}
|
||||
<br class="clear-left" />
|
||||
<br class="clear-right" />
|
|
@ -1,29 +0,0 @@
|
|||
<h3>Products</h3>
|
||||
<div class="float-right">
|
||||
<img src="/static/contrib/silk/icons/add.png" style="margin: 0 5px -4px 0;"/><a href="/store/admin/products/edit">Add New Product</a>
|
||||
</div>
|
||||
{if is_array($module.products)}
|
||||
<table style="width: 100%">
|
||||
<tr>
|
||||
<th class="left">SKU</th>
|
||||
<th class="left">Name</th>
|
||||
<th>Photo</th>
|
||||
<th class="left">Price</th>
|
||||
<th>In Stock?</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
{foreach from=$module.products item=product}
|
||||
<tr class="left">
|
||||
<td>{$product.sku}</td>
|
||||
<td>{$product.name}</td>
|
||||
<td class="center"><img src="/static/contrib/silk/icons/{if $category.visible == 'Y'}tick{else}cross{/if}.png" /></td>
|
||||
<td>${$product.price}</td>
|
||||
<td class="center"><img src="/static/contrib/silk/icons/{if $product.in_stock == 'Y'}tick{else}cross{/if}.png" /></td>
|
||||
<td>
|
||||
<a href="/store/admin/products/edit/{$product.id}"><img src="/static/contrib/silk/icons/pencil.png" alt="Edit Product" title="Edit Product" /></a>
|
||||
<a href="/store/admin/products/delete/{$product.id}" onclick="return confirm('Are you sure you want to delete {$product.first_name} {$product.last_name}?')"><img src="/static/contrib/silk/icons/delete.png" alt="Delete Product" title="Delete Product" /></a>
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</table>
|
||||
{/if}
|
|
@ -1,115 +0,0 @@
|
|||
<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 clearForm(responseObject, responseElement) {
|
||||
if (responseObject != null) {
|
||||
switch (responseObject.status) {
|
||||
case 'Success':
|
||||
document.getElementById('billing_company').value = '';
|
||||
document.getElementById('billing_first_name').value = '';
|
||||
document.getElementById('billing_last_name').value = '';
|
||||
document.getElementById('billing_address1').value = '';
|
||||
document.getElementById('billing_address2').value = '';
|
||||
document.getElementById('billing_city').value = '';
|
||||
document.getElementById('billing_state').value = '';
|
||||
document.getElementById('billing_zip_code').value = '';
|
||||
document.getElementById('billing_phone').value = '';
|
||||
document.getElementById('billing_fax').value = '';
|
||||
|
||||
document.getElementById('shipping_company').value = '';
|
||||
document.getElementById('shipping_first_name').value = '';
|
||||
document.getElementById('shipping_last_name').value = '';
|
||||
document.getElementById('shipping_address1').value = '';
|
||||
document.getElementById('shipping_address2').value = '';
|
||||
document.getElementById('shipping_city').value = '';
|
||||
document.getElementById('shipping_state').value = '';
|
||||
document.getElementById('shipping_zip_code').value = '';
|
||||
document.getElementById('shipping_phone').value = '';
|
||||
document.getElementById('shipping_fax').value = '';
|
||||
|
||||
document.getElementById('email').value = '';
|
||||
document.getElementById('password').value = '';
|
||||
document.getElementById('password_verify').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: 135px;
|
||||
}
|
||||
dl dd {
|
||||
float: left;
|
||||
width: 240px;
|
||||
}
|
||||
dl dd input, dl dd select {
|
||||
margin: 2px;
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
</style>
|
||||
{/literal}
|
||||
<h3>{if isset($module.product.id)}Update{else}Add{/if} Product</h3>
|
||||
<form method="post" action="/store/admin/products/save">
|
||||
<div class="float-left">
|
||||
<dl>
|
||||
<dt>SKU:</dt>
|
||||
<dd><input type='text' name='XXX' id='XXX' maxlength="64" value="{$module.product.XXX}" /></dd>
|
||||
<dt>Name:</dt>
|
||||
<dd><input type='text' name='XXX' id='XXX' maxlength="64" value="{$module.product.XXX}" /></dd>
|
||||
<dt>Teaser:</dt>
|
||||
<dd><input type='text' name='XXX' id='XXX' maxlength="64" value="{$module.product.XXX}" /></dd>
|
||||
<dt>Description:</dt>
|
||||
<dd><input type='text' name='XXX' id='XXX' maxlength="64" value="{$module.product.XXX}" /></dd>
|
||||
<dt>MSRP:</dt>
|
||||
<dd>$<input type='text' name='XXX' id='XXX' maxlength="64" value="{$module.product.XXX}" /></dd>
|
||||
<dt>Price:</dt>
|
||||
<dd>$<input type='text' name='XXX' id='XXX' maxlength="64" value="{$module.product.XXX}" /></dd>
|
||||
<dt>Size:</dt>
|
||||
<dd><input type='text' name='XXX' id='XXX' maxlength="64" value="{$module.product.XXX}" /></dd>
|
||||
<dt>In Stock?</dt>
|
||||
<dd><input type='checkbox' name='XXX' id='XXX' maxlength="64" /></dd>
|
||||
<dt style="clear: left">Limit Per Customer:</dt>
|
||||
<dd><input type='text' name='XXX' id='XXX' maxlength="64" value="{$module.product.XXX}" /></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="float-left">
|
||||
<dl>
|
||||
<dt>SKU:</dt>
|
||||
<dd><input type='text' name='billing_company' id='billing_company' maxlength="64" value="{$module.product.billing_company}" /></dd>
|
||||
</dl>
|
||||
</div>
|
||||
<br class="clear-left" /><br />
|
||||
<div class="center">
|
||||
{if isset($module.product.id)}<input type="hidden" name="id" value="{$module.product.id}" />{/if}
|
||||
<input type="reset" value="Reset Form" /><input type="button" value="Store Information" onclick="ajaxRequest(this.parentNode.parentNode{if !isset($module.product.id)}, 'clearForm'{/if}); return false;" />
|
||||
</div>
|
||||
</form>
|
||||
<script type="text/javascript">
|
||||
document.getElementById('billing_state').value = "{$module.product.billing_state}";
|
||||
document.getElementById('shipping_state').value = "{$module.product.shipping_state}";
|
||||
</script>
|
|
@ -1,2 +0,0 @@
|
|||
<h3>Reports</h3>
|
||||
<em>Reports are currently unavailable.</em>
|
|
@ -1,2 +0,0 @@
|
|||
<h3>Settings</h3>
|
||||
<em>Settings are currently unavailable.</em>
|
|
@ -1,79 +0,0 @@
|
|||
<div class="content-left">
|
||||
{include file="../../pickles/common/templates/store/navigation.tpl"}<br /><br />
|
||||
{include file="../../pickles/common/templates/store/categories.tpl"}
|
||||
</div>
|
||||
<div class="content-right store-cart">
|
||||
<div class="your-cart">
|
||||
<h1>Your Cart</h1>
|
||||
</div>
|
||||
{if is_array($module.cart.products) && count($module.cart.products) > 0}
|
||||
<form method="POST" action="/store/cart/" name="cart">
|
||||
<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=$module.cart.products key=id item=product}
|
||||
<tr>
|
||||
<td class="product-quantity">
|
||||
<input type="text" class="product-quantity" value="{$product.quantity}" name="quantity[{$id}]" /><br />
|
||||
<span style="font-size: 7pt"><a href="/store/cart/remove/{$id}">Remove</a></span>
|
||||
</td>
|
||||
<td class="product-sku">{$product.sku}</td>
|
||||
<td class="product-description">{$product.name}</td>
|
||||
<td class="product-price">
|
||||
${$product.price|number_format:2}
|
||||
{if is_array($module.discounts) && array_key_exists($id, $module.discounts)}
|
||||
<div style="color: #090">
|
||||
-${$module.discounts.$id.price|number_format:2}
|
||||
</div>
|
||||
{/if}
|
||||
</td>
|
||||
<td class="product-total">
|
||||
${$product.total|number_format:2}
|
||||
{if is_array($module.discounts) && array_key_exists($id, $module.discounts)}
|
||||
<div style="color: #090">
|
||||
-${$module.discounts.$id.total|number_format:2}
|
||||
</div>
|
||||
{/if}
|
||||
</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<br />
|
||||
<b>Discount Code:</b> <input type="text" size="12" name="coupon" /> <input type="submit" value="Apply" onclick="document.cart.action += 'discount/apply';" />
|
||||
</td>
|
||||
<td class="right">
|
||||
<b>Subtotal:</b><br />
|
||||
{if $module.cart.discount}{/if}
|
||||
<b>Shipping:</b><br />
|
||||
<b>Total:</b>
|
||||
</td>
|
||||
<td class="right">
|
||||
${$module.cart.subtotal|number_format:2}<br />
|
||||
$4.99<br />
|
||||
${$module.cart.subtotal+4.99|number_format:2}<br />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
<br />
|
||||
<input type="submit" value="Update Cart" onclick="document.cart.action += 'update';" />
|
||||
<input type="submit" value="Empty Cart" onclick="document.cart.action += 'empty'" />
|
||||
<input type="button" value="Continue Shopping" onclick="location.href='/store';" />
|
||||
</td>
|
||||
<td colspan="2" class="right">
|
||||
<br />
|
||||
<input type="button" value="Checkout" onclick="location.href='/store/cart/checkout';" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
{else}
|
||||
You have no items in your shopping cart.
|
||||
{/if}
|
||||
</div>
|
|
@ -1,13 +0,0 @@
|
|||
<div class="store-categories">
|
||||
{foreach from=$module.categories item=parent_category}
|
||||
<div class="{$parent_category.permalink}">
|
||||
<h1>{$parent_category.name}</h1>
|
||||
</div>
|
||||
<ul>
|
||||
{foreach from=$parent_category.subcategories item=subcategory}
|
||||
<!--li><a href="/store/category/{$subcategory.name|regex_replace:'/&[a-z]+;/':''|replace:' ':' '|strip_tags:false|lower|replace:' ':'-'}">{$subcategory.name}</a></li-->
|
||||
<li {if $subcategory.name == $category.name}class="selected"{/if}><a href="/store/category/{$subcategory.permalink}">{$subcategory.name}</a></li>
|
||||
{/foreach}
|
||||
</ul><br />
|
||||
{/foreach}
|
||||
</div>
|
|
@ -1,30 +0,0 @@
|
|||
<div class="content-left">
|
||||
{include file="../../pickles/common/templates/store/navigation.tpl"}<br /><br />
|
||||
{include file="../../pickles/common/templates/store/categories.tpl"}
|
||||
</div>
|
||||
<div class="content-right store-category">
|
||||
<div class="{$module.category.permalink}">
|
||||
<h1>{$module.category.name}</h1>
|
||||
</div>
|
||||
<div class="center">
|
||||
{$module.category.description}
|
||||
</div>
|
||||
<div class="breadcrumbs">
|
||||
<a href="/store">Shopping Home</a> > <a href="/store/category/{$module.category.permalink}">{$module.category.name}</a>
|
||||
</div>
|
||||
<div>
|
||||
{foreach from=$module.products item=product name=products}
|
||||
<div class="float-left" style="width: 200px; margin: 3px">
|
||||
<img src="/images/products/{$product.id}/small.jpg" class="float-left" style="padding-right: 5px" />
|
||||
<div class="float-left" style="width: 120px">
|
||||
<a href="/store/product/{$product.id}">{$product.name}</a><br /><br />
|
||||
{$product.teaser}<br /><br />
|
||||
<b>${$product.price}</b><br /><br />
|
||||
<ul><li><a href="/store/cart/add/{$product.id}" class="add-to-cart"><span>Add to Cart</span></a></li></ul>
|
||||
<br /><br />
|
||||
</div>
|
||||
</div>
|
||||
{if $smarty.foreach.products.iteration % 3 == 0}<br class="clear" />{/if}
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
|
@ -1,11 +0,0 @@
|
|||
{if $module.status == 'Approved'}
|
||||
<img src="/images/success.jpg" alt="Transaction Successful!" /><!-- h1Transaction Successful!</h1><br /-->
|
||||
Thank you for your order, a receipt should arrive via email shortly. Once your order has been shipped you will receive the shipment tracking information via email as well.
|
||||
{else}
|
||||
<!-- In theory, this should never be seen -->
|
||||
<h1>Transaction {$module.status}.</h1><br />
|
||||
There was an error processing your order:<br /><br />
|
||||
<div style="padding-left: 40px; font-weight: bold;">{$module.message}</div><br />
|
||||
Please return to the previous page and make sure all of the information is correct. Should you continue to have problems, please call (800) 895-4415 for futher assistance.
|
||||
{/if}
|
||||
<div style="height: 900px"></div>
|
|
@ -1,10 +0,0 @@
|
|||
<img src="/images/products/{$module.featured.id}/featured.jpg" class="float-right" style="padding-right: 20px" />
|
||||
<div class="store-featured-product">
|
||||
<h1>Featured Product</h1>
|
||||
<h2>{$module.featured.name}</h2><br />
|
||||
{$module.featured.teaser}<br /><br />
|
||||
<ul>
|
||||
<li><a href="/store/cart/add/{$module.featured.id}" class="add-to-cart"><span>Add to Cart</span></a></li>
|
||||
<li><a href="/store/product/{$module.featured.id}" class="more-information"><span>More Information</span></a></li>
|
||||
</ul>
|
||||
</div>
|
|
@ -1,8 +0,0 @@
|
|||
<div name="content-left">
|
||||
{include file="../../pickles/common/templates/store/navigation.tpl"}<br /><br />
|
||||
{include file="../../pickles/common/templates/store/categories.tpl"}
|
||||
</div>
|
||||
<div name="content-right">
|
||||
{include file="../../pickles/common/templates/store/featured_product.tpl"}<br /><br />
|
||||
{include file="../../pickles/common/templates/store/top_sellers.tpl"}
|
||||
</div>
|
|
@ -1,11 +0,0 @@
|
|||
<div class="store-subnav">
|
||||
<ul class="subnav">
|
||||
{foreach from=$config.store key=link item=label}
|
||||
<li {if $module_name.0 == 'store/'|cat:$link}class="selected"{/if}>
|
||||
<a href="/{$module_name.1}/{$link}" class="{$link}">
|
||||
{$label}{if $link == 'cart' && $module.cart.count != 0} ({$module.cart.count}){/if}
|
||||
</a>
|
||||
</li>
|
||||
{/foreach}
|
||||
</ul>
|
||||
</div>
|
|
@ -1,30 +0,0 @@
|
|||
<div class="content-left">
|
||||
{include file="../../pickles/common/templates/store/navigation.tpl"}<br /><br />
|
||||
{include file="../../pickles/common/templates/store/categories.tpl"}
|
||||
</div>
|
||||
<div class="content-right store-category">
|
||||
<div class="{$module.category.permalink}">
|
||||
<h1>{$module.category.name}</h1>
|
||||
</div>
|
||||
<div class="center">
|
||||
{$module.category.description}
|
||||
</div>
|
||||
<div class="breadcrumbs">
|
||||
<a href="/store">Shopping Home</a> > <a href="/store/category/{$module.category.permalink}">{$module.category.name}</a>
|
||||
</div>
|
||||
<div>
|
||||
{foreach from=$module.products item=product name=products}
|
||||
<div class="float-left" style="width: 200px; margin: 3px">
|
||||
<img src="/images/products/{$product.id}/small.jpg" class="float-left" style="padding-right: 5px" />
|
||||
<div class="float-left" style="width: 120px">
|
||||
<a href="/store/product/{$product.id}">{$product.name}</a><br /><br />
|
||||
{$product.teaser}<br /><br />
|
||||
<b>${$product.price}</b><br /><br />
|
||||
<ul><li><a href="/store/cart/add/{$product.id}" class="add-to-cart"><span>Add to Cart</span></a></li></ul>
|
||||
<br /><br />
|
||||
</div>
|
||||
</div>
|
||||
{if $smarty.foreach.products.iteration % 3 == 0}<br class="clear" />{/if}
|
||||
{/foreach}
|
||||
</div>
|
||||
</div>
|
|
@ -1,19 +0,0 @@
|
|||
<div class="store-top-sellers">
|
||||
<h1>Top Sellers</h1>
|
||||
<div class="float-left" style="width: 175px;">
|
||||
{section name=product loop=$module.top_sellers start=0 loop=5 step=1}
|
||||
<a href="/store/product/{$module.top_sellers[product].id}"><b>{$smarty.section.product.index+1}.</b> {$module.top_sellers[product].name}</a><br />
|
||||
{/section}
|
||||
</div>
|
||||
<div class="float-left" style="width: 175px; padding-left: 10px;">
|
||||
{section name=product loop=$module.top_sellers start=5 loop=10 step=1}
|
||||
<a href="/store/product/{$module.top_sellers[product].id}"><b>{$smarty.section.product.index+1}.</b> {$module.top_sellers[product].name}</a><br />
|
||||
{/section}
|
||||
</div>
|
||||
<!-- Single Column -->
|
||||
<!--div>
|
||||
{section name=product loop=$module.top_sellers start=0 loop=10 step=1}
|
||||
<a href="/store/product/{$module.top_sellers[product].id}"><b>{$smarty.section.product.index+1}.</b> {$module.top_sellers[product].name}</a><br />
|
||||
{/section}
|
||||
</div-->
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue