Code:
-- EDIT EXISTING TABLES
ALTER TABLE orders
ADD date_completed datetime default NULL,
ADD date_cancelled datetime default NULL,
ADD balance_due decimal(14,2) default NULL;
-- --------------------------------------------------------
-- SPLIT ORDERS SUPPORT
ALTER TABLE `orders`
ADD `split_from_order` INT DEFAULT '0' NOT NULL,
ADD `is_parent` TINYINT (1) DEFAULT '1' NOT NULL;
-- --------------------------------------------------------
-- SUPER ORDERS PAYMENTS SUPPORT
CREATE TABLE so_payments (
payment_id int(11) NOT NULL auto_increment,
orders_id int(11) NOT NULL default '0',
payment_number varchar(32) NOT NULL default '',
payment_name varchar(40) NOT NULL default '',
payment_amount decimal(14,2) NOT NULL default '0.00',
payment_type varchar(20) NOT NULL default '',
date_posted datetime NOT NULL default '0000-00-00 00:00:00',
last_modified datetime NOT NULL default '0000-00-00 00:00:00',
purchase_order_id int(11) NOT NULL default '0',
PRIMARY KEY (payment_id)
) TYPE=MyISAM ;
-- --------------------------------------------------------
CREATE TABLE so_purchase_orders (
purchase_order_id int(11) NOT NULL auto_increment,
orders_id int(11) NOT NULL default '0',
po_number varchar(32) default NULL,
date_posted datetime NOT NULL default '0000-00-00 00:00:00',
last_modified datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (purchase_order_id)
) TYPE=MyISAM ;
-- --------------------------------------------------------
CREATE TABLE so_refunds (
refund_id int(11) NOT NULL auto_increment,
payment_id int(11) NOT NULL default '0',
orders_id int(11) NOT NULL default '0',
refund_number varchar(32) NOT NULL default '',
refund_name varchar(40) NOT NULL default '',
refund_amount decimal(14,2) NOT NULL default '0.00',
refund_type varchar(4) NOT NULL default 'REF',
date_posted datetime NOT NULL default '0000-00-00 00:00:00',
last_modified datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (refund_id),
KEY refund_id (refund_id)
) TYPE=MyISAM ;
-- --------------------------------------------------------
CREATE TABLE so_payment_types (
payment_type_id int(11) NOT NULL auto_increment,
language_id int(11) NOT NULL default '1',
payment_type_code varchar(4) NOT NULL default '',
payment_type_full varchar(20) NOT NULL default '',
PRIMARY KEY (payment_type_id),
UNIQUE KEY type_code (payment_type_code),
KEY type_code_2 (payment_type_code)
) TYPE=MyISAM;
-- --------------------------------------------------------
-- CREATE DEFAULT SUPER ORDERS PAYMENT TYPES
INSERT INTO so_payment_types VALUES (NULL, 1, 'CA', 'Cash');
INSERT INTO so_payment_types VALUES (NULL, 1, 'CK', 'Check');
INSERT INTO so_payment_types VALUES (NULL, 1, 'MO', 'Money Order');
INSERT INTO so_payment_types VALUES (NULL, 1, 'WU', 'Western Union');
INSERT INTO so_payment_types VALUES (NULL, 1, 'ADJ', 'Adjustment');
INSERT INTO so_payment_types VALUES (NULL, 1, 'REF', 'Refund');
INSERT INTO so_payment_types VALUES (NULL, 1, 'CC', 'Credit Card');
INSERT INTO so_payment_types VALUES (NULL, 1, 'MC', 'MasterCard');
INSERT INTO so_payment_types VALUES (NULL, 1, 'VISA', 'Visa');
INSERT INTO so_payment_types VALUES (NULL, 1, 'AMEX', 'American Express');
INSERT INTO so_payment_types VALUES (NULL, 1, 'DISC', 'Discover');
INSERT INTO so_payment_types VALUES (NULL, 1, 'DINE', 'Diners Club');
INSERT INTO so_payment_types VALUES (NULL, 1, 'SOLO', 'Solo');
INSERT INTO so_payment_types VALUES (NULL, 1, 'MAES', 'Maestro');
INSERT INTO so_payment_types VALUES (NULL, 1, 'JCB', 'JCB');
-- --------------------------------------------------------
-- ADD STORE PHONE AND FAX NUMBERS --
INSERT INTO configuration VALUES (NULL, 'Store Fax', 'STORE_FAX', '555-555-1212', 'Enter the fax number for your store.<br>You can call upon this by using the define <strong>STORE_FAX</strong>.', 1, 4, now(), now(), NULL, NULL);
INSERT INTO configuration VALUES (NULL, 'Store Phone', 'STORE_PHONE', '555-555-1212', 'Enter the phone number for your store.<br>You can call upon this by using the define <strong>STORE_PHONE</strong>.', 1, 4, now(), now(), NULL, NULL);
-- --------------------------------------------------------
-- ADD PURCHASE ORDER PAYMENT MODULE CONFIGURATION VALUES --
INSERT INTO configuration VALUES (NULL, 'Enable Purchase Order Module', 'MODULE_PAYMENT_PURCHASE_ORDER_STATUS', 'FALSE', 'Do you want to accept Purchase Order payments?', 6, 1, now(), now(), NULL, 'zen_cfg_select_option(array(\'True\', \'False\'), ');
INSERT INTO configuration VALUES (NULL, 'Make payable to:', 'MODULE_PAYMENT_PURCHASE_ORDER_PAYTO', 'YOUR COMPANY NAME', 'Who should payments be made payable to?', 6, 2, now(), now(), NULL, NULL);
INSERT INTO configuration VALUES (NULL, 'Sort order of display.', 'MODULE_PAYMENT_PURCHASE_ORDER_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', 6, 4, now(), now(), NULL, NULL);
INSERT INTO configuration VALUES (NULL, 'Payment Zone', 'MODULE_PAYMENT_PURCHASE_ORDER_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', 6, 5, now(), now(), 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(');
INSERT INTO configuration VALUES (NULL, 'Set Order Status', 'MODULE_PAYMENT_PURCHASE_ORDER_ORDER_STATUS_ID', '2', 'Set the status of orders made with this payment module to this value', 6, 6, now(), now(), 'zen_get_order_status_name', 'zen_cfg_pull_down_order_statuses(');
-- --------------------------------------------------------
-- CREATE SUPER ORDERS CONFIGURATION GROUP --
SET @t4=0;
SELECT (@t4:=configuration_group_id) as t4
FROM configuration_group
WHERE configuration_group_title= 'Super Orders';
DELETE FROM configuration WHERE configuration_group_id = @t4;
DELETE FROM configuration_group WHERE configuration_group_id = @t4;
INSERT INTO configuration_group VALUES (NULL, 'Super Orders', 'Settings for Super Order Features', '100', '1');
UPDATE configuration_group SET sort_order = last_insert_id() WHERE configuration_group_id = last_insert_id();
SET @t4=0;
SELECT (@t4:=configuration_group_id) as t4
FROM configuration_group
WHERE configuration_group_title= 'Super Orders';
-- ADD VALUES TO SUPER ORDERS CONFIGURATION GROUP (Admin > Configuration > Super Orders) --
INSERT INTO configuration VALUES (NULL, 'Auto Status - Payment', 'AUTO_STATUS_PAYMENT', '2', 'Number of the order status assigned when a payment (<strong>not</strong> attached to a purchase order) is added to the payment data.', @t4, 5, now(), now(), 'zen_get_order_status_name', 'zen_cfg_pull_down_order_statuses(');
INSERT INTO configuration VALUES (NULL, 'Auto Status - P.O. Payment', 'AUTO_STATUS_PO_PAYMENT', '2', 'Number of the order status assigned when a payment <strong>attached to a purchase order</strong> is added to the payment data.', @t4, 10, now(), now(), 'zen_get_order_status_name', 'zen_cfg_pull_down_order_statuses(');
INSERT INTO configuration VALUES (NULL, 'Auto Status - Purchase Order', 'AUTO_STATUS_PO', '2', 'Number of the status assigned to an order when a purchase order is added to the payment data.', @t4, 15, now(), now(), 'zen_get_order_status_name', 'zen_cfg_pull_down_order_statuses(');
INSERT INTO configuration VALUES (NULL, 'Auto Status - Refund', 'AUTO_STATUS_REFUND', '2', 'Number of the order status assigned when a refund is added to the payment data.', @t4, 20, now(), now(), 'zen_get_order_status_name', 'zen_cfg_pull_down_order_statuses(');
INSERT INTO configuration VALUES (NULL, 'Auto Comments - Payment', 'AUTO_COMMENTS_PAYMENT', 'Payment received in our office. Payment ID: %s', 'You''ll have the option of adding these pre-configured comments to an order when a payment is entered. You can attach the payment number to the comments by typing <strong>%s</strong>.', @t4, 25, now(), now(), NULL, NULL);
INSERT INTO configuration VALUES (NULL, 'Auto Comments - P.O. Payment', 'AUTO_COMMENTS_PO_PAYMENT', 'Payment on purchase order received in our office. Payment ID: %s', 'You will have the option of adding these pre-configured comments to an order when a purchase order payment is entered. You can attach the payment number to the comments by typing <strong>%s</strong>.', @t4, 30, now(), now(), NULL, NULL);
INSERT INTO configuration VALUES (NULL, 'Auto Comments - Purchase Order', 'AUTO_COMMENTS_PO', 'Purchase Order #%s received in our office', 'You will have the option of adding these pre-configured comments to an order when a purchase order is entered. You can attach the payment number to the comments by typing <strong>%s</strong>.', @t4, 35, now(), now(), NULL, NULL);
INSERT INTO configuration VALUES (NULL, 'Auto Comments - Refund', 'AUTO_COMMENTS_REFUND', 'Refund #%s has been issued from our office.', 'You will have the option of adding these pre-configured comments to an order when a refund is entered. You can attach the refund number to the comments by typing <strong>%s</strong>.', @t4, 40, now(), now(), NULL, NULL);
INSERT INTO configuration VALUES (NULL, 'Tax Exemption ID Number', 'TAX_ID_NUMBER', '', 'If your business or organization is tax exempt, then you may have been issued a tax exmption ID number. Enter the number here and the tax columns will not appear on the invoice and the tax exemption ID number will also be displayed at the top of the invoice.', @t4, 45, now(), now(), NULL , NULL);
INSERT INTO configuration VALUES (NULL, 'Closed Status - "Cancelled"', 'STATUS_ORDER_CANCELLED', '0', 'Insert the order status ID # you would like to assign to an order when you press the special "Cancelled!" button on super_orders.php.<p>If you do not have a "cancel" status, or do not want assign one automatically, choose <strong>default</strong> and this option will be ignored.<p><strong>You cannot attach comments or notify the customer using this option.</strong>', @t4, 50, now(), now(), 'zen_get_order_status_name', 'zen_cfg_pull_down_order_statuses(');
INSERT INTO configuration VALUES (NULL, 'Closed Status - "Completed"', 'STATUS_ORDER_COMPLETED', '0', 'Insert the order status ID # you would like to assign to an order when you press the special "Completed!" button on super_orders.php.<p>If you do not have a "complete" status, or do not want assign one automatically, choose <strong>default</strong> and this option will be ignored.<p><strong>You cannot attach comments or notify the customer using this option.</strong>', @t4, 55, now(), now(), 'zen_get_order_status_name', 'zen_cfg_pull_down_order_statuses(');
INSERT INTO configuration VALUES (NULL, 'Closed Status - "Reopened"', 'STATUS_ORDER_REOPEN', '0', 'Insert the order status ID # you would like to assign to an order when you undo the cancelled/completed status of an order.<p>If you do not have a "reopened" status, or do not want assign one automatically, choose <strong>default</strong> and this option will be ignored.<p><strong>You cannot attach comments or notify the customer using this option.</strong>', @t4, 60, now(), now(), 'zen_get_order_status_name', 'zen_cfg_pull_down_order_statuses(');
INSERT INTO configuration VALUES (NULL, 'Standard Packing Slips - Show Images', 'PACKINGSLIP_IMAGES', 'Yes', 'Do you want to show product images on the packing slip??', @t4, 61, now(), now(), NULL, "zen_cfg_select_option(array('Yes', 'No'),");
INSERT INTO configuration VALUES (NULL, 'Batch Form Printing - Printing Menu', 'LCSD_PRINTING_MENU', '2', 'Select which printing menu to show on the Super Orders Batch Form Printing page.<br />0=Traditional Super Orders options<br />1=PDF packing slip printing options<br />2=Both menus', @t4, 65, now(), now(), NULL, 'zen_cfg_select_option(array(''0'', ''1'', ''2''),');
INSERT INTO configuration VALUES (NULL, 'PDF Packing Slip - Header Logo', 'LCSD_PACKING_LOGO_LARGE', 'packingslip_HeaderLogo.png','File name of the image to show in the PDF packing slip header. Upload to admin/images folder. For best output quality, the file dimensions should be 252px X 82px.<br /><br />You should replace placeholder image with your own logo. If you do not want to use a logo, you should upload a transparent image to replace the placeholder logo. If you delete the image name in this setting you will get errors when generating PDF packing slips. Supports PNG & JPG files ONLY.',@t4, 70, now(), now(), NULL , NULL);
INSERT INTO configuration VALUES (NULL, 'PDF Packing Slip - Small Logo', 'LCSD_PACKING_LOGO_SMALL', 'packingslip_SmallLogo.png', 'File name of the image to show in the upper right corner of the PDF packing slip shipping label. Upload to admin/images folder. For best output quality, the file dimensions should be 192px X 64px.<br /><br />You should replace placeholder image with your own logo. If you do not want to use a logo, you should upload a transparent image to replace the placeholder logo. If you delete the image name in this setting you will get errors when generating PDF packing slips. Supports PNG & JPG files ONLY.',@t4, 75, now(), now(), NULL , NULL);
INSERT INTO configuration VALUES (NULL, 'PDF Packing Slip - Show Store Name on Packing Slip', 'LCSD_SHOW_STORE_NAME', 'True', 'Determines whether or not the store name is included in the address block on the PDF packing slip. If the store name is part of the header logo set this to false.', @t4, 80, now(), now(), NULL, 'zen_cfg_select_option(array(''True'', ''False''),');
INSERT INTO configuration VALUES (NULL, 'PDF Packing Slip - Enable Shipping Label', 'LCSD_SHOW_SHIPPING_LABEL', 'False', 'Determines whether or not a pre-printed shipping label is included in a customer address block on the packing slip so you don\’t have to process a separate label report. If you are using a preprinted packing slips with a peel off label – set this to true.', @t4, 85, now(), now(), NULL, 'zen_cfg_select_option(array(''True'', ''False''),');
-- SUPER ORDERS ADMIN FLAGS TO ADD SUPPORT FOR OTHER ADD-ONS
INSERT INTO configuration VALUES (NULL, 'Edit Orders Module Switch', 'SO_EDIT_ORDERS_SWITCH', 'False', 'If you have Edit Orders v3.0 for Zen Cart 1.3.9 module installed, set this option to TRUE to activate the Edit Orders navigation buttons to work with Super Orders.<br><br><strong><font color=red>YOU MUST HAVE EDIT ORDERS INSTALLED TO USE THIS FEATURE!!</font></strong><br><br>\(Activating this flag without the required mod installed <strong>WILL CAUSE ERRORS IN YOUR STORE!!!!</strong>\)<br><br>While we have not specifically tested this switch with other Edit Orders modules \(most notably the 1.5.x versions\), this switch should also work with other versions of Edit Orders as well.', @t4, 180, now(), now(), NULL, "zen_cfg_select_option(array('True', 'False'),");
INSERT INTO configuration VALUES (NULL, 'FedEx Label Module Switch', 'SO_FEDEX_LABELS_SWITCH', 'False', 'If your have the Fedex Automated Shipping Labels module installed, set this option to TRUE to activate it to work with Super Orders<br><br><strong><font color=red>YOU MUST HAVE FEDEX AUTOMATED SHIPPING LABELS INSTALLED TO USE THIS FEATURE!!</font></strong><br><br>\(Activating this flag without the required mod installed <strong>WILL CAUSE ERRORS IN YOUR STORE!!!!</strong>\)', @t4, 185, now(), now(), NULL, "zen_cfg_select_option(array('True', 'False'),");
INSERT INTO configuration VALUES (NULL, 'USPS Click-N-Ship Module Switch', 'SO_USPS_CLICK_SWITCH', 'False', 'If your have the USPS Click-N-Ship module installed, set this option to TRUE to activate it to work with Super Orders<br><br><strong><font color=red>YOU MUST HAVE USPS CLICK-N-SHIP INSTALLED TO USE THIS FEATURE!!</font></strong><br><br>\(Activating this flag without the required mod installed <strong>WILL CAUSE ERRORS IN YOUR STORE!!!!</strong>\)', @t4, 190, now(), now(), NULL, "zen_cfg_select_option(array('True', 'False'),");
Bookmarks