Magento to increase return, replacement RMA function

Source: Internet
Author: User
Tags datetime

One: For return SQL installation table data, required fields

<?php

$installer = $this;
$installer->startsetup ();
$installer->run ("

DROP TABLE IF EXISTS ' Return_order ';

CREATE TABLE ' Return_order ' (
' return_id ' int (a) unsigned not NULL auto_increment COMMENT ' return request ID ',
' customer_id ' int (a) unsigned not NULL COMMENT ' applicant ID ',
' order_id ' int (a) unsigned not NULL COMMENT ' order ID ',
' return_total_xyz ' int (a) unsigned not NULL COMMENT ' refunded total mind value ',
' return_shipping_number ' varchar DEFAULT NULL COMMENT ' return logistics number ',
' auditor_id ' int (a) unsigned not NULL COMMENT ' approver ID ',
' confirm_user_id ' int (a) unsigned not NULL COMMENT ' confirm consignee id ',
' Return_shipping_name ' text COMMENT ' logistics name ',
' Return_status ' enum (' return_agreement ', ' return_refuse ', ' return_confirm ') DEFAULT NULL COMMENT ' return_agreement: Agree to return the goods; Return_refuse: Refuse to return; Return_confirm: Confirm Receipt ',
' Return_create_time ' datetime DEFAULT NULL COMMENT ' Application Time ',
' Product_recieve_time ' datetime DEFAULT NULL COMMENT ' Receipt time ',
' Return_deal_time ' datetime DEFAULT NULL COMMENT ' process application time ',
' Return_memo ' text COMMENT ' return instructions ',
PRIMARY KEY (' return_id '),
KEY ' customer_id ' (' customer_id '),
KEY ' order_id ' (' order_id ')
) Engine=innodb DEFAULT Charset=utf8;

/*table structure for Table ' return_order_item ' *

DROP TABLE IF EXISTS ' Return_order_item ';

CREATE TABLE ' Return_order_item ' (
' return_item_id ' int (a) unsigned not NULL auto_increment,
' return_order_id ' int (a) unsigned not NULL COMMENT ' return order ID ',
' customer_id ' int (a) unsigned not NULL COMMENT ' return Person ID ',
' sales_order_id ' int (a) unsigned not NULL COMMENT ' order ID, sales_flat_order table ID ',
' order_item_id ' int (a) unsigned not NULL COMMENT ' sales_flat_order_item table ID ',
' product_id ' int (a) unsigned not NULL COMMENT ' Product ID ',
' Return_qty ' int (a) unsigned not NULL COMMENT ' number of returned goods ',
' return_item_xyz ' int (a) unsigned not NULL COMMENT ' returned mind value ',
PRIMARY KEY (' return_item_id '),
KEY ' return_order_item_ibfk_2 ' (' return_order_id '),
CONSTRAINT ' return_order_item_ibfk_2 ' FOREIGN KEY (' return_order_id ') REFERENCES ' Sales_flat_order ' (' entity_id ') on DELETE CASCADE on UPDATE CASCADE
) Engine=innodb DEFAULT Charset=utf8;

");
$installer->endsetup ();

Second: for replacement

<?php

$installer = $this;
$installer->startsetup ();
$installer->run ("

DROP TABLE IF EXISTS ' Barter_items ';

CREATE TABLE ' Barter_items ' (
' barter_item_id ' int (a) unsigned not NULL auto_increment,
' barter_id ' int (a) unsigned not NULL COMMENT ' Exchange slip ID ',
' sales_item_id ' int (a) unsigned not NULL COMMENT ' sales_flat_order_item table ID ',
' customer_id ' int (a) unsigned not NULL COMMENT ' replacement id ',
' product_id ' int (a) unsigned not NULL COMMENT ' Product ID ',
' Barter_qty ' int (a) unsigned not NULL COMMENT ' replacement quantity ',
PRIMARY KEY (' barter_item_id ')
) Engine=innodb DEFAULT Charset=utf8;

/*table structure for Table ' barter_order ' *

DROP TABLE IF EXISTS ' Barter_order ';

CREATE TABLE ' Barter_order ' (
' barter_id ' int (a) unsigned not NULL auto_increment COMMENT ' Exchange slip ID ',
' customer_id ' int (a) unsigned not NULL COMMENT ' applicant ID ',
' order_id ' int (a) unsigned not NULL COMMENT ' sales order ID ',
' Barter_apply_time ' datetime COMMENT ' replacement application time ',
' Barter_check_time ' datetime COMMENT ' replacement application approval time ',
' Customer_delivery_time ' datetime COMMENT ' customer delivery time ',
' customer_express_name ' varchar not NULL COMMENT ' customer shipping logistics name ',
' customer_express_num ' varchar not NULL COMMENT ' customer dispatch logistics number ',
' Warehouse_receive_time ' datetime COMMENT ' warehouse receipt time ',
' Warehouse_delivery_time ' datetime COMMENT ' warehouse delivery time ',
' warehouse_express_name ' varchar not NULL COMMENT ' warehouse shipping logistics name ',
' warehouse_express_num ' varchar not NULL COMMENT ' warehouse shipping number ',
' Customer_receive_time ' datetime COMMENT ' customer confirms receipt time ',
' Barter_status ' enum (' barter_agreenment ', ' barter_refuse ', ' warehouse_recieved ', ' warehouse_delivery ', ' CUSTOMER_ Recieved ')
DEFAULT NULL COMMENT ' barter_agreenment: Agreed to exchange, Barter_refuse: refused to receive replacement, Warehouse_recieved: Warehouse confirmation Receipt, Warehouse_delivery: Warehouse has been issued , customer_recieved: The customer confirms the receipt ',
' Barter_memo ' text COMMENT ' return instructions ',
PRIMARY KEY (' barter_id ')
) Engine=innodb DEFAULT Charset=utf8;

");
$installer->endsetup ();

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.