Skip to content

Commit

Permalink
Tuning and fixed some issues to support large data
Browse files Browse the repository at this point in the history
  • Loading branch information
quynhvv committed Nov 28, 2015
1 parent b566629 commit 6055bb9
Show file tree
Hide file tree
Showing 15 changed files with 234 additions and 137 deletions.
2 changes: 1 addition & 1 deletion js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
$('INPUT[name="select_all_sales_object"]').on('change', function(){
$('INPUT[name="selected_objects[]"]').prop('checked', this.checked);
});
$('INPUT[name="select_all_sales_object"]').prop('checked', true).trigger('change');
//$('INPUT[name="select_all_sales_object"]').prop('checked', true).trigger('change');

//check/un-check review/rating objects
$('INPUT[name="select_all_object"]').on('change', function(){
Expand Down
12 changes: 5 additions & 7 deletions protected/components/views/userMenu.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<ul class="nav nav-pills nav-stacked">
<?php if (is_array($steps)): ?>
<?php foreach ($steps as $step): ?>

<?php
$action = Yii::app()->controller->action->id;
$class = ($action == $step->code) ? "active" : (($step->status != MigrateSteps::STATUS_DONE) ? "disabled" : "");
Expand All @@ -10,8 +9,7 @@
$title = '<span class="glyphicon glyphicon-ok-sign text-success"></span> '.$title;
}
?>

<li class="<?=$class?>">
<li class="<?php echo $class?>">
<?php echo CHtml::link($title, array("migrate/{$step->code}")); ?>
</li>
<?php endforeach; ?>
Expand All @@ -24,9 +22,9 @@
$totalStepsFinished = MigrateSteps::model()->count("status = ".MigrateSteps::STATUS_DONE);
$percent = round(($totalStepsFinished/$totalSteps)*100);
?>
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="<?=$percent?>"
aria-valuemin="0" aria-valuemax="100" style="width:<?=$percent?>%">
<?=$percent?>% Completed
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="<?php echo $percent?>"
aria-valuemin="0" aria-valuemax="100" style="width:<?php echo $percent?>%">
<?php echo $percent?>% Completed
</div>
</div>

Expand All @@ -38,5 +36,5 @@
$class = "btn btn-danger disabled";
}
?>
<a href="<?php echo Yii::app()->createUrl("migrate/resetAll"); ?>" title="<?php echo Yii::t('frontend', 'Click to reset all steps.'); ?>" class="<?php echo $class; ?>"><?php echo Yii::t('frontend', 'Reset All'); ?></a>
<a href="<?php echo Yii::app()->createUrl("migrate/resetAll"); ?>" title="<?php echo Yii::t('frontend', 'Click to reset all steps.'); ?>" class="<?php echo $class; ?>"><span class="glyphicon glyphicon-refresh"></span> <?php echo Yii::t('frontend', 'Reset All'); ?></a>
</div>
2 changes: 1 addition & 1 deletion protected/config/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
require(dirname(__FILE__) . '/config.php'), array(

'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
'name'=>'Migrate Data Tool: Allow migrate data from Magento community 1.x to Magento 2.x',
'name'=>'Migrate Data Tool: Allow migrate data from Magento CE 1.x to Magento CE 2.x',

// preloading 'log' component
'preload'=>array('log'),
Expand Down
298 changes: 195 additions & 103 deletions protected/controllers/MigrateController.php

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions protected/views/layouts/main.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@
<div class="row">
<div id="header">
<div id="logo"><?php echo CHtml::encode(Yii::app()->name); ?></div>
</div><!-- header -->
</div>
<!--// header -->
<?php echo $content; ?>

<div id="footer">
Copyright &copy; <?php echo date('Y'); ?> by <a href="http://www.ubertheme.com/" target="_blank">UberTheme</a>.<br/>
All Rights Reserved.<br/>
<?php echo Yii::powered(); ?>
<div id="report-bugs"><a target="_blank" href="https://github.com/ubertheme/magento2_data_migration/issues" title="<?php echo Yii::t('frontend', 'Report Bugs')?>"><?php echo Yii::t('frontend', 'Report Bugs')?></a></div>
<div id="report-bugs"><a target="_blank" href="https://bitbucket.org/ubertheme/module-ubdatamigration/issues" title="<?php echo Yii::t('frontend', 'Report Bugs')?>"><?php echo Yii::t('frontend', 'Report Bugs')?></a></div>
</div><!-- footer -->
</div>
</div><!-- page -->
Expand All @@ -38,6 +40,7 @@
<div>
<img src="<?php echo Yii::app()->request->baseUrl; ?>/css/images/loading.gif"/>
<?php echo Yii::t('frontend', 'Data processing. Please wait…'); ?>
<i>(<?php echo Yii::t('frontend', 'If your data up to 2000+ records, this task can take some hours to finished.'); ?>)</i>
</div>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions protected/views/migrate/_frmButtons.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<!-- Form Buttons-->
<div class="step-controls">
<a href="<?php echo Yii::app()->createUrl("migrate/reset/step/" . $step->sorder); ?>" class="btn btn-danger"><span class="glyphicon glyphicon-refresh"></span> <?php echo Yii::t('frontend', 'Reset'); ?></a>
<?php if ($step->status == MigrateSteps::STATUS_NOT_DONE): ?>
<button type="submit" class="btn btn-primary"><?php echo Yii::t('frontend', 'Start'); ?></button>
<button type="submit" class="btn btn-primary"><span class="glyphicon glyphicon-play-circle"></span> <?php echo Yii::t('frontend', 'Start'); ?></button>
<?php else: ?>
<a href="<?php echo Yii::app()->createUrl("migrate/reset/step/" . $step->sorder); ?>" class="btn btn-danger"><?php echo Yii::t('frontend', 'Reset'); ?></a>
<?php if ($step->sorder <= 8): ?>
<a href="<?php echo Yii::app()->createUrl("migrate/step" . ($step->sorder+1)); ?>" class="btn btn-primary"><?php echo Yii::t('frontend', 'Next Step'); ?></a>
<a href="<?php echo Yii::app()->createUrl("migrate/step" . ($step->sorder+1)); ?>" class="btn btn-primary"><span class="glyphicon glyphicon-forward"></span> <?php echo Yii::t('frontend', 'Next Step'); ?></a>
<?php endif; ?>
<?php endif; ?>
</div>
Expand Down
8 changes: 4 additions & 4 deletions protected/views/migrate/step1.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php $this->pageTitle = $step->title . ' - ' . Yii::app()->name; ?>

<h1 class="page-header"> Step <?=$step->sorder?>: <?=$step->title?> </h1>
<h1 class="page-header"> Step <?php echo $step->sorder?>: <?php echo $step->title?> </h1>

<form id="frm-settings" data-toggle="validator" role="form" method="post" action="<?php echo Yii::app()->createUrl("migrate/step{$step->sorder}"); ?>">

Expand Down Expand Up @@ -79,10 +79,10 @@
<!-- Form Buttons-->
<div class="step-controls">
<?php if ($step->status == MigrateSteps::STATUS_NOT_DONE): ?>
<button type="submit" id="step-<?php echo $step->sorder; ?>" class="btn btn-primary need-validate-form"><?php echo Yii::t('frontend', 'Save'); ?></button>
<button type="submit" id="step-<?php echo $step->sorder; ?>" class="btn btn-primary need-validate-form"><span class="glyphicon glyphicon-save"></span> <?php echo Yii::t('frontend', 'Save'); ?></button>
<?php else: ?>
<button type="submit" id="step-<?php echo $step->sorder; ?>" class="btn btn-danger need-validate-form"><?php echo Yii::t('frontend', 'Update'); ?></button>
<a href="<?php echo Yii::app()->createUrl("migrate/step" . ($step->sorder+1)); ?>" class="btn btn-primary"><?php echo Yii::t('frontend', 'Next Step'); ?></a>
<button type="submit" id="step-<?php echo $step->sorder; ?>" class="btn btn-danger need-validate-form"><span class="glyphicon glyphicon-save"></span> <?php echo Yii::t('frontend', 'Update'); ?></button>
<a href="<?php echo Yii::app()->createUrl("migrate/step" . ($step->sorder+1)); ?>" class="btn btn-primary"><span class="glyphicon glyphicon-forward"></span> <?php echo Yii::t('frontend', 'Next Step'); ?></a>
<?php endif; ?>
</div>
<!--// Form Buttons-->
Expand Down
8 changes: 4 additions & 4 deletions protected/views/migrate/step2.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php $this->pageTitle = $step->title . ' - ' . Yii::app()->name; ?>

<h1 class="page-header"> Step <?=$step->sorder?>: <?=$step->title?> </h1>
<h1 class="page-header"> Step <?php echo $step->sorder?>: <?php echo $step->title?> </h1>

<form role="form" method="post" action="<?php echo Yii::app()->createUrl("migrate/step{$step->sorder}"); ?>">

Expand All @@ -21,7 +21,7 @@
<span class="glyphicon glyphicon-ok-sign text-success"></span>
<?php endif; ?>
<label class="checkbox-inline">
<input type="checkbox" id="website-<?php echo $website->website_id; ?>" <?php echo ($checked) ? "checked" : ''; ?> name="website_ids[]" value="<?=$website->website_id?>" />
<input type="checkbox" id="website-<?php echo $website->website_id; ?>" <?php echo ($checked) ? "checked" : ''; ?> name="website_ids[]" value="<?php echo $website->website_id?>" />
<?php echo $website->name; ?>
</label>
</h4>
Expand All @@ -42,7 +42,7 @@
<span class="glyphicon glyphicon-ok-sign text-success"></span>
<?php endif; ?>
<label class="checkbox-inline">
<input type="checkbox" id="store-group-<?php echo $storeGroup->group_id; ?>" <?php echo ($checked) ? "checked" : ''; ?> name="store_group_ids[<?php echo $website->website_id; ?>][]" class="store-group-<?php echo $website->website_id; ?>" value="<?=$storeGroup->group_id?>" />
<input type="checkbox" id="store-group-<?php echo $storeGroup->group_id; ?>" <?php echo ($checked) ? "checked" : ''; ?> name="store_group_ids[<?php echo $website->website_id; ?>][]" class="store-group-<?php echo $website->website_id; ?>" value="<?php echo $storeGroup->group_id?>" />
<?php echo $storeGroup->name; ?>
</label>
</h5>
Expand All @@ -61,7 +61,7 @@
<span class="glyphicon glyphicon-ok-sign text-success"></span>
<?php endif; ?>
<label class="checkbox-inline">
<input type="checkbox" id="store-<?php echo $store->store_id; ?>" <?php echo ($checked) ? "checked" : ''; ?> name="store_ids[<?php echo $storeGroup->group_id; ?>][]" class="store-<?php echo $storeGroup->group_id; ?>" value="<?=$store->store_id?>" />
<input type="checkbox" id="store-<?php echo $store->store_id; ?>" <?php echo ($checked) ? "checked" : ''; ?> name="store_ids[<?php echo $storeGroup->group_id; ?>][]" class="store-<?php echo $storeGroup->group_id; ?>" value="<?php echo $store->store_id?>" />
<?php echo $store->name; ?>
</label>
</li>
Expand Down
4 changes: 2 additions & 2 deletions protected/views/migrate/step3.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php $this->pageTitle = $step->title . ' - ' . Yii::app()->name; ?>

<h1 class="page-header"> Step <?=$step->sorder?>: <?=$step->title?> </h1>
<h1 class="page-header"> Step <?php echo $step->sorder?>: <?php echo $step->title?> </h1>

<form role="form" method="post" action="<?php echo Yii::app()->createUrl("migrate/step{$step->sorder}"); ?>">

Expand Down Expand Up @@ -51,7 +51,7 @@
<li class="list-group-item">
<h5 class="list-group-item-heading">
<label class="checkbox-inline">
<input type="checkbox" id="attribute-group-<?php echo $attribute_group->attribute_group_id; ?>" name="attribute_group_ids[<?php echo $attribute_set->attribute_set_id; ?>][]" class="attribute-group-<?php echo $attribute_set->attribute_set_id; ?>" value="<?=$attribute_group->attribute_group_id?>" />
<input type="checkbox" id="attribute-group-<?php echo $attribute_group->attribute_group_id; ?>" name="attribute_group_ids[<?php echo $attribute_set->attribute_set_id; ?>][]" class="attribute-group-<?php echo $attribute_set->attribute_set_id; ?>" value="<?php echo $attribute_group->attribute_group_id?>" />
<?php echo $attribute_group->attribute_group_name; ?>
</label>
</h5>
Expand Down
2 changes: 1 addition & 1 deletion protected/views/migrate/step4.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php $this->pageTitle = $step->title . ' - ' . Yii::app()->name; ?>

<h1 class="page-header"> Step <?=$step->sorder?>: <?=$step->title?> </h1>
<h1 class="page-header"> Step <?php echo $step->sorder?>: <?php echo $step->title?> </h1>

<form role="form" method="post" action="<?php echo Yii::app()->createUrl("migrate/step{$step->sorder}"); ?>">
<div id="step-content">
Expand Down
2 changes: 1 addition & 1 deletion protected/views/migrate/step5.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php $this->pageTitle = $step->title . ' - ' . Yii::app()->name; ?>

<h1 class="page-header"> Step <?=$step->sorder?>: <?=$step->title?> </h1>
<h1 class="page-header"> Step <?php echo $step->sorder?>: <?php echo $step->title?> </h1>

<?php
//get migrated category ids
Expand Down
2 changes: 1 addition & 1 deletion protected/views/migrate/step6.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php $this->pageTitle = $step->title . ' - ' . Yii::app()->name; ?>

<h1 class="page-header"> Step <?=$step->sorder?>: <?=$step->title?> </h1>
<h1 class="page-header"> Step <?php echo $step->sorder?>: <?php echo $step->title?> </h1>

<?php
//get migrated category ids
Expand Down
14 changes: 9 additions & 5 deletions protected/views/migrate/step7.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php $this->pageTitle = $step->title . ' - ' . Yii::app()->name; ?>

<h1 class="page-header"> Step <?=$step->sorder?>: <?=$step->title?> </h1>
<h1 class="page-header"> Step <?php echo $step->sorder?>: <?php echo $step->title?> </h1>

<?php
//get migrated category ids
//get migrated sales objects ids
$migrated_sales_object_ids = isset(Yii::app()->session['migrated_sales_object_ids']) ? Yii::app()->session['migrated_sales_object_ids'] : array();
?>

Expand All @@ -16,9 +16,13 @@
<ul class="list-group">
<li class="list-group-item">
<h3 class="list-group-item-heading">
<input type="checkbox" id="select-all" style="visibility: hidden;" name="select_all_sales_object" title="<?php echo Yii::t('frontend', 'Click here to select all sales objects.')?>" />
<?php echo Yii::t('frontend', 'Sales Data Objects'); ?>
<?php echo Yii::t('frontend', 'Sales Data Objects'); ?><br/>
</h3>
<h4>
<?php $checked = (sizeof($migrated_sales_object_ids) == sizeof($sale_objects)) ? true : false; ?>
<input type="checkbox" <?php echo ($checked) ? 'checked="checked"' : ''; ?> id="select-all" name="select_all_sales_object" title="<?php echo Yii::t('frontend', 'Click here to select all sales objects.')?>" />
<label for="select-all">Select all</label>
</h4>
<?php if (isset($sale_objects) && $sale_objects): ?>
<ul class="list-group">
<?php foreach ($sale_objects as $id => $label): ?>
Expand All @@ -28,7 +32,7 @@
<?php if ($checked = in_array($id, $migrated_sales_object_ids)): ?>
<span class="glyphicon glyphicon-ok-sign text-success"></span>
<?php endif; ?>
<input type="checkbox" style="<?php echo ($id != 'rule_coupon') ? 'visibility: hidden;' : ''; ?>" <?php echo ($checked) ? "checked" : ''; ?> id="sales_object_<?php echo $id; ?>" name="selected_objects[]" value="<?php echo $id; ?>" />
<input type="checkbox" <?php echo ($checked) ? "checked" : ''; ?> id="sales_object_<?php echo $id; ?>" name="selected_objects[]" value="<?php echo $id; ?>" />
<span> <?php echo $label . " (". MigrateSteps::getTotalSalesChildObject($id) .")"; ?> </span>
</h4>
</li>
Expand Down
2 changes: 1 addition & 1 deletion protected/views/migrate/step8.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php $this->pageTitle = $step->title . ' - ' . Yii::app()->name; ?>

<h1 class="page-header"> Step <?=$step->sorder?>: <?=$step->title?> </h1>
<h1 class="page-header"> Step <?php echo $step->sorder?>: <?php echo $step->title?> </h1>

<?php
$migrated_object_ids = isset(Yii::app()->session['migrated_object_ids']) ? Yii::app()->session['migrated_object_ids'] : array();
Expand Down
2 changes: 1 addition & 1 deletion protected/views/migrate/step9.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php $this->pageTitle = $step->title . ' - ' . Yii::app()->name; ?>

<h1 class="page-header"> Step <?=$step->sorder?>: <?=$step->title?> </h1>
<h1 class="page-header"> Step <?php echo $step->sorder?>: <?php echo $step->title?> </h1>

<?php
$migrated_object_ids = isset(Yii::app()->session['migrated_other_object_ids']) ? Yii::app()->session['migrated_other_object_ids'] : array();
Expand Down

0 comments on commit 6055bb9

Please sign in to comment.