Last active
April 4, 2017 10:32
-
-
Save sprightly/93e122d219a5c68df39186ed1b434d40 to your computer and use it in GitHub Desktop.
OroCRM generate carts for magento bundle at mysql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DELIMITER // | |
| DROP PROCEDURE IF EXISTS `generateMagentoCarts`; | |
| CREATE PROCEDURE `generateMagentoCarts` (IN startId INT, amount INT) | |
| BEGIN | |
| DECLARE cartId, orderId, workflowItemId, secondWorkflowItemId INT; | |
| WHILE startId < amount DO | |
| INSERT INTO orocrm_magento_cart (ac_last_contact_date, ac_last_contact_date_in, ac_last_contact_date_out, ac_contact_count, ac_contact_count_in, ac_contact_count_out, serialized_data, items_qty, items_count, base_currency_code, store_currency_code, quote_currency_code, store_to_base_rate, store_to_quote_rate, email, gift_message, is_guest, payment_details, notes, status_message, imported_at, synced_at, sub_total, grand_total, tax_amount, createdAt, updatedAt, origin_id, first_name, last_name, customer_id, store_id, shipping_address_id, billing_address_id, status_name, opportunity_id, user_owner_id, organization_id, channel_id, data_channel_id) VALUES (NULL, NULL, NULL, NULL, NULL, NULL, 'Tjs=', '2', 2, 'USD', 'USD', 'USD', '1', '1', 'FrankJClarke@gustr.com', NULL, 0, NULL, NULL, NULL, NULL, NULL, '397.776276', '397.776276', '30.756276', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, startId, 'Frank', 'Clarke', 3, 1, NULL, NULL, 'open', NULL, 22, 1, 2, 2); | |
| SET cartId = LAST_INSERT_ID(); | |
| INSERT INTO orocrm_magento_cart_item (serialized_data, product_id, parent_item_id, free_shipping, gift_message, tax_class_id, description, is_virtual, custom_price, price_incl_tax, row_total, tax_amount, product_type, product_image_url, product_url, is_removed, sku, name, qty, price, discount_amount, tax_percent, weight, createdAt, updatedAt, origin_id, cart_id, owner_id, channel_id) VALUES ('Tjs=', 20, NULL, '0', NULL, NULL, NULL, 0, NULL, '210.354742', '210.354742', '16.264742', 'simple', NULL, NULL, 0, 'sku-two_year_extended_warranty_-_parts_and_labor', 'Two Year Extended Warranty - Parts and Labor', '1', '194.09', '0', '0.0838', NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 1, cartId, 1, NULL); | |
| INSERT INTO orocrm_magento_cart_item (serialized_data, product_id, parent_item_id, free_shipping, gift_message, tax_class_id, description, is_virtual, custom_price, price_incl_tax, row_total, tax_amount, product_type, product_image_url, product_url, is_removed, sku, name, qty, price, discount_amount, tax_percent, weight, createdAt, updatedAt, origin_id, cart_id, owner_id, channel_id) VALUES ('Tjs=', 69, NULL, '0', NULL, NULL, NULL, 0, NULL, '187.421534', '187.421534', '14.491534', 'simple', NULL, NULL, 0, 'sku-computer', 'Computer', '1', '172.93', '0', '0.0838', NULL, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 2, cartId, 1, NULL); | |
| SET orderId = LAST_INSERT_ID(); | |
| INSERT INTO orocrm_magento_order (ac_last_contact_date, ac_last_contact_date_in, ac_last_contact_date_out, ac_contact_count, ac_contact_count_in, ac_contact_count_out, serialized_data, increment_id, is_virtual, is_guest, gift_message, remote_ip, store_name, total_paid_amount, total_invoiced_amount, total_refunded_amount, total_canceled_amount, notes, feedback, customer_email, coupon_code, imported_at, synced_at, currency, payment_method, payment_details, subtotal_amount, shipping_amount, shipping_method, tax_amount, discount_amount, discount_percent, total_amount, status, created_at, updated_at, first_name, last_name, customer_id, store_id, cart_id, user_owner_id, organization_id, channel_id, data_channel_id) VALUES (NULL, NULL, NULL, NULL, NULL, NULL, 'Tjs=', startId, 0, 0, NULL, NULL, 'Admin', '0', '397.776276', '0', '0', NULL, NULL, NULL, NULL, NULL, NULL, 'USD', 'Checkmo', 'Card[MC]', '397.776276', '10', 'flatrate_flatrate', NULL, NULL, NULL, '397.776276', 'Pending', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 'Frank', 'Clarke', 3, 1, cartId, 22, 1, 2, 2); | |
| SET orderId = LAST_INSERT_ID(); | |
| INSERT INTO orocrm_magento_order_address (serialized_data, fax, phone, street, city, postal_code, organization, region_text, first_name, last_name, origin_id, owner_id, country_code, region_code, channel_id) VALUES ('Tjs=', NULL, NULL, 'First street', 'City', '123456', NULL, NULL, 'John', 'Doe', NULL, orderId, 'US', 'US-AK', NULL); | |
| INSERT INTO orocrm_magento_order_items (serialized_data, product_type, product_options, is_virtual, original_price, discount_percent, name, sku, qty, price, weight, tax_percent, tax_amount, discount_amount, row_total, origin_id, order_id, owner_id, channel_id) VALUES ('Tjs=', 'simple', NULL, 0, '194.09', NULL, 'Two Year Extended Warranty - Parts and Labor', 'sku-two_year_extended_warranty_-_parts_and_labor', '1', '194.09', NULL, '0.0838', '16.264742', NULL, '210.354742', 1, orderId, 1, NULL); | |
| INSERT INTO orocrm_magento_order_items (serialized_data, product_type, product_options, is_virtual, original_price, discount_percent, name, sku, qty, price, weight, tax_percent, tax_amount, discount_amount, row_total, origin_id, order_id, owner_id, channel_id) VALUES ('Tjs=', 'simple', NULL, 0, '172.93', NULL, 'Computer', 'sku-computer', '1', '172.93', NULL, '0.0838', '14.491534', NULL, '187.421534', 2, orderId, 1, NULL); | |
| INSERT INTO oro_workflow_item (serialized_data, workflow_name, entity_id, entity_class, created, updated, data, current_step_id) VALUES ('Tjs=', 'b2c_flow_abandoned_shopping_cart', cartId, 'Oro\\Bundle\\MagentoBundle\\Entity\\Cart', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, NULL, 20); | |
| SET workflowItemId = LAST_INSERT_ID(); | |
| INSERT INTO oro_workflow_transition_log (transition, transition_date, workflow_item_id, step_from_id, step_to_id) VALUES ('__start__', CURRENT_TIMESTAMP, workflowItemId, NULL, 20); | |
| INSERT INTO orocrm_channel_lifetime_hist (status, amount, created_at, data_channel_id, account_id) VALUES (1, '594.4752', CURRENT_TIMESTAMP, 2, 3); | |
| INSERT INTO oro_workflow_item (serialized_data, workflow_name, entity_id, entity_class, created, updated, data, current_step_id) VALUES ('Tjs=', 'b2c_flow_order_follow_up', orderId, 'Oro\\Bundle\\MagentoBundle\\Entity\\Order', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, NULL, 24); | |
| SET secondWorkflowItemId = LAST_INSERT_ID(); | |
| INSERT INTO oro_workflow_transition_log (transition, transition_date, workflow_item_id, step_from_id, step_to_id) VALUES ('__start__', CURRENT_TIMESTAMP, secondWorkflowItemId, NULL, 24); | |
| SET startId = startId + 1; | |
| END WHILE; | |
| END // |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment