00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 class Mage_Sales_Model_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup
00029 {
00030 protected $_flatEntityTables = array(
00031 'quote' => 'sales_flat_quote',
00032 'quote_item' => 'sales_flat_quote_item',
00033 'quote_address' => 'sales_flat_quote_address',
00034 'quote_address_item'=> 'sales_flat_quote_address_item',
00035 'quote_address_rate'=> 'sales_flat_quote_shipping_rate',
00036 'quote_payment' => 'sales_flat_quote_payment',
00037 'order_item' => 'sales_flat_order_item',
00038 );
00039
00040 protected function _flatTableExist($table)
00041 {
00042 return $this->getConnection()->fetchOne("show tables like '{$this->getTable($table)}'");
00043 }
00044
00045 public function addAttribute($entityTypeId, $code, array $attr)
00046 {
00047 if (isset($this->_flatEntityTables[$entityTypeId]) && $this->_flatTableExist($this->_flatEntityTables[$entityTypeId])) {
00048 $this->_addFlatAttribute($this->_flatEntityTables[$entityTypeId], $code, $attr);
00049 }
00050 else {
00051 parent::addAttribute($entityTypeId, $code, $attr);
00052 }
00053 return $this;
00054 }
00055
00056 protected function _addFlatAttribute($table, $attribute, $attr)
00057 {
00058 $tableInfo = $this->getConnection()->describeTable($this->getTable($table));
00059 if (isset($tableInfo[$attribute])) {
00060 return $this;
00061 }
00062 $columnDefinition = '';
00063 $type = isset($attr['type']) ? $attr['type'] : 'varchar';
00064 $req = isset($attr['required']) ? $attr['required'] : false;
00065
00066 switch ($type) {
00067 case 'int':
00068 $columnDefinition = 'int(10) unsigned';
00069 break;
00070 case 'decimal':
00071 $columnDefinition = 'decimal(12,4)';
00072 break;
00073 case 'text':
00074 $columnDefinition = 'text';
00075 break;
00076 case 'date':
00077 $columnDefinition = 'datetime';
00078 break;
00079 default:
00080 $columnDefinition = 'varchar(255)';
00081 break;
00082 }
00083
00084 if ($req) {
00085 $columnDefinition.= ' NOT NULL';
00086 }
00087
00088 $this->getConnection()->addColumn($this->getTable($table), $attribute, $columnDefinition);
00089 return $this;
00090 }
00091
00092
00093
00094 public function getDefaultEntities()
00095 {
00096 return array(
00097 'quote'=>array(
00098 'entity_model' => 'sales/quote',
00099 'table' => 'sales/quote',
00100 'attributes' => array(
00101 'entity_id' => array('type'=>'static'),
00102 'is_active' => array('type'=>'static'),
00103 'store_id' => array('type'=>'static'),
00104 'remote_ip' => array('type'=>'static'),
00105 'checkout_method' => array('type'=>'static'),
00106 'password_hash' => array('type'=>'static'),
00107 'orig_order_id' => array('type'=>'static'),
00108 'converted_at' => array('type'=>'static'),
00109 'reserved_order_id' => array('type'=>'static'),
00110
00111 'coupon_code' => array('type'=>'static'),
00112 'global_currency_code' => array('type'=>'static'),
00113 'base_currency_code' => array('type'=>'static'),
00114 'store_currency_code' => array('type'=>'static'),
00115 'quote_currency_code' => array('type'=>'static'),
00116 'store_to_base_rate' => array('type'=>'static'),
00117 'store_to_quote_rate' => array('type'=>'static'),
00118 'base_to_global_rate' => array('type'=>'static'),
00119 'base_to_quote_rate' => array('type'=>'static'),
00120
00121 'items_count'=> array('type'=>'static'),
00122 'items_qty'=> array('type'=>'static'),
00123
00124 'grand_total' => array('type'=>'static'),
00125 'base_grand_total' => array('type'=>'static'),
00126
00127 'applied_rule_ids' => array('type'=>'static'),
00128
00129 'is_virtual' => array('type'=>'static'),
00130 'is_multi_shipping' => array('type'=>'static'),
00131
00132 'customer_id' => array('type'=>'static'),
00133 'customer_tax_class_id' => array('type'=>'static'),
00134 'customer_group_id' => array('type'=>'static'),
00135 'customer_email' => array('type'=>'static'),
00136 'customer_prefix' => array('type'=>'static'),
00137 'customer_firstname'=> array('type'=>'static'),
00138 'customer_middlename'=>array('type'=>'static'),
00139 'customer_lastname' => array('type'=>'static'),
00140 'customer_suffix' => array('type'=>'static'),
00141 'customer_note' => array('type'=>'static'),
00142 'customer_note_notify' => array('type'=>'static'),
00143 'customer_is_guest' => array('type'=>'static'),
00144 'customer_taxvat' => array('type'=>'static'),
00145 'customer_dob' => array('type'=>'static'),
00146 ),
00147 ),
00148
00149 'quote_item' => array(
00150 'entity_model' => 'sales/quote_item',
00151 'table' => 'sales/quote_item',
00152 'attributes' => array(
00153 'product_id' => array('type'=>'static'),
00154 'super_product_id' => array('type'=>'static'),
00155 'parent_product_id' => array('type'=>'static'),
00156 'sku' => array('type'=>'static'),
00157 'name' => array('type'=>'static'),
00158 'description' => array('type'=>'static'),
00159
00160 'weight' => array('type'=>'static'),
00161 'free_shipping' => array('type'=>'static'),
00162 'qty' => array('type'=>'static'),
00163 'is_qty_decimal'=> array('type'=>'static'),
00164
00165 'price' => array('type'=>'static'),
00166 'custom_price' => array('type'=>'static'),
00167 'discount_percent' => array('type'=>'static'),
00168 'discount_amount' => array('type'=>'static'),
00169 'no_discount' => array('type'=>'static'),
00170 'tax_percent' => array('type'=>'static'),
00171 'tax_amount' => array('type'=>'static'),
00172 'row_total' => array('type'=>'static'),
00173 'row_total_with_discount' => array('type'=>'static'),
00174
00175 'base_price' => array('type'=>'static'),
00176 'base_discount_amount' => array('type'=>'static'),
00177 'base_tax_amount' => array('type'=>'static'),
00178 'base_row_total' => array('type'=>'static'),
00179
00180 'row_weight' => array('type'=>'static'),
00181 'applied_rule_ids' => array('type'=>'static'),
00182 'additional_data' => array('type'=>'static'),
00183 ),
00184 ),
00185
00186 'quote_address' => array(
00187 'entity_model' => 'sales/quote_address',
00188 'table' => 'sales/quote_address',
00189 'attributes' => array(
00190 'address_type' => array('type'=>'static'),
00191
00192 'customer_id' => array('type'=>'static'),
00193 'customer_address_id' => array('type'=>'static'),
00194 'save_in_address_book' => array('type'=>'static'),
00195 'email' => array('type'=>'static'),
00196 'prefix' => array('type'=>'static'),
00197 'firstname' => array('type'=>'static'),
00198 'middlename'=> array('type'=>'static'),
00199 'lastname' => array('type'=>'static'),
00200 'suffix' => array('type'=>'static'),
00201 'company' => array('type'=>'static'),
00202 'street' => array('type'=>'static'),
00203 'city' => array('type'=>'static'),
00204 'region' => array('type'=>'static'),
00205 'region_id' => array('type'=>'static'),
00206 'postcode' => array('type'=>'static'),
00207 'country_id'=> array('type'=>'static'),
00208 'telephone' => array('type'=>'static'),
00209 'fax' => array('type'=>'static'),
00210
00211 'same_as_billing' => array('type'=>'static'),
00212 'free_shipping' => array('type'=>'static'),
00213 'weight' => array('type'=>'static'),
00214 'collect_shipping_rates' => array('type'=>'static'),
00215
00216 'shipping_method' => array('type'=>'static'),
00217 'shipping_description' => array('type'=>'static'),
00218
00219 'subtotal' => array('type'=>'static'),
00220 'subtotal_with_discount' => array('type'=>'static'),
00221 'tax_amount' => array('type'=>'static'),
00222 'shipping_amount' => array('type'=>'static'),
00223 'shipping_tax_amount' => array('type'=>'static'),
00224 'discount_amount' => array('type'=>'static'),
00225 'grand_total' => array('type'=>'static'),
00226
00227 'base_subtotal' => array('type'=>'static'),
00228 'base_subtotal_with_discount' => array('type'=>'static'),
00229 'base_tax_amount' => array('type'=>'static'),
00230 'base_shipping_amount' => array('type'=>'static'),
00231 'base_shipping_tax_amount' => array('type'=>'static'),
00232 'base_discount_amount' => array('type'=>'static'),
00233 'base_grand_total' => array('type'=>'static'),
00234
00235 'customer_notes' => array('type'=>'static'),
00236 'applied_taxes' => array('type'=>'text'),
00237 ),
00238 ),
00239 'quote_address_item' => array(
00240 'entity_model' => 'sales/quote_address_item',
00241 'table' =>'sales/quote_entity',
00242 'attributes' => array(
00243 'quote_item_id' => array('type'=>'int'),
00244 'product_id' => array('type'=>'int'),
00245 'super_product_id' => array('type'=>'int'),
00246 'parent_product_id' => array('type'=>'int'),
00247 'sku' => array(),
00248 'image' => array(),
00249 'name' => array(),
00250 'description' => array('type'=>'text'),
00251
00252 'weight' => array('type'=>'decimal'),
00253 'free_shipping' => array('type'=>'int'),
00254 'qty' => array('type'=>'decimal'),
00255 'is_qty_decimal'=> array('type'=>'int'),
00256
00257 'price' => array('type'=>'decimal'),
00258 'discount_percent' => array('type'=>'decimal'),
00259 'discount_amount' => array('type'=>'decimal'),
00260 'no_discount' => array('type'=>'int'),
00261 'tax_percent' => array('type'=>'decimal'),
00262 'tax_amount' => array('type'=>'decimal'),
00263 'row_total' => array('type'=>'decimal'),
00264 'row_total_with_discount' => array('type'=>'decimal'),
00265
00266 'base_price' => array('type'=>'decimal'),
00267 'base_discount_amount' => array('type'=>'decimal'),
00268 'base_tax_amount' => array('type'=>'decimal'),
00269 'base_row_total' => array('type'=>'decimal'),
00270
00271 'row_weight' => array('type'=>'decimal'),
00272 'applied_rule_ids' => array(),
00273 'additional_data' => array('type'=>'text'),
00274 ),
00275 ),
00276 'quote_address_rate' => array(
00277 'entity_model' => 'sales/quote_address_rate',
00278 'table' => 'sales/quote_entity',
00279 'attributes' => array(
00280 'code' => array(),
00281 'carrier' => array(),
00282 'carrier_title' => array(),
00283 'method' => array(),
00284 'method_description' => array('type'=>'text'),
00285 'price' => array('type'=>'decimal'),
00286 'error_message' => array('type'=>'text'),
00287 ),
00288 ),
00289 'quote_payment' => array(
00290 'entity_model' => 'sales/quote_payment',
00291 'table' =>'sales/quote_entity',
00292 'attributes' => array(
00293 'method' => array(),
00294 'additional_data' => array('type'=>'text'),
00295 'po_number' => array(),
00296 'cc_type' => array(),
00297 'cc_number_enc' => array(),
00298 'cc_last4' => array(),
00299 'cc_owner' => array(),
00300 'cc_exp_month' => array('type'=>'int'),
00301 'cc_exp_year' => array('type'=>'int'),
00302 'cc_cid_enc' => array(),
00303 'cc_ss_issue' => array(),
00304 'cc_ss_start_month' => array('type'=>'int'),
00305 'cc_ss_start_year' => array('type'=>'int'),
00306 ),
00307 ),
00308
00309 'order' => array(
00310 'entity_model' => 'sales/order',
00311 'table'=>'sales/order',
00312 'increment_model'=>'eav/entity_increment_numeric',
00313 'increment_per_store'=>true,
00314 'backend_prefix'=>'sales_entity/order_attribute_backend',
00315 'attributes' => array(
00316 'entity_id' => array(
00317 'type'=>'static',
00318 'backend'=>'sales_entity/order_attribute_backend_parent'
00319 ),
00320 'store_id' => array('type'=>'static'),
00321 'store_name' => array('type'=>'varchar'),
00322 'remote_ip' => array(),
00323
00324 'status' => array('type'=>'varchar'),
00325 'state' => array('type'=>'varchar'),
00326 'hold_before_status' => array('type'=>'varchar'),
00327 'hold_before_state' => array('type'=>'varchar'),
00328
00329 'relation_parent_id' => array('type'=>'varchar'),
00330 'relation_parent_real_id' => array('type'=>'varchar'),
00331 'relation_child_id' => array('type'=>'varchar'),
00332 'relation_child_real_id' => array('type'=>'varchar'),
00333 'original_increment_id' => array('type'=>'varchar'),
00334 'edit_increment' => array('type'=>'int'),
00335
00336 'ext_order_id' => array('type'=>'varchar'),
00337 'ext_customer_id' => array('type'=>'varchar'),
00338
00339 'quote_id' => array('type'=>'int'),
00340 'quote_address_id' => array('type'=>'int'),
00341 'billing_address_id' => array('type'=>'int', 'backend'=>'_billing'),
00342 'shipping_address_id' => array('type'=>'int', 'backend'=>'_shipping'),
00343
00344 'coupon_code' => array(),
00345 'applied_rule_ids' => array(),
00346 'giftcert_code' => array(),
00347
00348 'global_currency_code' => array(),
00349 'base_currency_code' => array(),
00350 'store_currency_code' => array(),
00351 'order_currency_code' => array(),
00352 'store_to_base_rate' => array('type'=>'decimal'),
00353 'store_to_order_rate' => array('type'=>'decimal'),
00354 'base_to_global_rate' => array('type'=>'decimal'),
00355 'base_to_order_rate' => array('type'=>'decimal'),
00356
00357 'is_virtual' => array('type'=>'int'),
00358
00359 'shipping_method' => array(),
00360 'shipping_description' => array(),
00361 'weight' => array('type'=>'decimal'),
00362
00363 'tax_amount' => array('type'=>'static'),
00364 'shipping_amount' => array('type'=>'static'),
00365 'shipping_tax_amount' => array('type'=>'static'),
00366 'discount_amount' => array('type'=>'static'),
00367 'giftcert_amount' => array('type'=>'decimal'),
00368
00369 'subtotal' => array('type'=>'static'),
00370 'grand_total' => array('type'=>'static'),
00371 'total_paid' => array('type'=>'static'),
00372 'total_due' => array('type'=>'decimal'),
00373 'total_refunded' => array('type'=>'static'),
00374 'total_qty_ordered' => array('type'=>'static'),
00375 'total_canceled' => array('type'=>'static'),
00376 'total_invoiced' => array('type'=>'static'),
00377 'total_online_refunded' => array('type'=>'static'),
00378 'total_offline_refunded'=> array('type'=>'static'),
00379 'adjustment_positive' => array('type'=>'decimal'),
00380 'adjustment_negative' => array('type'=>'decimal'),
00381
00382 'base_tax_amount' => array('type'=>'static'),
00383 'base_shipping_amount' => array('type'=>'static'),
00384 'base_shipping_tax_amount' => array('type'=>'static'),
00385 'base_discount_amount' => array('type'=>'static'),
00386 'base_giftcert_amount' => array('type'=>'decimal'),
00387
00388 'base_subtotal' => array('type'=>'static'),
00389 'base_grand_total' => array('type'=>'static'),
00390 'base_total_paid' => array('type'=>'static'),
00391 'base_total_due' => array('type'=>'decimal'),
00392 'base_total_refunded' => array('type'=>'static'),
00393 'base_total_qty_ordered' => array('type'=>'static'),
00394 'base_total_canceled' => array('type'=>'static'),
00395 'base_total_invoiced' => array('type'=>'static'),
00396 'base_total_online_refunded' => array('type'=>'static'),
00397 'base_total_offline_refunded'=> array('type'=>'static'),
00398 'base_adjustment_positive' => array('type'=>'decimal'),
00399 'base_adjustment_negative' => array('type'=>'decimal'),
00400
00401 'subtotal_refunded' => array('type'=>'static'),
00402 'subtotal_canceled' => array('type'=>'static'),
00403 'discount_refunded' => array('type'=>'static'),
00404 'discount_canceled' => array('type'=>'static'),
00405 'discount_invoiced' => array('type'=>'static'),
00406 'subtotal_invoiced' => array('type'=>'static'),
00407 'tax_refunded' => array('type'=>'static'),
00408 'tax_canceled' => array('type'=>'static'),
00409 'tax_invoiced' => array('type'=>'static'),
00410 'shipping_refunded' => array('type'=>'static'),
00411 'shipping_canceled' => array('type'=>'static'),
00412 'shipping_invoiced' => array('type'=>'static'),
00413 'base_subtotal_refunded' => array('type'=>'static'),
00414 'base_subtotal_canceled' => array('type'=>'static'),
00415 'base_discount_refunded' => array('type'=>'static'),
00416 'base_discount_canceled' => array('type'=>'static'),
00417 'base_discount_invoiced' => array('type'=>'static'),
00418 'base_subtotal_invoiced' => array('type'=>'static'),
00419 'base_tax_refunded' => array('type'=>'static'),
00420 'base_tax_canceled' => array('type'=>'static'),
00421 'base_tax_invoiced' => array('type'=>'static'),
00422 'base_shipping_refunded' => array('type'=>'static'),
00423 'base_shipping_canceled' => array('type'=>'static'),
00424 'base_shipping_invoiced' => array('type'=>'static'),
00425
00426 'customer_id' => array('type'=>'static', 'visible'=>false),
00427 'customer_group_id' => array('type'=>'int', 'visible'=>false),
00428 'customer_email' => array('type'=>'varchar', 'visible'=>false),
00429 'customer_prefix' => array('type'=>'varchar', 'visible'=>false),
00430 'customer_firstname'=> array('type'=>'varchar', 'visible'=>false),
00431 'customer_middlename' => array('type'=>'varchar', 'visible'=>false),
00432 'customer_lastname' => array('type'=>'varchar', 'visible'=>false),
00433 'customer_suffix' => array('type'=>'varchar', 'visible'=>false),
00434 'customer_note' => array('type'=>'text', 'visible'=>false),
00435 'customer_note_notify' => array('type'=>'int', 'visible'=>false),
00436 'customer_is_guest' => array('type'=>'int', 'visible'=>false),
00437 'email_sent' => array('type'=>'int', 'visible'=>false),
00438 'customer_taxvat' => array('type'=>'varchar', 'visible'=>false),
00439 'customer_dob' => array('type'=>'datetime', 'backend'=>'eav/entity_attribute_backend_datetime'),
00440 ),
00441 ),
00442 'order_address' => array(
00443 'entity_model' => 'sales/order_address',
00444 'table'=>'sales/order_entity',
00445 'attributes' => array(
00446 'parent_id' => array('type'=>'static', 'backend'=>'sales_entity/order_attribute_backend_child'),
00447 'quote_address_id' => array('type'=>'int'),
00448 'address_type' => array(),
00449 'customer_id' => array('type'=>'int'),
00450 'customer_address_id' => array('type'=>'int'),
00451 'email' => array(),
00452 'prefix' => array(),
00453 'firstname' => array(),
00454 'middlename'=> array(),
00455 'lastname' => array(),
00456 'suffix' => array(),
00457 'company' => array(),
00458 'street' => array(),
00459 'city' => array(),
00460 'region' => array(),
00461 'region_id' => array('type'=>'int'),
00462 'postcode' => array(),
00463 'country_id'=> array('type'=>'varchar'),
00464 'telephone' => array(),
00465 'fax' => array(),
00466
00467 ),
00468 ),
00469 'order_item' => array(
00470 'entity_model' => 'sales/order_item',
00471 'table'=>'sales/order_entity',
00472 'attributes' => array(
00473 'parent_id' => array(
00474 'type'=>'static',
00475 'backend'=>'sales_entity/order_attribute_backend_child'
00476 ),
00477
00478 'quote_item_id' => array('type'=>'int'),
00479 'product_id' => array('type'=>'int'),
00480 'super_product_id' => array('type'=>'int'),
00481 'parent_product_id' => array('type'=>'int'),
00482 'is_virtual' => array('type'=>'int'),
00483 'sku' => array(),
00484 'name' => array(),
00485 'description' => array('type'=>'text'),
00486 'weight' => array('type'=>'decimal'),
00487
00488 'is_qty_decimal' => array('type'=>'int'),
00489 'qty_ordered' => array('type'=>'decimal'),
00490 'qty_backordered' => array('type'=>'decimal'),
00491 'qty_invoiced' => array('type'=>'decimal'),
00492 'qty_canceled' => array('type'=>'decimal'),
00493 'qty_shipped' => array('type'=>'decimal'),
00494 'qty_refunded' => array('type'=>'decimal'),
00495
00496 'original_price' => array('type'=>'decimal'),
00497 'price' => array('type'=>'decimal'),
00498 'cost' => array('type'=>'decimal'),
00499
00500 'discount_percent' => array('type'=>'decimal'),
00501 'discount_amount' => array('type'=>'decimal'),
00502 'discount_invoiced' => array('type'=>'decimal'),
00503
00504 'tax_percent' => array('type'=>'decimal'),
00505 'tax_amount' => array('type'=>'decimal'),
00506 'tax_invoiced' => array('type'=>'decimal'),
00507
00508 'row_total' => array('type'=>'decimal'),
00509 'row_weight' => array('type'=>'decimal'),
00510 'row_invoiced' => array('type'=>'decimal'),
00511 'invoiced_total' => array('type'=>'decimal'),
00512 'amount_refunded' => array('type'=>'decimal'),
00513
00514 'base_price' => array('type'=>'decimal'),
00515 'base_original_price' => array('type'=>'decimal'),
00516 'base_discount_amount' => array('type'=>'decimal'),
00517 'base_discount_invoiced' => array('type'=>'decimal'),
00518 'base_tax_amount' => array('type'=>'decimal'),
00519 'base_tax_invoiced' => array('type'=>'decimal'),
00520 'base_row_total' => array('type'=>'decimal'),
00521 'base_row_invoiced' => array('type'=>'decimal'),
00522 'base_invoiced_total' => array('type'=>'decimal'),
00523 'base_amount_refunded' => array('type'=>'decimal'),
00524
00525 'applied_rule_ids' => array(),
00526 'additional_data' => array('type'=>'text'),
00527 ),
00528 ),
00529 'order_payment' => array(
00530 'entity_model' => 'sales/order_payment',
00531 'table'=>'sales/order_entity',
00532 'attributes' => array(
00533 'parent_id' => array(
00534 'type'=>'static',
00535 'backend'=>'sales_entity/order_attribute_backend_child'
00536 ),
00537 'quote_payment_id' => array('type'=>'int'),
00538 'method' => array(),
00539 'additional_data' => array('type'=>'text'),
00540 'last_trans_id' => array(),
00541 'po_number' => array(),
00542
00543 'cc_type' => array(),
00544 'cc_number_enc' => array(),
00545 'cc_last4' => array(),
00546 'cc_owner' => array(),
00547 'cc_exp_month' => array(),
00548 'cc_exp_year' => array(),
00549
00550 'cc_ss_issue' => array(),
00551 'cc_ss_start_month' => array(),
00552 'cc_ss_start_year' => array(),
00553
00554 'cc_status' => array(),
00555 'cc_status_description' => array(),
00556 'cc_trans_id' => array(),
00557 'cc_approval' => array(),
00558 'cc_avs_status' => array(),
00559 'cc_cid_status' => array(),
00560
00561 'cc_debug_request_body' => array(),
00562 'cc_debug_response_body'=> array(),
00563 'cc_debug_response_serialized' => array(),
00564
00565 'anet_trans_method' => array(),
00566 'echeck_routing_number' => array(),
00567 'echeck_bank_name' => array(),
00568 'echeck_account_type' => array(),
00569 'echeck_account_name' => array(),
00570 'echeck_type' => array(),
00571
00572 'amount_ordered' => array('type'=>'decimal'),
00573 'amount_authorized' => array('type'=>'decimal'),
00574 'amount_paid' => array('type'=>'decimal'),
00575 'amount_canceled' => array('type'=>'decimal'),
00576 'amount_refunded' => array('type'=>'decimal'),
00577 'shipping_amount' => array('type'=>'decimal'),
00578 'shipping_captured' => array('type'=>'decimal'),
00579 'shipping_refunded' => array('type'=>'decimal'),
00580
00581 'base_amount_ordered' => array('type'=>'decimal'),
00582 'base_amount_authorized' => array('type'=>'decimal'),
00583 'base_amount_paid' => array('type'=>'decimal'),
00584 'base_amount_canceled' => array('type'=>'decimal'),
00585 'base_amount_refunded' => array('type'=>'decimal'),
00586 'base_shipping_amount' => array('type'=>'decimal'),
00587 'base_shipping_captured' => array('type'=>'decimal'),
00588 'base_shipping_refunded' => array('type'=>'decimal'),
00589 ),
00590 ),
00591
00592 'order_status_history' => array(
00593 'entity_model' => 'sales/order_status_history',
00594 'table'=>'sales/order_entity',
00595 'attributes' => array(
00596 'parent_id' => array(
00597 'type'=>'static',
00598 'backend'=>'sales_entity/order_attribute_backend_child'
00599 ),
00600 'status' => array('type'=>'varchar'),
00601 'comment' => array('type'=>'text'),
00602 'is_customer_notified' => array('type'=>'int'),
00603 ),
00604 ),
00605
00606 'invoice' => array(
00607 'entity_model' => 'sales/order_invoice',
00608 'table' =>'sales/order_entity',
00609 'increment_model' =>'eav/entity_increment_numeric',
00610 'increment_per_store'=>true,
00611 'backend_prefix' =>'sales_entity/order_attribute_backend',
00612 'attributes' => array(
00613 'entity_id' => array(
00614 'type'=>'static',
00615 'backend'=>'sales_entity/order_invoice_attribute_backend_parent'
00616 ),
00617
00618 'state' => array('type'=>'int'),
00619 'is_used_for_refund' => array('type'=>'int'),
00620 'transaction_id' => array(),
00621
00622
00623 'order_id' => array(
00624 'type'=>'int',
00625 'backend'=>'sales_entity/order_invoice_attribute_backend_order'
00626 ),
00627
00628 'billing_address_id' => array('type'=>'int'),
00629 'shipping_address_id' => array('type'=>'int'),
00630
00631 'global_currency_code' => array(),
00632 'base_currency_code' => array(),
00633 'store_currency_code' => array(),
00634 'order_currency_code' => array(),
00635 'store_to_base_rate' => array('type'=>'decimal'),
00636 'store_to_order_rate' => array('type'=>'decimal'),
00637 'base_to_global_rate' => array('type'=>'decimal'),
00638 'base_to_order_rate' => array('type'=>'decimal'),
00639
00640 'subtotal' => array('type'=>'decimal'),
00641 'discount_amount' => array('type'=>'decimal'),
00642 'tax_amount' => array('type'=>'decimal'),
00643 'shipping_amount' => array('type'=>'decimal'),
00644 'grand_total' => array('type'=>'decimal'),
00645 'total_qty' => array('type'=>'decimal'),
00646
00647 'can_void_flag' => array('type'=>'int'),
00648
00649 'base_subtotal' => array('type'=>'decimal'),
00650 'base_discount_amount' => array('type'=>'decimal'),
00651 'base_tax_amount' => array('type'=>'decimal'),
00652 'base_shipping_amount' => array('type'=>'decimal'),
00653 'base_grand_total' => array('type'=>'decimal'),
00654 'email_sent' => array('type'=>'int'),
00655 'store_id' => array('type'=>'static'),
00656 ),
00657 ),
00658
00659 'invoice_item' => array(
00660 'entity_model' => 'sales/order_invoice_item',
00661
00662 'table'=>'sales/order_entity',
00663 'attributes' => array(
00664 'parent_id' => array(
00665 'type'=>'static',
00666 'backend'=>'sales_entity/order_invoice_attribute_backend_child'
00667 ),
00668 'order_item_id' => array('type'=>'int'),
00669 'product_id' => array('type'=>'int'),
00670 'name' => array(),
00671 'description' => array('type'=>'text'),
00672 'sku' => array(),
00673 'qty' => array('type'=>'decimal'),
00674 'cost' => array('type'=>'decimal'),
00675 'price' => array('type'=>'decimal'),
00676 'discount_amount' => array('type'=>'decimal'),
00677 'tax_amount' => array('type'=>'decimal'),
00678 'row_total' => array('type'=>'decimal'),
00679
00680 'base_price' => array('type'=>'decimal'),
00681 'base_discount_amount' => array('type'=>'decimal'),
00682 'base_tax_amount' => array('type'=>'decimal'),
00683 'base_row_total' => array('type'=>'decimal'),
00684
00685 'additional_data' => array('type'=>'text'),
00686 ),
00687 ),
00688
00689 'invoice_comment' => array(
00690 'entity_model' => 'sales/order_invoice_comment',
00691 'table'=>'sales/order_entity',
00692 'attributes' => array(
00693 'parent_id' => array(
00694 'type'=>'static',
00695 'backend'=>'sales_entity/order_invoice_attribute_backend_child'
00696 ),
00697 'comment' => array('type'=>'text'),
00698 'is_customer_notified' => array('type'=>'int'),
00699 ),
00700 ),
00701
00702
00703
00704 'shipment' => array(
00705 'entity_model' => 'sales/order_shipment',
00706
00707 'table'=>'sales/order_entity',
00708 'increment_model'=>'eav/entity_increment_numeric',
00709 'increment_per_store'=>true,
00710 'backend_prefix'=>'sales_entity/order_attribute_backend',
00711 'attributes' => array(
00712 'entity_id' => array(
00713 'type'=>'static',
00714 'backend'=>'sales_entity/order_shipment_attribute_backend_parent'
00715 ),
00716
00717 'customer_id' => array('type'=>'int'),
00718 'order_id' => array('type'=>'int'),
00719 'shipment_status' => array('type'=>'int'),
00720 'billing_address_id' => array('type'=>'int'),
00721 'shipping_address_id' => array('type'=>'int'),
00722
00723 'total_qty' => array('type'=>'decimal'),
00724 'total_weight' => array('type'=>'decimal'),
00725 'email_sent' => array('type'=>'int'),
00726 'store_id' => array('type' => 'static'),
00727 ),
00728 ),
00729
00730 'shipment_item' => array(
00731 'entity_model' => 'sales/order_shipment_item',
00732
00733 'table'=>'sales/order_entity',
00734 'attributes' => array(
00735 'parent_id' => array(
00736 'type'=>'static',
00737 'backend'=>'sales_entity/order_shipment_attribute_backend_child'
00738 ),
00739 'order_item_id' => array('type'=>'int'),
00740 'product_id' => array('type'=>'int'),
00741 'name' => array(),
00742 'description' => array('type'=>'text'),
00743 'sku' => array(),
00744 'qty' => array('type'=>'decimal'),
00745 'price' => array('type'=>'decimal'),
00746 'weight' => array('type'=>'decimal'),
00747 'row_total' => array('type'=>'decimal'),
00748
00749 'additional_data' => array('type'=>'text'),
00750 ),
00751 ),
00752
00753 'shipment_comment' => array(
00754 'entity_model' => 'sales/order_shipment_comment',
00755 'table'=>'sales/order_entity',
00756 'attributes' => array(
00757 'parent_id' => array(
00758 'type'=>'static',
00759 'backend'=>'sales_entity/order_shipment_attribute_backend_child'
00760 ),
00761 'comment' => array('type'=>'text'),
00762 'is_customer_notified' => array('type'=>'int'),
00763 ),
00764 ),
00765
00766 'shipment_track' => array(
00767 'entity_model' => 'sales/order_shipment_track',
00768 'table'=>'sales/order_entity',
00769 'attributes' => array(
00770 'parent_id' => array(
00771 'type'=>'static',
00772 'backend'=>'sales_entity/order_shipment_attribute_backend_child'
00773 ),
00774 'order_id' => array('type'=>'int'),
00775 'number' => array('type'=>'text'),
00776 'carrier_code' => array('type'=>'varchar'),
00777 'title' => array('type'=>'varchar'),
00778 'description' => array('type'=>'text'),
00779 'qty' => array('type'=>'decimal'),
00780 'weight' => array('type'=>'decimal'),
00781 ),
00782 ),
00783
00784 'creditmemo' => array(
00785 'entity_model' => 'sales/order_creditmemo',
00786
00787 'table'=>'sales/order_entity',
00788 'increment_model'=>'eav/entity_increment_numeric',
00789 'increment_per_store'=>true,
00790 'backend_prefix'=>'sales_entity/order_attribute_backend',
00791 'attributes' => array(
00792 'entity_id' => array(
00793 'type'=>'static',
00794 'backend'=>'sales_entity/order_creditmemo_attribute_backend_parent'
00795 ),
00796 'state' => array('type'=>'int'),
00797 'invoice_id' => array('type'=>'int'),
00798 'transaction_id'=> array(),
00799
00800 'order_id' => array('type'=>'int'),
00801 'creditmemo_status' => array('type'=>'int'),
00802 'billing_address_id' => array('type'=>'int'),
00803 'shipping_address_id' => array('type'=>'int'),
00804
00805 'global_currency_code' => array(),
00806 'base_currency_code' => array(),
00807 'store_currency_code' => array(),
00808 'order_currency_code' => array(),
00809 'store_to_base_rate' => array('type'=>'decimal'),
00810 'store_to_order_rate' => array('type'=>'decimal'),
00811 'base_to_global_rate' => array('type'=>'decimal'),
00812 'base_to_order_rate' => array('type'=>'decimal'),
00813
00814 'subtotal' => array('type'=>'decimal'),
00815 'discount_amount' => array('type'=>'decimal'),
00816 'tax_amount' => array('type'=>'decimal'),
00817 'shipping_amount' => array('type'=>'decimal'),
00818 'adjustment' => array('type'=>'decimal'),
00819 'adjustment_positive' => array('type'=>'decimal'),
00820 'adjustment_negative' => array('type'=>'decimal'),
00821 'grand_total' => array('type'=>'decimal'),
00822
00823 'base_subtotal' => array('type'=>'decimal'),
00824 'base_discount_amount' => array('type'=>'decimal'),
00825 'base_tax_amount' => array('type'=>'decimal'),
00826 'base_shipping_amount' => array('type'=>'decimal'),
00827 'base_adjustment' => array('type'=>'decimal'),
00828 'base_adjustment_positive' => array('type'=>'decimal'),
00829 'base_adjustment_negative' => array('type'=>'decimal'),
00830 'base_grand_total' => array('type'=>'decimal'),
00831 'email_sent' => array('type' => 'int'),
00832 'store_id' => array('type' => 'static'),
00833 ),
00834 ),
00835
00836 'creditmemo_item' => array(
00837 'entity_model' => 'sales/order_creditmemo_item',
00838
00839 'table'=>'sales/order_entity',
00840 'attributes' => array(
00841 'parent_id' => array(
00842 'type'=>'static',
00843 'backend'=>'sales_entity/order_creditmemo_attribute_backend_child'
00844 ),
00845 'order_item_id' => array('type'=>'int'),
00846 'product_id' => array('type'=>'int'),
00847 'name' => array(),
00848 'description' => array('type'=>'text'),
00849 'sku' => array(),
00850 'qty' => array('type'=>'decimal'),
00851 'cost' => array('type'=>'decimal'),
00852 'price' => array('type'=>'decimal'),
00853 'discount_amount' => array('type'=>'decimal'),
00854 'tax_amount' => array('type'=>'decimal'),
00855 'row_total' => array('type'=>'decimal'),
00856
00857 'base_price' => array('type'=>'decimal'),
00858 'base_discount_amount' => array('type'=>'decimal'),
00859 'base_tax_amount' => array('type'=>'decimal'),
00860 'base_row_total' => array('type'=>'decimal'),
00861
00862 'additional_data' => array('type'=>'text'),
00863 ),
00864 ),
00865
00866 'creditmemo_comment' => array(
00867 'entity_model' => 'sales/order_creditmemo_comment',
00868 'table'=>'sales/order_entity',
00869 'attributes' => array(
00870 'parent_id' => array(
00871 'type'=>'static',
00872 'backend'=>'sales_entity/order_creditmemo_attribute_backend_child'
00873 ),
00874 'comment' => array('type'=>'text'),
00875 'is_customer_notified' => array('type'=>'int'),
00876 ),
00877 ),
00878
00879 );
00880 }
00881 }