Version Notes
Now you can import the Customers and Orders
Download this release
Release Info
| Developer | ezMage |
| Extension | Ezmage_OscommerceImport |
| Version | 1.7.4 |
| Comparing to | |
| See all releases | |
Code changes from version 1.7.3 to 1.7.4
- app/code/community/Ezmage/OscommerceImport/Helper/_notes/dwsync.xml +4 -0
- app/code/community/Ezmage/OscommerceImport/Model/Source/_notes/dwsync.xml +4 -0
- app/code/community/Ezmage/OscommerceImport/controllers/IndexController.php +1151 -51
- app/code/community/Ezmage/OscommerceImport/controllers/_notes/dwsync.xml +5 -0
- app/code/community/Ezmage/OscommerceImport/etc/_notes/dwsync.xml +5 -0
- app/code/community/Ezmage/OscommerceImport/etc/config.xml +52 -52
- app/code/community/Ezmage/OscommerceImport/etc/system.xml +41 -17
- app/design/frontend/default/default/template/ezmage/oscommerceimport/_notes/dwsync.xml +8 -8
- app/design/frontend/default/default/template/ezmage/oscommerceimport/step0.phtml +31 -5
- app/design/frontend/default/default/template/ezmage/oscommerceimport/step1.phtml +2 -2
- app/design/frontend/default/default/template/ezmage/oscommerceimport/step2.phtml +6 -4
- app/design/frontend/default/default/template/ezmage/oscommerceimport/step3.phtml +2 -2
- app/design/frontend/default/default/template/ezmage/oscommerceimport/step31.phtml +16 -5
- app/design/frontend/default/default/template/ezmage/oscommerceimport/step4.phtml +11 -45
- app/design/frontend/default/default/template/ezmage/oscommerceimport/step5.phtml +11 -4
- app/design/frontend/default/default/template/ezmage/oscommerceimport/step6.phtml +22 -17
- app/design/frontend/default/default/template/ezmage/oscommerceimport/step7.phtml +47 -0
- app/design/frontend/default/default/template/ezmage/oscommerceimport/step8.phtml +42 -0
- app/etc/modules/Ezmage_OscommerceImport.xml +9 -9
- package.xml +6 -6
app/code/community/Ezmage/OscommerceImport/Helper/_notes/dwsync.xml
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="utf-8" ?>
|
| 2 |
+
<dwsync>
|
| 3 |
+
<file name="Data.php" server="php53.ezosc.com//public_html/magento1.7/" local="129821796691127881" remote="129822085800000000" />
|
| 4 |
+
</dwsync>
|
app/code/community/Ezmage/OscommerceImport/Model/Source/_notes/dwsync.xml
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="utf-8" ?>
|
| 2 |
+
<dwsync>
|
| 3 |
+
<file name="GetAttributeSets.php" server="php53.ezosc.com//public_html/magento1.7/" local="129821796695178112" remote="129822085800000000" />
|
| 4 |
+
</dwsync>
|
app/code/community/Ezmage/OscommerceImport/controllers/IndexController.php
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
<?php
|
| 2 |
class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front_Action
|
| 3 |
{
|
|
|
|
|
|
|
| 4 |
public function indexAction()
|
| 5 |
{
|
| 6 |
|
|
@@ -10,7 +12,7 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 10 |
Mage::register('image_status4','check-no.jpg');
|
| 11 |
Mage::register('image_status5','check-no.jpg');
|
| 12 |
Mage::register('image_status6','check-no.jpg');
|
| 13 |
-
|
| 14 |
|
| 15 |
//check if configuration has values
|
| 16 |
$conf_hostname = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_hostname',Mage::app()->getStore());
|
|
@@ -18,7 +20,7 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 18 |
$conf_db = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_db',Mage::app()->getStore());
|
| 19 |
$conf_db_username = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_username',Mage::app()->getStore());
|
| 20 |
$conf_db_password = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_password',Mage::app()->getStore());
|
| 21 |
-
|
| 22 |
$conf_website = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_website',Mage::app()->getStore());
|
| 23 |
$conf_category = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_category',Mage::app()->getStore());
|
| 24 |
$conf_attribute = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_attribute',Mage::app()->getStore());
|
|
@@ -63,13 +65,29 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 63 |
Mage::register('image_status4','check-ok.jpg');
|
| 64 |
}
|
| 65 |
|
| 66 |
-
//
|
| 67 |
$importProductsTotal = Mage::getSingleton('core/session')->getimportProductsTotal();
|
| 68 |
$importedProductsTotal = Mage::getSingleton('core/session')->getimportedProductsTotal();
|
| 69 |
if (($importProductsTotal == $importedProductsTotal) and ($importProductsTotal > 0)) {
|
| 70 |
Mage::unregister('image_status5');
|
| 71 |
Mage::register('image_status5','check-ok.jpg');
|
| 72 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
// Layout Out Put
|
| 75 |
$this->loadLayout();
|
|
@@ -80,17 +98,20 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 80 |
array('template' => 'ezmage/oscommerceimport/step0.phtml')
|
| 81 |
);
|
| 82 |
|
| 83 |
-
|
| 84 |
$this->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');
|
| 85 |
|
| 86 |
-
$this->renderLayout();
|
| 87 |
}
|
| 88 |
|
| 89 |
/*******************************************************************************/
|
| 90 |
-
/* Step 1
|
| 91 |
/*******************************************************************************/
|
| 92 |
public function step1Action()
|
| 93 |
{
|
|
|
|
|
|
|
|
|
|
| 94 |
$this->loadLayout();
|
| 95 |
|
| 96 |
$block = $this->getLayout()->createBlock(
|
|
@@ -99,17 +120,20 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 99 |
array('template' => 'ezmage/oscommerceimport/step1.phtml')
|
| 100 |
);
|
| 101 |
|
| 102 |
-
|
| 103 |
$this->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');
|
| 104 |
|
| 105 |
$this->renderLayout();
|
| 106 |
}
|
| 107 |
|
| 108 |
/*******************************************************************************/
|
| 109 |
-
/* Step 2
|
| 110 |
/*******************************************************************************/
|
| 111 |
public function step2Action()
|
| 112 |
{
|
|
|
|
|
|
|
|
|
|
| 113 |
// check if tmp are created
|
| 114 |
$resource = Mage::getSingleton('core/resource');
|
| 115 |
$readConnection = $resource->getConnection('core_read');
|
|
@@ -118,7 +142,6 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 118 |
$query = 'show tables like "ezmage_categories"';
|
| 119 |
$list = $readConnection->fetchAll($query);
|
| 120 |
$ezmage_categories = sizeof($list);
|
| 121 |
-
// create table if don't exit
|
| 122 |
if ($ezmage_categories == 0){
|
| 123 |
$query = "CREATE TABLE IF NOT EXISTS `ezmage_categories` (`osc_cat_id` int(11) NOT NULL,`osc_cat_title` varchar(200) COLLATE utf8_unicode_ci NOT NULL,`osc_cat_parent` int(11) NOT NULL,`mage_cat_id` int(11) NOT NULL,`mage_cat_name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,`mage_cat_parent` int(11) NOT NULL,`cat_imported` varchar(1) COLLATE utf8_unicode_ci NOT NULL,`osc_cat_image` varchar(200) COLLATE utf8_unicode_ci NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
|
| 124 |
$writeConnection->query($query);
|
|
@@ -127,12 +150,27 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 127 |
$query = 'show tables like "ezmage_products"';
|
| 128 |
$list = $readConnection->fetchAll($query);
|
| 129 |
$ezmage_products = sizeof($list);
|
| 130 |
-
// create table if don't exit
|
| 131 |
if ($ezmage_products == 0){
|
| 132 |
$query = "CREATE TABLE IF NOT EXISTS `ezmage_products` (`osc_product_id` int(11) NOT NULL,`osc_product_name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,`mage_product_id` int(11) NOT NULL,`product_imported` varchar(1) COLLATE utf8_unicode_ci NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
|
| 133 |
$writeConnection->query($query);
|
| 134 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
$query = 'show tables like "ezmage_log"';
|
| 137 |
$list = $readConnection->fetchAll($query);
|
| 138 |
$ezmage_log = sizeof($list);
|
|
@@ -140,6 +178,7 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 140 |
$query = "CREATE TABLE IF NOT EXISTS `ezmage_log` (`importtime` datetime NOT NULL,`log_type` varchar(100) COLLATE utf8_unicode_ci NOT NULL,`log_desc` varchar(200) COLLATE utf8_unicode_ci NOT NULL,`mage_log` varchar(255) COLLATE utf8_unicode_ci NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
|
| 141 |
$writeConnection->query($query);
|
| 142 |
}
|
|
|
|
| 143 |
|
| 144 |
if ( ($ezmage_categories == 1) and ($ezmage_products == 1) and ($ezmage_log == 1) ){
|
| 145 |
$step2Status = 'ok';
|
|
@@ -155,7 +194,7 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 155 |
array('template' => 'ezmage/oscommerceimport/step2.phtml')
|
| 156 |
);
|
| 157 |
|
| 158 |
-
|
| 159 |
$this->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');
|
| 160 |
|
| 161 |
$this->renderLayout();
|
|
@@ -168,6 +207,8 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 168 |
public function step21Action()
|
| 169 |
{
|
| 170 |
|
|
|
|
|
|
|
| 171 |
try{
|
| 172 |
// check if tmp are created
|
| 173 |
$resource = Mage::getSingleton('core/resource');
|
|
@@ -179,7 +220,10 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 179 |
$writeConnection->query($query);
|
| 180 |
$query = 'TRUNCATE TABLE ezmage_products';
|
| 181 |
$writeConnection->query($query);
|
| 182 |
-
|
|
|
|
|
|
|
|
|
|
| 183 |
}
|
| 184 |
catch (Exception $ex) {
|
| 185 |
echo $ex->getMessage();
|
|
@@ -192,6 +236,7 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 192 |
Mage::getSingleton('core/session')->unsimportedCategoryTotal();
|
| 193 |
Mage::getSingleton('core/session')->unsimportProductsTotal();
|
| 194 |
Mage::getSingleton('core/session')->unsimportedProductsTotal();
|
|
|
|
| 195 |
|
| 196 |
$this->loadLayout();
|
| 197 |
|
|
@@ -209,11 +254,13 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 209 |
|
| 210 |
|
| 211 |
/*******************************************************************************/
|
| 212 |
-
/* Step 3
|
| 213 |
/*******************************************************************************/
|
| 214 |
public function step3Action()
|
| 215 |
{
|
| 216 |
|
|
|
|
|
|
|
| 217 |
$_config = $this->setRemoteConectionConfig();
|
| 218 |
try {
|
| 219 |
$_connection = Mage::getSingleton('core/resource')->createConnection('oscommerce_conection', 'pdo_mysql', $_config);
|
|
@@ -240,22 +287,25 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 240 |
}
|
| 241 |
|
| 242 |
/*******************************************************************************/
|
| 243 |
-
/* Step 3.1
|
| 244 |
/*******************************************************************************/
|
| 245 |
public function step31Action()
|
| 246 |
{
|
|
|
|
|
|
|
| 247 |
|
| 248 |
$_config = $this->setRemoteConectionConfig();
|
| 249 |
try {
|
| 250 |
|
| 251 |
$resource = Mage::getSingleton('core/resource');
|
| 252 |
$readConnection = $resource->getConnection('core_read');
|
| 253 |
-
$writeConnection = $resource->getConnection('core_write');
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
$conf_prefix = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_prefix',Mage::app()->getStore());
|
| 258 |
|
|
|
|
|
|
|
|
|
|
| 259 |
$query = 'select categories.categories_id ,categories.categories_image, categories.parent_id, categories_description.categories_name from categories LEFT JOIN categories_description on categories_description.categories_id = categories.categories_id and categories_description.language_id = 1';
|
| 260 |
$results = $_connection_remote->fetchAll($query);
|
| 261 |
foreach($results as $row) {
|
|
@@ -263,19 +313,20 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 263 |
$sql = "select osc_cat_id from ezmage_categories where osc_cat_id=".$row['categories_id'];
|
| 264 |
$list = $readConnection->fetchAll($sql);
|
| 265 |
if (sizeof($list) == 0){
|
| 266 |
-
$row['categories_name'] = str_replace('"',
|
|
|
|
| 267 |
$sql = 'insert into ezmage_categories (osc_cat_id,osc_cat_title,osc_cat_parent,osc_cat_image) values('.$row['categories_id'].',"'.$row['categories_name'].'","'.$row['parent_id'].'","'.$row['categories_image'].'")';
|
| 268 |
$writeConnection->query($sql);
|
| 269 |
}
|
| 270 |
-
}
|
| 271 |
-
|
| 272 |
-
|
| 273 |
$sql = "select osc_cat_id from ezmage_categories";
|
| 274 |
$list = $readConnection->fetchAll($sql);
|
| 275 |
$importCategoryTotal = sizeof($list);
|
| 276 |
Mage::getSingleton('core/session')->setimportCategoryTotal($importCategoryTotal);
|
| 277 |
|
| 278 |
-
|
|
|
|
|
|
|
| 279 |
$query = 'select products_id,products_name from products_description where language_id = 1';
|
| 280 |
$results = $_connection_remote->fetchAll($query);
|
| 281 |
foreach($results as $row) {
|
|
@@ -283,7 +334,7 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 283 |
$sql = "select osc_product_id from ezmage_products where osc_product_id=".$row['products_id'];
|
| 284 |
$list = $readConnection->fetchAll($sql);
|
| 285 |
if (sizeof($list) == 0){
|
| 286 |
-
$row['products_name'] = str_replace('"',
|
| 287 |
$sql = 'insert into ezmage_products values('.$row['products_id'].',"'.$row['products_name'].'","","")';
|
| 288 |
$writeConnection->query($sql);
|
| 289 |
}
|
|
@@ -293,12 +344,51 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 293 |
$list = $readConnection->fetchAll($sql);
|
| 294 |
$importProductsTotal = sizeof($list);
|
| 295 |
Mage::getSingleton('core/session')->setimportProductsTotal($importProductsTotal);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 296 |
|
| 297 |
|
| 298 |
}
|
| 299 |
catch (Exception $ex) {
|
| 300 |
-
|
| 301 |
-
echo $ex->getMessage();
|
| 302 |
}
|
| 303 |
|
| 304 |
$this->loadLayout();
|
|
@@ -317,10 +407,13 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 317 |
|
| 318 |
|
| 319 |
/*******************************************************************************/
|
| 320 |
-
/* Step 4
|
| 321 |
/*******************************************************************************/
|
| 322 |
public function step4Action()
|
| 323 |
-
{
|
|
|
|
|
|
|
|
|
|
| 324 |
try {
|
| 325 |
$resource = Mage::getSingleton('core/resource');
|
| 326 |
$readConnection = $resource->getConnection('core_read');
|
|
@@ -351,10 +444,12 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 351 |
|
| 352 |
|
| 353 |
/*******************************************************************************/
|
| 354 |
-
/* Step 4.1
|
| 355 |
/*******************************************************************************/
|
| 356 |
public function step41Action()
|
| 357 |
{
|
|
|
|
|
|
|
| 358 |
|
| 359 |
// Stop Indexes
|
| 360 |
// http://www.clounce.com/magento/magento-reindex-programmatically
|
|
@@ -383,8 +478,9 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 383 |
$category->setName($category_row['osc_cat_title']);
|
| 384 |
$category->setIsActive(1);
|
| 385 |
$category->setIsAnchor(0);
|
| 386 |
-
$category->setDisplayMode('PRODUCTS');
|
| 387 |
$category->setIncludeInMenu(0);
|
|
|
|
|
|
|
| 388 |
|
| 389 |
if ($category_row['osc_cat_parent'] != 0){
|
| 390 |
$parent_id = $this->getMageParentID($category_row['osc_cat_parent'],$readConnection);
|
|
@@ -407,7 +503,7 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 407 |
$writeConnection->query($sql);
|
| 408 |
|
| 409 |
$totalimport++;
|
| 410 |
-
if ($totalimport ==
|
| 411 |
break;
|
| 412 |
}
|
| 413 |
}
|
|
@@ -422,8 +518,7 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 422 |
|
| 423 |
}
|
| 424 |
catch (Exception $ex) {
|
| 425 |
-
|
| 426 |
-
echo $ex->getMessage();
|
| 427 |
}
|
| 428 |
|
| 429 |
// Start Indexes
|
|
@@ -447,10 +542,13 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 447 |
|
| 448 |
|
| 449 |
/*******************************************************************************/
|
| 450 |
-
/* Step 5
|
| 451 |
/*******************************************************************************/
|
| 452 |
public function step5Action()
|
| 453 |
-
{
|
|
|
|
|
|
|
|
|
|
| 454 |
try {
|
| 455 |
$resource = Mage::getSingleton('core/resource');
|
| 456 |
$readConnection = $resource->getConnection('core_read');
|
|
@@ -480,11 +578,16 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 480 |
}
|
| 481 |
|
| 482 |
/*******************************************************************************/
|
| 483 |
-
/* Step 5.1
|
| 484 |
/*******************************************************************************/
|
| 485 |
public function step51Action()
|
| 486 |
{
|
| 487 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 488 |
$_config = $this->setRemoteConectionConfig();
|
| 489 |
// Stop Indexes
|
| 490 |
// http://www.clounce.com/magento/magento-reindex-programmatically
|
|
@@ -510,13 +613,16 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 510 |
//print $row['osc_product_id'].' => '.$row['osc_product_name'].' => '.$row['mage_product_id'].'<br>';
|
| 511 |
|
| 512 |
$product_osc = $this->getProductFromOSC($row['osc_product_id'],$readConnection,$_connection_remote);
|
| 513 |
-
$product_categories_osc = $this->getCategoriesProductFromOSC($row['osc_product_id'],$readConnection,$_connection_remote);
|
| 514 |
-
|
| 515 |
// some validation
|
| 516 |
if ($product_osc['products_model'] == '') {
|
| 517 |
$product_osc['products_model'] = $row['products_id'];
|
| 518 |
}
|
| 519 |
|
|
|
|
|
|
|
|
|
|
| 520 |
//search if sku exits
|
| 521 |
$oProduct = Mage::getModel("catalog/product")
|
| 522 |
->getCollection()
|
|
@@ -556,9 +662,12 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 556 |
$product->setCreatedAt(strtotime('now'));
|
| 557 |
|
| 558 |
if ($product_osc['products_image'] != ''){
|
| 559 |
-
$
|
| 560 |
-
if (
|
| 561 |
-
$
|
|
|
|
|
|
|
|
|
|
| 562 |
}
|
| 563 |
}
|
| 564 |
|
|
@@ -582,8 +691,7 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 582 |
|
| 583 |
}
|
| 584 |
catch (Exception $ex) {
|
| 585 |
-
|
| 586 |
-
echo $row['osc_product_id'].' - '.$ex->getMessage();
|
| 587 |
}
|
| 588 |
|
| 589 |
|
|
@@ -615,7 +723,22 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 615 |
public function step6Action()
|
| 616 |
{
|
| 617 |
$this->loadLayout();
|
|
|
|
| 618 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 619 |
$block = $this->getLayout()->createBlock(
|
| 620 |
'Mage_Core_Block_Template',
|
| 621 |
'block_ezmage_oscommerce_import_step4',
|
|
@@ -632,6 +755,311 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 632 |
/* Step 6.1 */
|
| 633 |
/*******************************************************************************/
|
| 634 |
public function step61Action()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 635 |
{
|
| 636 |
|
| 637 |
try{
|
|
@@ -645,6 +1073,10 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 645 |
$writeConnection->query($query);
|
| 646 |
$query = 'drop table ezmage_products';
|
| 647 |
$writeConnection->query($query);
|
|
|
|
|
|
|
|
|
|
|
|
|
| 648 |
|
| 649 |
}
|
| 650 |
catch (Exception $ex) {
|
|
@@ -659,6 +1091,10 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 659 |
Mage::getSingleton('core/session')->unsimportedCategoryTotal();
|
| 660 |
Mage::getSingleton('core/session')->unsimportProductsTotal();
|
| 661 |
Mage::getSingleton('core/session')->unsimportedProductsTotal();
|
|
|
|
|
|
|
|
|
|
|
|
|
| 662 |
|
| 663 |
$this->loadLayout();
|
| 664 |
|
|
@@ -673,13 +1109,678 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 673 |
|
| 674 |
$this->renderLayout();
|
| 675 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 676 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 677 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 678 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 679 |
/***************************************************************************************************************/
|
| 680 |
// Utils
|
| 681 |
/***************************************************************************************************************/
|
| 682 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 683 |
// Get product Information from oscommerce
|
| 684 |
public function getProductFromOSC($osc_product_id,$readConnection,$_connection_remote){
|
| 685 |
$query = 'select products_description.*,products.* from products left join products_description on products.products_id=products_description.products_id where products.products_id = '.$osc_product_id.' and products_description.language_id = 1';
|
|
@@ -693,7 +1794,7 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 693 |
}
|
| 694 |
|
| 695 |
// Returns Mage Categories
|
| 696 |
-
public function getCategoriesProductFromOSC($osc_product_id,$readConnection,$_connection_remote){
|
| 697 |
$query = 'select categories_id from products_to_categories where products_id = '.$osc_product_id;
|
| 698 |
$results = $_connection_remote->fetchAll($query);
|
| 699 |
foreach($results as $row) {
|
|
@@ -703,10 +1804,10 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 703 |
if ($mage_cat_id > 0){
|
| 704 |
$product_categories[] = $mage_cat_id;
|
| 705 |
}
|
| 706 |
-
}
|
| 707 |
if (sizeof($product_categories) == 0){
|
| 708 |
-
$product_categories[] =
|
| 709 |
-
}
|
| 710 |
return $product_categories;
|
| 711 |
}
|
| 712 |
|
|
@@ -800,7 +1901,7 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 800 |
$_config['dbname'] = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_db',Mage::app()->getStore());
|
| 801 |
$_config['username'] = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_username',Mage::app()->getStore());
|
| 802 |
$_config['password'] = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_password',Mage::app()->getStore());
|
| 803 |
-
|
| 804 |
// Setting the default Values
|
| 805 |
$_config['initStatements'] = 'SET NAMES utf8';
|
| 806 |
$_config['model'] = 'mysql4';
|
|
@@ -810,6 +1911,5 @@ class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front
|
|
| 810 |
|
| 811 |
return $_config;
|
| 812 |
}
|
| 813 |
-
|
| 814 |
-
|
| 815 |
}
|
| 1 |
<?php
|
| 2 |
class Ezmage_OscommerceImport_IndexController extends Mage_Core_Controller_Front_Action
|
| 3 |
{
|
| 4 |
+
public $global_shopping_cart;
|
| 5 |
+
|
| 6 |
public function indexAction()
|
| 7 |
{
|
| 8 |
|
| 12 |
Mage::register('image_status4','check-no.jpg');
|
| 13 |
Mage::register('image_status5','check-no.jpg');
|
| 14 |
Mage::register('image_status6','check-no.jpg');
|
| 15 |
+
Mage::register('image_status7','check-no.jpg');
|
| 16 |
|
| 17 |
//check if configuration has values
|
| 18 |
$conf_hostname = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_hostname',Mage::app()->getStore());
|
| 20 |
$conf_db = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_db',Mage::app()->getStore());
|
| 21 |
$conf_db_username = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_username',Mage::app()->getStore());
|
| 22 |
$conf_db_password = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_password',Mage::app()->getStore());
|
| 23 |
+
//$conf_table_prefix = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_prefix',Mage::app()->getStore());
|
| 24 |
$conf_website = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_website',Mage::app()->getStore());
|
| 25 |
$conf_category = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_category',Mage::app()->getStore());
|
| 26 |
$conf_attribute = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_attribute',Mage::app()->getStore());
|
| 65 |
Mage::register('image_status4','check-ok.jpg');
|
| 66 |
}
|
| 67 |
|
| 68 |
+
// step5
|
| 69 |
$importProductsTotal = Mage::getSingleton('core/session')->getimportProductsTotal();
|
| 70 |
$importedProductsTotal = Mage::getSingleton('core/session')->getimportedProductsTotal();
|
| 71 |
if (($importProductsTotal == $importedProductsTotal) and ($importProductsTotal > 0)) {
|
| 72 |
Mage::unregister('image_status5');
|
| 73 |
Mage::register('image_status5','check-ok.jpg');
|
| 74 |
}
|
| 75 |
+
|
| 76 |
+
// step6
|
| 77 |
+
$importCustomersTotal = Mage::getSingleton('core/session')->getimportCustomersTotal();
|
| 78 |
+
$importedCustomersTotal = Mage::getSingleton('core/session')->getimportedCustomersTotal();
|
| 79 |
+
if (($importCustomersTotal == $importedCustomersTotal) and ($importCustomersTotal > 0)) {
|
| 80 |
+
Mage::unregister('image_status6');
|
| 81 |
+
Mage::register('image_status6','check-ok.jpg');
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
// step7
|
| 85 |
+
$importOrdersTotal = Mage::getSingleton('core/session')->getimportOrdersTotal();
|
| 86 |
+
$importedOrdersTotal = Mage::getSingleton('core/session')->getimportedOrdersTotal();
|
| 87 |
+
if (($importOrdersTotal == $importedOrdersTotal) and ($importOrdersTotal > 0)) {
|
| 88 |
+
Mage::unregister('image_status7');
|
| 89 |
+
Mage::register('image_status7','check-ok.jpg');
|
| 90 |
+
}
|
| 91 |
|
| 92 |
// Layout Out Put
|
| 93 |
$this->loadLayout();
|
| 98 |
array('template' => 'ezmage/oscommerceimport/step0.phtml')
|
| 99 |
);
|
| 100 |
|
| 101 |
+
$this->getLayout()->getBlock('content')->append($block);
|
| 102 |
$this->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');
|
| 103 |
|
| 104 |
+
$this->renderLayout();
|
| 105 |
}
|
| 106 |
|
| 107 |
/*******************************************************************************/
|
| 108 |
+
/* Step 1 */
|
| 109 |
/*******************************************************************************/
|
| 110 |
public function step1Action()
|
| 111 |
{
|
| 112 |
+
|
| 113 |
+
Mage::getSingleton('core/session')->setErrorMSG('');
|
| 114 |
+
|
| 115 |
$this->loadLayout();
|
| 116 |
|
| 117 |
$block = $this->getLayout()->createBlock(
|
| 120 |
array('template' => 'ezmage/oscommerceimport/step1.phtml')
|
| 121 |
);
|
| 122 |
|
| 123 |
+
$this->getLayout()->getBlock('content')->append($block);
|
| 124 |
$this->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');
|
| 125 |
|
| 126 |
$this->renderLayout();
|
| 127 |
}
|
| 128 |
|
| 129 |
/*******************************************************************************/
|
| 130 |
+
/* Step 2 */
|
| 131 |
/*******************************************************************************/
|
| 132 |
public function step2Action()
|
| 133 |
{
|
| 134 |
+
|
| 135 |
+
Mage::getSingleton('core/session')->setErrorMSG('');
|
| 136 |
+
|
| 137 |
// check if tmp are created
|
| 138 |
$resource = Mage::getSingleton('core/resource');
|
| 139 |
$readConnection = $resource->getConnection('core_read');
|
| 142 |
$query = 'show tables like "ezmage_categories"';
|
| 143 |
$list = $readConnection->fetchAll($query);
|
| 144 |
$ezmage_categories = sizeof($list);
|
|
|
|
| 145 |
if ($ezmage_categories == 0){
|
| 146 |
$query = "CREATE TABLE IF NOT EXISTS `ezmage_categories` (`osc_cat_id` int(11) NOT NULL,`osc_cat_title` varchar(200) COLLATE utf8_unicode_ci NOT NULL,`osc_cat_parent` int(11) NOT NULL,`mage_cat_id` int(11) NOT NULL,`mage_cat_name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,`mage_cat_parent` int(11) NOT NULL,`cat_imported` varchar(1) COLLATE utf8_unicode_ci NOT NULL,`osc_cat_image` varchar(200) COLLATE utf8_unicode_ci NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
|
| 147 |
$writeConnection->query($query);
|
| 150 |
$query = 'show tables like "ezmage_products"';
|
| 151 |
$list = $readConnection->fetchAll($query);
|
| 152 |
$ezmage_products = sizeof($list);
|
|
|
|
| 153 |
if ($ezmage_products == 0){
|
| 154 |
$query = "CREATE TABLE IF NOT EXISTS `ezmage_products` (`osc_product_id` int(11) NOT NULL,`osc_product_name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,`mage_product_id` int(11) NOT NULL,`product_imported` varchar(1) COLLATE utf8_unicode_ci NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
|
| 155 |
$writeConnection->query($query);
|
| 156 |
}
|
| 157 |
+
|
| 158 |
+
$query = 'show tables like "ezmage_customers"';
|
| 159 |
+
$list = $readConnection->fetchAll($query);
|
| 160 |
+
$ezmage_products = sizeof($list);
|
| 161 |
+
if ($ezmage_products == 0){
|
| 162 |
+
$query = "CREATE TABLE IF NOT EXISTS `ezmage_customers` (`osc_customers_id` int(11) NOT NULL,`mage_customers_id` int(11) NOT NULL,`customers_imported` varchar(1) COLLATE utf8_unicode_ci NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
|
| 163 |
+
$writeConnection->query($query);
|
| 164 |
+
}
|
| 165 |
|
| 166 |
+
$query = 'show tables like "ezmage_orders"';
|
| 167 |
+
$list = $readConnection->fetchAll($query);
|
| 168 |
+
$ezmage_products = sizeof($list);
|
| 169 |
+
if ($ezmage_products == 0){
|
| 170 |
+
$query = "CREATE TABLE IF NOT EXISTS `ezmage_orders` (`osc_order_id` int(11) NOT NULL,`mage_order_id` int(11) NOT NULL,`order_imported` varchar(1) COLLATE utf8_unicode_ci NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
|
| 171 |
+
$writeConnection->query($query);
|
| 172 |
+
}
|
| 173 |
+
|
| 174 |
$query = 'show tables like "ezmage_log"';
|
| 175 |
$list = $readConnection->fetchAll($query);
|
| 176 |
$ezmage_log = sizeof($list);
|
| 178 |
$query = "CREATE TABLE IF NOT EXISTS `ezmage_log` (`importtime` datetime NOT NULL,`log_type` varchar(100) COLLATE utf8_unicode_ci NOT NULL,`log_desc` varchar(200) COLLATE utf8_unicode_ci NOT NULL,`mage_log` varchar(255) COLLATE utf8_unicode_ci NOT NULL) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;";
|
| 179 |
$writeConnection->query($query);
|
| 180 |
}
|
| 181 |
+
|
| 182 |
|
| 183 |
if ( ($ezmage_categories == 1) and ($ezmage_products == 1) and ($ezmage_log == 1) ){
|
| 184 |
$step2Status = 'ok';
|
| 194 |
array('template' => 'ezmage/oscommerceimport/step2.phtml')
|
| 195 |
);
|
| 196 |
|
| 197 |
+
$this->getLayout()->getBlock('content')->append($block);
|
| 198 |
$this->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');
|
| 199 |
|
| 200 |
$this->renderLayout();
|
| 207 |
public function step21Action()
|
| 208 |
{
|
| 209 |
|
| 210 |
+
Mage::getSingleton('core/session')->setErrorMSG('');
|
| 211 |
+
|
| 212 |
try{
|
| 213 |
// check if tmp are created
|
| 214 |
$resource = Mage::getSingleton('core/resource');
|
| 220 |
$writeConnection->query($query);
|
| 221 |
$query = 'TRUNCATE TABLE ezmage_products';
|
| 222 |
$writeConnection->query($query);
|
| 223 |
+
$query = 'TRUNCATE TABLE ezmage_customers';
|
| 224 |
+
$writeConnection->query($query);
|
| 225 |
+
$query = 'TRUNCATE TABLE ezmage_orders';
|
| 226 |
+
$writeConnection->query($query);
|
| 227 |
}
|
| 228 |
catch (Exception $ex) {
|
| 229 |
echo $ex->getMessage();
|
| 236 |
Mage::getSingleton('core/session')->unsimportedCategoryTotal();
|
| 237 |
Mage::getSingleton('core/session')->unsimportProductsTotal();
|
| 238 |
Mage::getSingleton('core/session')->unsimportedProductsTotal();
|
| 239 |
+
Mage::getSingleton('core/session')->unsimportedOrdersTotal();
|
| 240 |
|
| 241 |
$this->loadLayout();
|
| 242 |
|
| 254 |
|
| 255 |
|
| 256 |
/*******************************************************************************/
|
| 257 |
+
/* Step 3 */
|
| 258 |
/*******************************************************************************/
|
| 259 |
public function step3Action()
|
| 260 |
{
|
| 261 |
|
| 262 |
+
Mage::getSingleton('core/session')->setErrorMSG('');
|
| 263 |
+
|
| 264 |
$_config = $this->setRemoteConectionConfig();
|
| 265 |
try {
|
| 266 |
$_connection = Mage::getSingleton('core/resource')->createConnection('oscommerce_conection', 'pdo_mysql', $_config);
|
| 287 |
}
|
| 288 |
|
| 289 |
/*******************************************************************************/
|
| 290 |
+
/* Step 3.1 */
|
| 291 |
/*******************************************************************************/
|
| 292 |
public function step31Action()
|
| 293 |
{
|
| 294 |
+
|
| 295 |
+
Mage::getSingleton('core/session')->setErrorMSG('');
|
| 296 |
|
| 297 |
$_config = $this->setRemoteConectionConfig();
|
| 298 |
try {
|
| 299 |
|
| 300 |
$resource = Mage::getSingleton('core/resource');
|
| 301 |
$readConnection = $resource->getConnection('core_read');
|
| 302 |
+
$writeConnection = $resource->getConnection('core_write');
|
| 303 |
+
$_connection_remote = Mage::getSingleton('core/resource')->createConnection('oscommerce_conection', 'pdo_mysql', $_config);
|
| 304 |
+
//$conf_prefix = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_prefix',Mage::app()->getStore());
|
|
|
|
|
|
|
| 305 |
|
| 306 |
+
////////////////
|
| 307 |
+
// categories //
|
| 308 |
+
////////////////
|
| 309 |
$query = 'select categories.categories_id ,categories.categories_image, categories.parent_id, categories_description.categories_name from categories LEFT JOIN categories_description on categories_description.categories_id = categories.categories_id and categories_description.language_id = 1';
|
| 310 |
$results = $_connection_remote->fetchAll($query);
|
| 311 |
foreach($results as $row) {
|
| 313 |
$sql = "select osc_cat_id from ezmage_categories where osc_cat_id=".$row['categories_id'];
|
| 314 |
$list = $readConnection->fetchAll($sql);
|
| 315 |
if (sizeof($list) == 0){
|
| 316 |
+
$row['categories_name'] = str_replace('"','',$row['categories_name']);
|
| 317 |
+
$row['categories_name'] = str_replace('\"','',$row['categories_name']);
|
| 318 |
$sql = 'insert into ezmage_categories (osc_cat_id,osc_cat_title,osc_cat_parent,osc_cat_image) values('.$row['categories_id'].',"'.$row['categories_name'].'","'.$row['parent_id'].'","'.$row['categories_image'].'")';
|
| 319 |
$writeConnection->query($sql);
|
| 320 |
}
|
| 321 |
+
}
|
|
|
|
|
|
|
| 322 |
$sql = "select osc_cat_id from ezmage_categories";
|
| 323 |
$list = $readConnection->fetchAll($sql);
|
| 324 |
$importCategoryTotal = sizeof($list);
|
| 325 |
Mage::getSingleton('core/session')->setimportCategoryTotal($importCategoryTotal);
|
| 326 |
|
| 327 |
+
//////////////
|
| 328 |
+
// products //
|
| 329 |
+
//////////////
|
| 330 |
$query = 'select products_id,products_name from products_description where language_id = 1';
|
| 331 |
$results = $_connection_remote->fetchAll($query);
|
| 332 |
foreach($results as $row) {
|
| 334 |
$sql = "select osc_product_id from ezmage_products where osc_product_id=".$row['products_id'];
|
| 335 |
$list = $readConnection->fetchAll($sql);
|
| 336 |
if (sizeof($list) == 0){
|
| 337 |
+
$row['products_name'] = str_replace('\"','',$row['products_name']);
|
| 338 |
$sql = 'insert into ezmage_products values('.$row['products_id'].',"'.$row['products_name'].'","","")';
|
| 339 |
$writeConnection->query($sql);
|
| 340 |
}
|
| 344 |
$list = $readConnection->fetchAll($sql);
|
| 345 |
$importProductsTotal = sizeof($list);
|
| 346 |
Mage::getSingleton('core/session')->setimportProductsTotal($importProductsTotal);
|
| 347 |
+
|
| 348 |
+
///////////////
|
| 349 |
+
// Customers //
|
| 350 |
+
///////////////
|
| 351 |
+
$query = 'select customers_id from customers';
|
| 352 |
+
$results = $_connection_remote->fetchAll($query);
|
| 353 |
+
foreach($results as $row) {
|
| 354 |
+
// check if customers exist
|
| 355 |
+
$sql = "select osc_customers_id from ezmage_customers where osc_customers_id=".$row['customers_id'];
|
| 356 |
+
$list = $readConnection->fetchAll($sql);
|
| 357 |
+
if (sizeof($list) == 0){
|
| 358 |
+
$sql = 'insert into ezmage_customers values('.$row['customers_id'].',"","")';
|
| 359 |
+
$writeConnection->query($sql);
|
| 360 |
+
}
|
| 361 |
+
}
|
| 362 |
+
|
| 363 |
+
$sql = "select osc_customers_id from ezmage_customers";
|
| 364 |
+
$list = $readConnection->fetchAll($sql);
|
| 365 |
+
$importCustomersTotal = sizeof($list);
|
| 366 |
+
Mage::getSingleton('core/session')->setimportCustomersTotal($importCustomersTotal);
|
| 367 |
+
|
| 368 |
+
///////////////
|
| 369 |
+
// Customers //
|
| 370 |
+
///////////////
|
| 371 |
+
$query = 'select orders_id from orders';
|
| 372 |
+
$results = $_connection_remote->fetchAll($query);
|
| 373 |
+
foreach($results as $row) {
|
| 374 |
+
// check if customers exist
|
| 375 |
+
$sql = "select osc_order_id from ezmage_orders where osc_order_id=".$row['orders_id'];
|
| 376 |
+
$list = $readConnection->fetchAll($sql);
|
| 377 |
+
if (sizeof($list) == 0){
|
| 378 |
+
$sql = 'insert into ezmage_orders values('.$row['orders_id'].',"","")';
|
| 379 |
+
$writeConnection->query($sql);
|
| 380 |
+
}
|
| 381 |
+
}
|
| 382 |
+
|
| 383 |
+
$sql = "select osc_order_id from ezmage_orders";
|
| 384 |
+
$list = $readConnection->fetchAll($sql);
|
| 385 |
+
$importOrdersTotal = sizeof($list);
|
| 386 |
+
Mage::getSingleton('core/session')->setimportOrdersTotal($importOrdersTotal);
|
| 387 |
|
| 388 |
|
| 389 |
}
|
| 390 |
catch (Exception $ex) {
|
| 391 |
+
Mage::getSingleton('core/session')->setErrorMSG($ex->getMessage());
|
|
|
|
| 392 |
}
|
| 393 |
|
| 394 |
$this->loadLayout();
|
| 407 |
|
| 408 |
|
| 409 |
/*******************************************************************************/
|
| 410 |
+
/* Step 4 */
|
| 411 |
/*******************************************************************************/
|
| 412 |
public function step4Action()
|
| 413 |
+
{
|
| 414 |
+
|
| 415 |
+
Mage::getSingleton('core/session')->setErrorMSG('');
|
| 416 |
+
|
| 417 |
try {
|
| 418 |
$resource = Mage::getSingleton('core/resource');
|
| 419 |
$readConnection = $resource->getConnection('core_read');
|
| 444 |
|
| 445 |
|
| 446 |
/*******************************************************************************/
|
| 447 |
+
/* Step 4.1 */
|
| 448 |
/*******************************************************************************/
|
| 449 |
public function step41Action()
|
| 450 |
{
|
| 451 |
+
|
| 452 |
+
Mage::getSingleton('core/session')->setErrorMSG('');
|
| 453 |
|
| 454 |
// Stop Indexes
|
| 455 |
// http://www.clounce.com/magento/magento-reindex-programmatically
|
| 478 |
$category->setName($category_row['osc_cat_title']);
|
| 479 |
$category->setIsActive(1);
|
| 480 |
$category->setIsAnchor(0);
|
|
|
|
| 481 |
$category->setIncludeInMenu(0);
|
| 482 |
+
$category->setDisplayMode('PRODUCTS');
|
| 483 |
+
// getIncludeInMenu
|
| 484 |
|
| 485 |
if ($category_row['osc_cat_parent'] != 0){
|
| 486 |
$parent_id = $this->getMageParentID($category_row['osc_cat_parent'],$readConnection);
|
| 503 |
$writeConnection->query($sql);
|
| 504 |
|
| 505 |
$totalimport++;
|
| 506 |
+
if ($totalimport == Mage::getStoreConfig('oscommerceimportconf/mageconfiguration/conf_totalperimportcat',Mage::app()->getStore())){
|
| 507 |
break;
|
| 508 |
}
|
| 509 |
}
|
| 518 |
|
| 519 |
}
|
| 520 |
catch (Exception $ex) {
|
| 521 |
+
Mage::getSingleton('core/session')->setErrorMSG('osCommerce Category ID: '.$category_row['osc_cat_id'].'<br>Name: '.$category_row['osc_cat_title'].'<br>Exception: '.$ex->getMessage());
|
|
|
|
| 522 |
}
|
| 523 |
|
| 524 |
// Start Indexes
|
| 542 |
|
| 543 |
|
| 544 |
/*******************************************************************************/
|
| 545 |
+
/* Step 5 */
|
| 546 |
/*******************************************************************************/
|
| 547 |
public function step5Action()
|
| 548 |
+
{
|
| 549 |
+
|
| 550 |
+
Mage::getSingleton('core/session')->setErrorMSG('');
|
| 551 |
+
|
| 552 |
try {
|
| 553 |
$resource = Mage::getSingleton('core/resource');
|
| 554 |
$readConnection = $resource->getConnection('core_read');
|
| 578 |
}
|
| 579 |
|
| 580 |
/*******************************************************************************/
|
| 581 |
+
/* Step 5.1 */
|
| 582 |
/*******************************************************************************/
|
| 583 |
public function step51Action()
|
| 584 |
{
|
| 585 |
|
| 586 |
+
Mage::getSingleton('core/session')->setErrorMSG('');
|
| 587 |
+
|
| 588 |
+
$storeId = Mage::getStoreConfig('oscommerceimportconf/mageconfiguration/conf_website',Mage::app()->getStore());
|
| 589 |
+
$parent_cat = Mage::getStoreConfig('oscommerceimportconf/mageconfiguration/conf_category',Mage::app()->getStore());
|
| 590 |
+
|
| 591 |
$_config = $this->setRemoteConectionConfig();
|
| 592 |
// Stop Indexes
|
| 593 |
// http://www.clounce.com/magento/magento-reindex-programmatically
|
| 613 |
//print $row['osc_product_id'].' => '.$row['osc_product_name'].' => '.$row['mage_product_id'].'<br>';
|
| 614 |
|
| 615 |
$product_osc = $this->getProductFromOSC($row['osc_product_id'],$readConnection,$_connection_remote);
|
| 616 |
+
$product_categories_osc = $this->getCategoriesProductFromOSC($row['osc_product_id'],$readConnection,$_connection_remote,$parent_cat);
|
| 617 |
+
|
| 618 |
// some validation
|
| 619 |
if ($product_osc['products_model'] == '') {
|
| 620 |
$product_osc['products_model'] = $row['products_id'];
|
| 621 |
}
|
| 622 |
|
| 623 |
+
$product_osc['products_description'] = str_replace('\"','',$product_osc['products_description']);
|
| 624 |
+
|
| 625 |
+
|
| 626 |
//search if sku exits
|
| 627 |
$oProduct = Mage::getModel("catalog/product")
|
| 628 |
->getCollection()
|
| 662 |
$product->setCreatedAt(strtotime('now'));
|
| 663 |
|
| 664 |
if ($product_osc['products_image'] != ''){
|
| 665 |
+
$allowimages = $this->getImageAllow($product_osc['products_image']);
|
| 666 |
+
if ($allowimages){
|
| 667 |
+
$image_location = $this->getDownloadImage("product",$product_osc['products_image']);
|
| 668 |
+
if ( file_exists($image_location) ) {
|
| 669 |
+
$product->addImageToMediaGallery($image_location,array('thumbnail','small_image','image'),true,false);
|
| 670 |
+
}
|
| 671 |
}
|
| 672 |
}
|
| 673 |
|
| 691 |
|
| 692 |
}
|
| 693 |
catch (Exception $ex) {
|
| 694 |
+
Mage::getSingleton('core/session')->setErrorMSG('osCommerce Product ID: '.$row['osc_product_id'].'<br>Name: '.$product_osc['products_name'].'<br> Description: '.$product_osc['products_description'].'<br>Exception: '.$ex->getMessage());
|
|
|
|
| 695 |
}
|
| 696 |
|
| 697 |
|
| 723 |
public function step6Action()
|
| 724 |
{
|
| 725 |
$this->loadLayout();
|
| 726 |
+
Mage::getSingleton('core/session')->setErrorMSG('');
|
| 727 |
|
| 728 |
+
try {
|
| 729 |
+
$resource = Mage::getSingleton('core/resource');
|
| 730 |
+
$readConnection = $resource->getConnection('core_read');
|
| 731 |
+
|
| 732 |
+
$sql = "select * from ezmage_customers where customers_imported='y'";
|
| 733 |
+
$list = $readConnection->fetchAll($sql);
|
| 734 |
+
$importedCustomersTotal = sizeof($list);
|
| 735 |
+
Mage::getSingleton('core/session')->setimportedCustomersTotal($importedCustomersTotal);
|
| 736 |
+
}
|
| 737 |
+
catch (Exception $ex) {
|
| 738 |
+
//Mage::register('conection_status',$ex->getMessage());
|
| 739 |
+
echo $ex->getMessage();
|
| 740 |
+
}
|
| 741 |
+
|
| 742 |
$block = $this->getLayout()->createBlock(
|
| 743 |
'Mage_Core_Block_Template',
|
| 744 |
'block_ezmage_oscommerce_import_step4',
|
| 755 |
/* Step 6.1 */
|
| 756 |
/*******************************************************************************/
|
| 757 |
public function step61Action()
|
| 758 |
+
{
|
| 759 |
+
|
| 760 |
+
Mage::getSingleton('core/session')->setErrorMSG('');
|
| 761 |
+
|
| 762 |
+
// Stop Indexes
|
| 763 |
+
// http://www.clounce.com/magento/magento-reindex-programmatically
|
| 764 |
+
// http://stackoverflow.com/questions/5420552/magento-programmatically-disable-automatic-indexing
|
| 765 |
+
$pCollection = Mage::getSingleton('index/indexer')->getProcessesCollection();
|
| 766 |
+
foreach ($pCollection as $process) {
|
| 767 |
+
$process->setMode(Mage_Index_Model_Process::MODE_MANUAL)->save();
|
| 768 |
+
}
|
| 769 |
+
|
| 770 |
+
$_config = $this->setRemoteConectionConfig();
|
| 771 |
+
|
| 772 |
+
$totalimport = 0;
|
| 773 |
+
$storeId = Mage::getStoreConfig('oscommerceimportconf/mageconfiguration/conf_website',Mage::app()->getStore());
|
| 774 |
+
|
| 775 |
+
try {
|
| 776 |
+
$resource = Mage::getSingleton('core/resource');
|
| 777 |
+
$readConnection = $resource->getConnection('core_read');
|
| 778 |
+
$writeConnection = $resource->getConnection('core_write');
|
| 779 |
+
$_connection_remote = Mage::getSingleton('core/resource')->createConnection('oscommerce_conection', 'pdo_mysql', $_config);
|
| 780 |
+
|
| 781 |
+
$storeId = Mage::getStoreConfig('oscommerceimportconf/mageconfiguration/conf_website',Mage::app()->getStore());
|
| 782 |
+
|
| 783 |
+
$sql = "select * from ezmage_customers where customers_imported<>'y'";
|
| 784 |
+
$results = $readConnection->fetchAll($sql);
|
| 785 |
+
|
| 786 |
+
foreach($results as $row) {
|
| 787 |
+
//print $row['osc_customers_id'].'<br>';
|
| 788 |
+
$query = 'select * from customers where customers_id = '.$row['osc_customers_id'];
|
| 789 |
+
$customer_results = $_connection_remote->fetchAll($query);
|
| 790 |
+
if (sizeof($customer_results) == 1){
|
| 791 |
+
$customer = Mage::getModel('customer/customer');
|
| 792 |
+
$password = rand(1111111,9999999);
|
| 793 |
+
$customer->setWebsiteId($storeId);
|
| 794 |
+
$customer->loadByEmail($customer_results[0]['']);
|
| 795 |
+
if(!$customer->getId()) {
|
| 796 |
+
//$groups = Mage::getResourceModel('customer/group_collection')->getData();
|
| 797 |
+
//$groupID = '3';
|
| 798 |
+
//$customer->setData( 'group_id', $groupID );
|
| 799 |
+
|
| 800 |
+
$customer->setEmail($customer_results[0]['customers_email_address']);
|
| 801 |
+
$customer->setFirstname($customer_results[0]['customers_firstname']);
|
| 802 |
+
$customer->setLastname($customer_results[0]['customers_lastname']);
|
| 803 |
+
if ($customer_results[0]['customers_lastname'] == 'm'){
|
| 804 |
+
$customer->setGender(1); // 1 male 2 female
|
| 805 |
+
}else{
|
| 806 |
+
$customer->setGender(2); // 1 male 2 female
|
| 807 |
+
}
|
| 808 |
+
$customer->setPassword($password);
|
| 809 |
+
$customer->setDob($customer_results[0]['customers_dob']);
|
| 810 |
+
|
| 811 |
+
$customer->setConfirmation(null);
|
| 812 |
+
$customer->save();
|
| 813 |
+
|
| 814 |
+
//print $customer->getId().'<br>';
|
| 815 |
+
|
| 816 |
+
// Get Address
|
| 817 |
+
$query = "SELECT address_book.*,countries.countries_iso_code_2,zones.zone_name FROM (address_book LEFT JOIN countries on countries.countries_id=address_book.entry_country_id) LEFT JOIN zones on zones.zone_id=address_book.entry_zone_id WHERE address_book.customers_id =".$row['osc_customers_id'];
|
| 818 |
+
$customer_address_book = $_connection_remote->fetchAll($query);
|
| 819 |
+
foreach($customer_address_book as $row_address_book) {
|
| 820 |
+
$address = Mage::getModel("customer/address");
|
| 821 |
+
$address->setCustomerId($customer->getId());
|
| 822 |
+
$address->firstname = $row_address_book['entry_firstname'];
|
| 823 |
+
$address->lastname = $row_address_book['entry_lastname'];
|
| 824 |
+
$address->country_id = $row_address_book['countries_iso_code_2'];
|
| 825 |
+
$address->street = $row_address_book['entry_street_address'];
|
| 826 |
+
$address->postcode = $row_address_book['entry_postcode'];
|
| 827 |
+
$address->city = $row_address_book['entry_city'];
|
| 828 |
+
$address->region = $row_address_book['zone_name'];
|
| 829 |
+
$address->telephone = $customer_results[0]['customers_telephone'];
|
| 830 |
+
$address->company = $row_address_book['entry_company'];
|
| 831 |
+
$address->save();
|
| 832 |
+
|
| 833 |
+
if ($customer_results[0]['customers_default_address_id'] == $row_address_book['address_book_id']){
|
| 834 |
+
$customers_default_address_id = $address->getId();
|
| 835 |
+
}
|
| 836 |
+
}
|
| 837 |
+
$customer->setDefaultBilling($customers_default_address_id);
|
| 838 |
+
$customer->setDefaultShipping($customers_default_address_id);
|
| 839 |
+
$customer->save();
|
| 840 |
+
}
|
| 841 |
+
}
|
| 842 |
+
|
| 843 |
+
// update tmp table
|
| 844 |
+
$sql = "update ezmage_customers set customers_imported='y',mage_customers_id=".$customer->getId()." where osc_customers_id=".$row['osc_customers_id'];
|
| 845 |
+
$writeConnection->query($sql);
|
| 846 |
+
|
| 847 |
+
$totalimport++;
|
| 848 |
+
if ($totalimport == Mage::getStoreConfig('oscommerceimportconf/mageconfiguration/conf_totalperimportcustomer',Mage::app()->getStore())){
|
| 849 |
+
break;
|
| 850 |
+
}
|
| 851 |
+
}
|
| 852 |
+
|
| 853 |
+
//exit;
|
| 854 |
+
|
| 855 |
+
// get import status
|
| 856 |
+
$sql = "select osc_customers_id from ezmage_customers where customers_imported='y'";
|
| 857 |
+
$list = $readConnection->fetchAll($sql);
|
| 858 |
+
$importedCustomersTotal = sizeof($list);
|
| 859 |
+
Mage::getSingleton('core/session')->setimportedCustomersTotal($importedCustomersTotal);
|
| 860 |
+
|
| 861 |
+
}
|
| 862 |
+
catch (Exception $ex) {
|
| 863 |
+
//echo $ex->getMessage();
|
| 864 |
+
Mage::getSingleton('core/session')->setErrorMSG('osCommerce Customer ID: '.$customer_row['osc_cat_id'].'<br>Email: '.$customer_results[0]['customers_email_address'].'<br>Exception: '.$ex->getMessage());
|
| 865 |
+
}
|
| 866 |
+
|
| 867 |
+
// Start Indexes
|
| 868 |
+
foreach ($pCollection as $process) {
|
| 869 |
+
$process->setMode(Mage_Index_Model_Process::MODE_REAL_TIME)->save();
|
| 870 |
+
}
|
| 871 |
+
|
| 872 |
+
$this->loadLayout();
|
| 873 |
+
|
| 874 |
+
$block = $this->getLayout()->createBlock(
|
| 875 |
+
'Mage_Core_Block_Template',
|
| 876 |
+
'block_ezmage_oscommerce_import_step6',
|
| 877 |
+
array('template' => 'ezmage/oscommerceimport/step6.phtml')
|
| 878 |
+
);
|
| 879 |
+
|
| 880 |
+
$this->getLayout()->getBlock('content')->append($block);
|
| 881 |
+
$this->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');
|
| 882 |
+
|
| 883 |
+
$this->renderLayout();
|
| 884 |
+
}
|
| 885 |
+
|
| 886 |
+
|
| 887 |
+
/*******************************************************************************/
|
| 888 |
+
/* Step 7 */
|
| 889 |
+
/*******************************************************************************/
|
| 890 |
+
public function step7Action()
|
| 891 |
+
{
|
| 892 |
+
|
| 893 |
+
Mage::getSingleton('core/session')->setErrorMSG('');
|
| 894 |
+
|
| 895 |
+
try {
|
| 896 |
+
//create products top import delete products, shipping, coupon, taxes,others
|
| 897 |
+
$this->CreateGeneralProducts();
|
| 898 |
+
|
| 899 |
+
|
| 900 |
+
$resource = Mage::getSingleton('core/resource');
|
| 901 |
+
$readConnection = $resource->getConnection('core_read');
|
| 902 |
+
|
| 903 |
+
$sql = "select osc_order_id from ezmage_orders where order_imported='y'";
|
| 904 |
+
$list = $readConnection->fetchAll($sql);
|
| 905 |
+
$importedOrdersTotal = sizeof($list);
|
| 906 |
+
Mage::getSingleton('core/session')->setimportedOrdersTotal($importedOrdersTotal);
|
| 907 |
+
}
|
| 908 |
+
catch (Exception $ex) {
|
| 909 |
+
//Mage::register('conection_status',$ex->getMessage());
|
| 910 |
+
echo $ex->getMessage();
|
| 911 |
+
}
|
| 912 |
+
|
| 913 |
+
$this->loadLayout();
|
| 914 |
+
|
| 915 |
+
$block = $this->getLayout()->createBlock(
|
| 916 |
+
'Mage_Core_Block_Template',
|
| 917 |
+
'block_ezmage_oscommerce_import_step7',
|
| 918 |
+
array('template' => 'ezmage/oscommerceimport/step7.phtml')
|
| 919 |
+
);
|
| 920 |
+
|
| 921 |
+
$this->getLayout()->getBlock('content')->append($block);
|
| 922 |
+
$this->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');
|
| 923 |
+
|
| 924 |
+
$this->renderLayout();
|
| 925 |
+
}
|
| 926 |
+
|
| 927 |
+
/*******************************************************************************/
|
| 928 |
+
/* Step 71 */
|
| 929 |
+
/*******************************************************************************/
|
| 930 |
+
public function step71Action()
|
| 931 |
+
{
|
| 932 |
+
|
| 933 |
+
// Add here another order total methods
|
| 934 |
+
// Discount Modules list
|
| 935 |
+
$discount_modules = array('ot_customer_discount','ot_discount_coupon','ot_giftcard','ot_loyalty_discount','ot_quantity_discount');
|
| 936 |
+
// Other Charges Modules list
|
| 937 |
+
$others_modules = array('ot_custom','ot_loworderfee');
|
| 938 |
+
|
| 939 |
+
//$osc_order_totals_store = $this->GetOrderTotalsFromOSCAll($_connection_remote);
|
| 940 |
+
|
| 941 |
+
|
| 942 |
+
// Stop Indexes
|
| 943 |
+
// http://www.clounce.com/magento/magento-reindex-programmatically
|
| 944 |
+
// http://stackoverflow.com/questions/5420552/magento-programmatically-disable-automatic-indexing
|
| 945 |
+
$pCollection = Mage::getSingleton('index/indexer')->getProcessesCollection();
|
| 946 |
+
foreach ($pCollection as $process) {
|
| 947 |
+
$process->setMode(Mage_Index_Model_Process::MODE_MANUAL)->save();
|
| 948 |
+
}
|
| 949 |
+
|
| 950 |
+
$_config = $this->setRemoteConectionConfig();
|
| 951 |
+
|
| 952 |
+
$totalimport = 0;
|
| 953 |
+
$storeId = Mage::getStoreConfig('oscommerceimportconf/mageconfiguration/conf_website',Mage::app()->getStore());
|
| 954 |
+
|
| 955 |
+
try {
|
| 956 |
+
$resource = Mage::getSingleton('core/resource');
|
| 957 |
+
$readConnection = $resource->getConnection('core_read');
|
| 958 |
+
$writeConnection = $resource->getConnection('core_write');
|
| 959 |
+
$_connection_remote = Mage::getSingleton('core/resource')->createConnection('oscommerce_conection', 'pdo_mysql', $_config);
|
| 960 |
+
|
| 961 |
+
$sql = "select * from ezmage_orders where order_imported<>'y'";
|
| 962 |
+
$results = $readConnection->fetchAll($sql);
|
| 963 |
+
|
| 964 |
+
// Get List of ISO Countries
|
| 965 |
+
$country_list = $this->GetCountryList($_connection_remote);
|
| 966 |
+
|
| 967 |
+
// Import each order
|
| 968 |
+
foreach($results as $row) {
|
| 969 |
+
// GET Order Information
|
| 970 |
+
$osc_order = $this->GetOrderFromOSC($row['osc_order_id'],$_connection_remote);
|
| 971 |
+
// Get Orders products
|
| 972 |
+
$osc_order_products = $this->GetOrderProductsFromOSC($row['osc_order_id'],$_connection_remote);
|
| 973 |
+
// GET Comments Information
|
| 974 |
+
$osc_order_comments = $this->GetCommentsFromOSC($row['osc_order_id'],$_connection_remote);
|
| 975 |
+
// GET Order Totals
|
| 976 |
+
$osc_order_totals = $this->GetOrderTotalsFromOSC($row['osc_order_id'],$_connection_remote);
|
| 977 |
+
|
| 978 |
+
// Get Shipping Information
|
| 979 |
+
$shipping = $this->GetShippingTitle($osc_order_totals);
|
| 980 |
+
|
| 981 |
+
// Create Quote Order
|
| 982 |
+
$customer = Mage::getModel('customer/customer');
|
| 983 |
+
$customer->setWebsiteId($storeId);
|
| 984 |
+
$customer->loadByEmail($osc_order['customers_email_address']);
|
| 985 |
+
|
| 986 |
+
$shopping_cart = $this->PrepareShoppingCart($osc_order_products,$_connection_remote,$osc_order_totals,$discount_modules,$others_modules);
|
| 987 |
+
|
| 988 |
+
$params = array("AccountNo" => $customer->getId(), "PartCart" => $shopping_cart);
|
| 989 |
+
$this->global_shopping_cart = $shopping_cart;
|
| 990 |
+
$quote_id = $this->PrepareOrder($params,$osc_order,$osc_order_products,$shopping_cart);
|
| 991 |
+
|
| 992 |
+
// Create order
|
| 993 |
+
$this->global_shopping_cart = $shopping_cart;
|
| 994 |
+
$order_id = $this->ConfirmOrder($quote_id,$osc_order_products,$osc_order_totals,$osc_order,$shopping_cart,$shipping);
|
| 995 |
+
|
| 996 |
+
// Add Comments
|
| 997 |
+
$this->AddOrderComments($order_id,$osc_order_comments);
|
| 998 |
+
|
| 999 |
+
// Close Order
|
| 1000 |
+
$this->CloseOrder($order_id);
|
| 1001 |
+
|
| 1002 |
+
// update ezmage_orders
|
| 1003 |
+
$sql = "update ezmage_orders set order_imported='y',mage_order_id=".$order_id." where osc_order_id=".$row['osc_order_id'];
|
| 1004 |
+
$writeConnection->query($sql);
|
| 1005 |
+
|
| 1006 |
+
$totalimport++;
|
| 1007 |
+
if ($totalimport == Mage::getStoreConfig('oscommerceimportconf/mageconfiguration/conf_totalperimportorder',Mage::app()->getStore())){
|
| 1008 |
+
break;
|
| 1009 |
+
}
|
| 1010 |
+
|
| 1011 |
+
}
|
| 1012 |
+
|
| 1013 |
+
|
| 1014 |
+
// get import status
|
| 1015 |
+
$sql = "select osc_order_id from ezmage_orders where order_imported='y'";
|
| 1016 |
+
$list = $readConnection->fetchAll($sql);
|
| 1017 |
+
$importedOrdersTotal = sizeof($list);
|
| 1018 |
+
Mage::getSingleton('core/session')->setimportedOrdersTotal($importedOrdersTotal);
|
| 1019 |
+
}
|
| 1020 |
+
catch (Exception $ex) {
|
| 1021 |
+
Mage::register('conection_status','Oscommerce Order ID:'.$row['osc_order_id'].' - '.$ex->getMessage());
|
| 1022 |
+
//echo $ex->getMessage();
|
| 1023 |
+
}
|
| 1024 |
+
|
| 1025 |
+
$this->loadLayout();
|
| 1026 |
+
|
| 1027 |
+
$block = $this->getLayout()->createBlock(
|
| 1028 |
+
'Mage_Core_Block_Template',
|
| 1029 |
+
'block_ezmage_oscommerce_import_step7',
|
| 1030 |
+
array('template' => 'ezmage/oscommerceimport/step7.phtml')
|
| 1031 |
+
);
|
| 1032 |
+
|
| 1033 |
+
$this->getLayout()->getBlock('content')->append($block);
|
| 1034 |
+
$this->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');
|
| 1035 |
+
|
| 1036 |
+
$this->renderLayout();
|
| 1037 |
+
}
|
| 1038 |
+
|
| 1039 |
+
|
| 1040 |
+
/*******************************************************************************/
|
| 1041 |
+
/* Step 8 */
|
| 1042 |
+
/*******************************************************************************/
|
| 1043 |
+
public function step8Action()
|
| 1044 |
+
{
|
| 1045 |
+
$this->loadLayout();
|
| 1046 |
+
|
| 1047 |
+
$block = $this->getLayout()->createBlock(
|
| 1048 |
+
'Mage_Core_Block_Template',
|
| 1049 |
+
'block_ezmage_oscommerce_import_step4',
|
| 1050 |
+
array('template' => 'ezmage/oscommerceimport/step8.phtml')
|
| 1051 |
+
);
|
| 1052 |
+
|
| 1053 |
+
$this->getLayout()->getBlock('content')->append($block);
|
| 1054 |
+
$this->getLayout()->getBlock('root')->setTemplate('page/1column.phtml');
|
| 1055 |
+
|
| 1056 |
+
$this->renderLayout();
|
| 1057 |
+
}
|
| 1058 |
+
|
| 1059 |
+
/*******************************************************************************/
|
| 1060 |
+
/* Step 8.1 */
|
| 1061 |
+
/*******************************************************************************/
|
| 1062 |
+
public function step81Action()
|
| 1063 |
{
|
| 1064 |
|
| 1065 |
try{
|
| 1073 |
$writeConnection->query($query);
|
| 1074 |
$query = 'drop table ezmage_products';
|
| 1075 |
$writeConnection->query($query);
|
| 1076 |
+
$query = 'drop table ezmage_customers';
|
| 1077 |
+
$writeConnection->query($query);
|
| 1078 |
+
$query = 'drop table ezmage_orders';
|
| 1079 |
+
$writeConnection->query($query);
|
| 1080 |
|
| 1081 |
}
|
| 1082 |
catch (Exception $ex) {
|
| 1091 |
Mage::getSingleton('core/session')->unsimportedCategoryTotal();
|
| 1092 |
Mage::getSingleton('core/session')->unsimportProductsTotal();
|
| 1093 |
Mage::getSingleton('core/session')->unsimportedProductsTotal();
|
| 1094 |
+
Mage::getSingleton('core/session')->unsimportCustomersTotal();
|
| 1095 |
+
Mage::getSingleton('core/session')->unsimportedCustomersTotal();
|
| 1096 |
+
Mage::getSingleton('core/session')->unsimportOrdersTotal();
|
| 1097 |
+
Mage::getSingleton('core/session')->unsimportedOrdersTotal();
|
| 1098 |
|
| 1099 |
$this->loadLayout();
|
| 1100 |
|
| 1109 |
|
| 1110 |
$this->renderLayout();
|
| 1111 |
}
|
| 1112 |
+
|
| 1113 |
+
|
| 1114 |
+
/***************************************************************************************************************/
|
| 1115 |
+
// ORDERS FUNCTIONS
|
| 1116 |
+
/***************************************************************************************************************/
|
| 1117 |
+
|
| 1118 |
+
public function CreateDeleteProduct($product_info){
|
| 1119 |
+
|
| 1120 |
+
$parent_category = Mage::getStoreConfig('oscommerceimportconf/mageconfiguration/conf_category',Mage::app()->getStore());
|
| 1121 |
+
$storeId = Mage::getStoreConfig('oscommerceimportconf/mageconfiguration/conf_website',Mage::app()->getStore());
|
| 1122 |
+
$AttributeSetId = Mage::getStoreConfig('oscommerceimportconf/mageconfiguration/conf_attribute',Mage::app()->getStore());
|
| 1123 |
+
|
| 1124 |
+
if ($product_info['products_model'] != ''){
|
| 1125 |
+
$sku = $product_info['products_model'];
|
| 1126 |
+
}else{
|
| 1127 |
+
$sku = $product_info['products_id'];
|
| 1128 |
+
}
|
| 1129 |
+
|
| 1130 |
+
$product = new Mage_Catalog_Model_Product();
|
| 1131 |
+
// Build the product
|
| 1132 |
+
$product->setSku($sku);
|
| 1133 |
+
$product->setAttributeSetId($AttributeSetId);
|
| 1134 |
+
$product->setTypeId('simple');
|
| 1135 |
+
$product->setName($product_info['products_name']);
|
| 1136 |
+
$product->setCategoryIds($parent_category);
|
| 1137 |
+
$product->setWebsiteIDs(array($storeId));
|
| 1138 |
+
$product->setDescription('-');
|
| 1139 |
+
$product->setShortDescription('-');
|
| 1140 |
+
$product->setPrice($product_info['products_price']);
|
| 1141 |
+
$product->setWeight(0);
|
| 1142 |
+
|
| 1143 |
+
$product->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE);
|
| 1144 |
+
$product->setStatus(1);
|
| 1145 |
+
$product->setTaxClassId(0); # My default tax class
|
| 1146 |
+
$product->setStockData(array(
|
| 1147 |
+
'is_in_stock' => 1,
|
| 1148 |
+
'qty' => 10000
|
| 1149 |
+
));
|
| 1150 |
+
|
| 1151 |
+
$product->setCreatedAt(strtotime('now'));
|
| 1152 |
+
$product->save();
|
| 1153 |
+
|
| 1154 |
+
return $product->getId();
|
| 1155 |
+
}
|
| 1156 |
+
|
| 1157 |
+
public function GetExtraChargeName($product_id){
|
| 1158 |
+
$products_title = '';
|
| 1159 |
+
$found = false;
|
| 1160 |
+
|
| 1161 |
+
foreach($this->global_shopping_cart as $row) {
|
| 1162 |
+
if (($row['PartId'] == $product_id) and ($row['item_type'] == 'osc-extra') and ($found == false)){
|
| 1163 |
+
$found = true;
|
| 1164 |
+
$products_title = $row['products_title'];;
|
| 1165 |
+
if (substr(trim($row['products_title']), -1) == ":"){
|
| 1166 |
+
$products_title = substr(trim($row['products_title']), 0, -1);
|
| 1167 |
+
}
|
| 1168 |
+
}else{
|
| 1169 |
+
$new_shopping_cart[] = $row;
|
| 1170 |
+
}
|
| 1171 |
+
}
|
| 1172 |
+
|
| 1173 |
+
$this->global_shopping_cart = $new_shopping_cart;
|
| 1174 |
+
|
| 1175 |
+
return $products_title;
|
| 1176 |
+
}
|
| 1177 |
+
|
| 1178 |
+
public function GetProductPrice($product_id){
|
| 1179 |
+
$found = false;
|
| 1180 |
+
$price = 0;
|
| 1181 |
+
foreach($this->global_shopping_cart as $row) {
|
| 1182 |
+
if (($row['PartId'] == $product_id) and ($found == false)){
|
| 1183 |
+
$found = true;
|
| 1184 |
+
$price = $row['products_price'];
|
| 1185 |
+
}else{
|
| 1186 |
+
$new_shopping_cart[] = $row;
|
| 1187 |
+
}
|
| 1188 |
+
}
|
| 1189 |
+
$this->global_shopping_cart = $new_shopping_cart;
|
| 1190 |
+
return $price;
|
| 1191 |
+
}
|
| 1192 |
+
|
| 1193 |
+
public function CloseOrder($order_id){
|
| 1194 |
+
$order = Mage::getModel('sales/order')->loadByIncrementID($order_id);
|
| 1195 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true);
|
| 1196 |
+
$order->save();
|
| 1197 |
+
|
| 1198 |
+
try {
|
| 1199 |
+
if(!$order->canInvoice()){
|
| 1200 |
+
Mage::throwException(Mage::helper('core')->__('Cannot create an invoice.'));
|
| 1201 |
+
}
|
| 1202 |
+
|
| 1203 |
+
$invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
|
| 1204 |
+
|
| 1205 |
+
if (!$invoice->getTotalQty()) {
|
| 1206 |
+
Mage::throwException(Mage::helper('core')->__('Cannot create an invoice without products.'));
|
| 1207 |
+
}
|
| 1208 |
+
|
| 1209 |
+
$invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
|
| 1210 |
+
$invoice->register();
|
| 1211 |
+
$transactionSave = Mage::getModel('core/resource_transaction')->addObject($invoice)->addObject($invoice->getOrder());
|
| 1212 |
+
|
| 1213 |
+
$transactionSave->save();
|
| 1214 |
+
}
|
| 1215 |
+
catch (Mage_Core_Exception $e) {
|
| 1216 |
+
Mage::register('conection_status','Invoice - Order ID:'.order_id.' - '.$e->getMessage());
|
| 1217 |
+
}
|
| 1218 |
+
|
| 1219 |
+
try {
|
| 1220 |
+
if($order->canShip()) {
|
| 1221 |
+
$itemQty = $order->getItemsCollection()->count();
|
| 1222 |
+
$shipment = Mage::getModel('sales/service_order', $order)->prepareShipment($itemQty);
|
| 1223 |
+
$shipment = new Mage_Sales_Model_Order_Shipment_Api();
|
| 1224 |
+
$shipmentId = $shipment->create($order_id);
|
| 1225 |
+
}
|
| 1226 |
+
}catch (Mage_Core_Exception $e) {
|
| 1227 |
+
Mage::register('conection_status','Shipping - Order ID:'.order_id.' - '.$e->getMessage());
|
| 1228 |
+
}
|
| 1229 |
+
|
| 1230 |
+
}
|
| 1231 |
+
|
| 1232 |
+
|
| 1233 |
+
public function AddOrderComments($order_id,$osc_order_comments){
|
| 1234 |
+
foreach($osc_order_comments as $row) {
|
| 1235 |
+
// Get the order - we could also use the internal Magento order ID and the load() method here
|
| 1236 |
+
$order = Mage::getModel('sales/order')->loadByIncrementId($order_id);
|
| 1237 |
+
// Add the comment and save the order
|
| 1238 |
+
$comment = $row['orders_status_name'];
|
| 1239 |
+
if ($row['comments'] != ''){
|
| 1240 |
+
$comment = $comment.' - '.$row['comments'];
|
| 1241 |
+
}
|
| 1242 |
+
$is_customer_notified = false;
|
| 1243 |
+
if ($row['customer_notified'] == 1){
|
| 1244 |
+
$is_customer_notified = true;
|
| 1245 |
+
}
|
| 1246 |
+
$order->addStatusToHistory($order->getStatus(), $comment, $is_customer_notified);
|
| 1247 |
+
$order->save();
|
| 1248 |
+
}
|
| 1249 |
+
}
|
| 1250 |
+
|
| 1251 |
+
public function ConfirmOrder($quoteId,$osc_order_products,$osc_order_totals,$osc_order,$shopping_cart,$shipping){
|
| 1252 |
+
|
| 1253 |
+
$hpc_payment_method = 'purchaseorder'; // checkmo purchaseorder
|
| 1254 |
+
//methods: flatrate_flatrate, freeshipping_freeshipping
|
| 1255 |
+
$hpc_shipping_method = 'flatrate_flatrate';
|
| 1256 |
+
$hpc_shipping_method_description = $shipping;
|
| 1257 |
+
|
| 1258 |
+
$quoteObj = Mage::getModel('sales/quote')->load($quoteId);
|
| 1259 |
+
|
| 1260 |
+
$items = $quoteObj->getAllItems();
|
| 1261 |
+
|
| 1262 |
+
$quoteObj->collectTotals();
|
| 1263 |
+
$quoteObj->reserveOrderId();
|
| 1264 |
+
|
| 1265 |
+
$quotePaymentObj = $quoteObj->getPayment();
|
| 1266 |
+
//methods: authorizenet, paypal_express, googlecheckout, purchaseorder
|
| 1267 |
+
$quotePaymentObj->setMethod($hpc_payment_method);
|
| 1268 |
+
|
| 1269 |
+
$quoteObj->setPayment($quotePaymentObj);
|
| 1270 |
+
$convertQuoteObj = Mage::getSingleton('sales/convert_quote');
|
| 1271 |
+
|
| 1272 |
+
$orderObj = $convertQuoteObj->addressToOrder($quoteObj->getShippingAddress());
|
| 1273 |
+
|
| 1274 |
+
$orderPaymentObj = $convertQuoteObj->paymentToOrderPayment($quotePaymentObj);
|
| 1275 |
+
$orderObj->setBillingAddress($convertQuoteObj->addressToOrderAddress($quoteObj->getBillingAddress()));
|
| 1276 |
+
|
| 1277 |
+
$orderObj->setShippingAddress($convertQuoteObj->addressToOrderAddress($quoteObj->getShippingAddress()))
|
| 1278 |
+
->setShipping_method($hpc_shipping_method)
|
| 1279 |
+
->setShippingDescription($hpc_shipping_method_description);
|
| 1280 |
+
|
| 1281 |
+
$orderObj->setPayment($convertQuoteObj->paymentToOrderPayment($quoteObj->getPayment()));
|
| 1282 |
+
|
| 1283 |
+
foreach ($items as $item) {
|
| 1284 |
+
//@var $item Mage_Sales_Model_Quote_Item
|
| 1285 |
+
$orderItem = $convertQuoteObj->itemToOrderItem($item);
|
| 1286 |
+
if ($item->getParentItem()) {
|
| 1287 |
+
$orderItem->setParentItem($orderObj->getItemByQuoteItemId($item->getParentItem()->getId()));
|
| 1288 |
+
}
|
| 1289 |
+
|
| 1290 |
+
$product_name = $this->GetExtraChargeName($orderItem->getProductId());
|
| 1291 |
+
if ($product_name != ''){
|
| 1292 |
+
$orderItem->setName($product_name);
|
| 1293 |
+
}
|
| 1294 |
+
|
| 1295 |
+
//$orderItem->setOriginalPrice($this->GetProductPrice($orderItem->getId(),$shopping_cart));
|
| 1296 |
+
$orderObj->addItem($orderItem);
|
| 1297 |
+
}
|
| 1298 |
+
|
| 1299 |
+
$orderObj->setCanShipPartiallyItem(false);
|
| 1300 |
+
|
| 1301 |
+
$totalDue = $orderObj->getTotalDue();
|
| 1302 |
+
|
| 1303 |
+
//$orderObj->sendNewOrderEmail();
|
| 1304 |
+
$orderObj->setCreatedAt($osc_order['date_purchased']);
|
| 1305 |
+
// 2012-06-13 17:50:18
|
| 1306 |
+
//$a = strptime($osc_order['date_purchased'], '%Y-%m-%d %H:%M:%S');
|
| 1307 |
+
//$timestamp = mktime($a['tm_hour'], $a['tm_min'], $a['tm_sec'], $a['tm_mon'], $a['tm_mday'], $a['tm_year']);
|
| 1308 |
+
//$timestamp = mktime(17,17,17, 06, 13, 2012);
|
| 1309 |
+
//$orderObj->setCreatedAt(date('Y-m-d h:i:s A', $timestamp));
|
| 1310 |
+
|
| 1311 |
+
$orderObj->place(); //calls _placePayment
|
| 1312 |
+
$orderObj->save();
|
| 1313 |
+
|
| 1314 |
+
$orderObj->load(Mage::getSingleton('sales/order')->getLastOrderId());
|
| 1315 |
+
$lastOrderId = $orderObj->getIncrementId();
|
| 1316 |
+
|
| 1317 |
+
// Change status to Proccesing
|
| 1318 |
+
$order = Mage::getModel('sales/order')->loadByIncrementID($lastOrderId);
|
| 1319 |
+
$order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true);
|
| 1320 |
+
$order->save();
|
| 1321 |
+
|
| 1322 |
+
return $lastOrderId;
|
| 1323 |
+
}
|
| 1324 |
+
|
| 1325 |
+
public function PrepareOrder($params,$osc_order,$osc_order_products,$shopping_cart){
|
| 1326 |
+
foreach ($params as $k => $v) {
|
| 1327 |
+
$$k = $v;
|
| 1328 |
+
}
|
| 1329 |
+
$customerObj = Mage::getModel('customer/customer')->load($AccountNo);
|
| 1330 |
+
$storeId = $customerObj->getStoreId();
|
| 1331 |
+
$quoteObj = Mage::getModel('sales/quote')->assignCustomer($customerObj); //sets ship/bill address
|
| 1332 |
+
$storeObj = $quoteObj->getStore()->load($storeId);
|
| 1333 |
+
$quoteObj->setStore($storeObj);
|
| 1334 |
+
$productModel = Mage::getModel('catalog/product');
|
| 1335 |
+
|
| 1336 |
+
foreach ($PartCart as $part) {
|
| 1337 |
+
foreach ($part as $k => $v) {
|
| 1338 |
+
$$k = $v;
|
| 1339 |
+
}
|
| 1340 |
+
$productObj = $productModel->load($PartId);
|
| 1341 |
+
|
| 1342 |
+
try {
|
| 1343 |
+
$quoteItem = Mage::getModel('sales/quote_item')->setProduct($productObj);
|
| 1344 |
+
} catch (Exception $e) {
|
| 1345 |
+
Mage::register('conection_status','quote_item :'.$e->getMessage());
|
| 1346 |
+
}
|
| 1347 |
+
$quoteItem->setQuote($quoteObj);
|
| 1348 |
+
$quoteItem->setQty($Quantity);
|
| 1349 |
+
|
| 1350 |
+
|
| 1351 |
+
$quoteObj->setBillingAddress($this->GetOrderAddress($osc_order,'billing'));
|
| 1352 |
+
$quoteObj->setShippingAddress($this->GetOrderAddress($osc_order,'shipping'));
|
| 1353 |
+
|
| 1354 |
+
$quoteItem->setOriginalCustomPrice($this->GetProductPrice($PartId));
|
| 1355 |
+
$quoteObj->addItem($quoteItem);
|
| 1356 |
+
}
|
| 1357 |
+
|
| 1358 |
+
//$shippingMethod = 'flatrate_flatrate';
|
| 1359 |
+
//$quoteObj->getShippingAddress()->setShippingMethod($shippingMethod);
|
| 1360 |
+
//$quoteObj->getShippingAddress()->setCollectShippingRates(true);
|
| 1361 |
+
//$quoteObj->getShippingAddress()->collectShippingRates();
|
| 1362 |
+
//$quoteObj->collectTotals(); // calls $address->collectTotals();
|
| 1363 |
+
|
| 1364 |
+
$quoteObj->save();
|
| 1365 |
+
$quoteId = $quoteObj->getId();
|
| 1366 |
+
return $quoteId;
|
| 1367 |
+
}
|
| 1368 |
+
|
| 1369 |
+
// Return Address of the Order
|
| 1370 |
+
public function GetOrderAddress($osc_order,$type,$country_list){
|
| 1371 |
+
$address = Mage::getModel('sales/quote_address');
|
| 1372 |
+
if ($type == 'billing'){
|
| 1373 |
+
$name = explode(" ",$osc_order['billing_name']);
|
| 1374 |
+
$address['firstname'] = $name[0];
|
| 1375 |
+
$address['lastname'] = $name[1];
|
| 1376 |
+
$address['company'] = $osc_order['billing_company'];
|
| 1377 |
+
$address['email'] = $osc_order['customers_email_address'];
|
| 1378 |
+
$address['street'] = $osc_order['billing_street_address'];
|
| 1379 |
+
$address['city'] = $osc_order['billing_city'];
|
| 1380 |
+
$address['postcode'] = $osc_order['billing_postcode'];
|
| 1381 |
+
$address['country_id'] = $this->GetCountryISO2($osc_order['billing_country']); //countries_iso_code_2
|
| 1382 |
+
$address['telephone'] = $osc_order['customers_telephone'];
|
| 1383 |
+
$address['save_in_address_book'] = 0;
|
| 1384 |
+
}else{
|
| 1385 |
+
$name = explode(" ",$osc_order['delivery_name']);
|
| 1386 |
+
$address['firstname'] = $name[0];
|
| 1387 |
+
$address['lastname'] = $name[1];
|
| 1388 |
+
$address['company'] = $osc_order['delivery_company'];
|
| 1389 |
+
$address['email'] = $osc_order['customers_email_address'];
|
| 1390 |
+
$address['street'] = $osc_order['delivery_street_address'];
|
| 1391 |
+
$address['city'] = $osc_order['delivery_city'];
|
| 1392 |
+
$address['postcode'] = $osc_order['delivery_postcode'];
|
| 1393 |
+
$address['country_id'] = $this->GetCountryISO2($osc_order['delivery_country'],$country_list); //countries_iso_code_2
|
| 1394 |
+
$address['telephone'] = $osc_order['customers_telephone'];
|
| 1395 |
+
$address['save_in_address_book'] = 0;
|
| 1396 |
+
}
|
| 1397 |
+
return $address;
|
| 1398 |
+
}
|
| 1399 |
+
|
| 1400 |
+
public function GetCountryISO2($country,$country_list){
|
| 1401 |
+
foreach($country_list as $country_name => $country_iso) {
|
| 1402 |
+
if ($country_name == $country){
|
| 1403 |
+
return $country_iso;
|
| 1404 |
+
break;
|
| 1405 |
+
}
|
| 1406 |
+
}
|
| 1407 |
+
}
|
| 1408 |
|
| 1409 |
+
public function GetCountryList($_connection_remote){
|
| 1410 |
+
$query = 'SELECT countries_name,countries_iso_code_2 from countries';
|
| 1411 |
+
$results = $_connection_remote->fetchAll($query);
|
| 1412 |
+
foreach($results as $row) {
|
| 1413 |
+
$country_list[$row['countries_name']] = $row['countries_iso_code_2'];
|
| 1414 |
+
}
|
| 1415 |
+
return $country_list;
|
| 1416 |
+
}
|
| 1417 |
+
|
| 1418 |
+
public function GetShippingTitle($osc_order_totals){
|
| 1419 |
+
$shippinh_title = '';
|
| 1420 |
+
foreach($osc_order_totals as $row) {
|
| 1421 |
+
if ($row['class'] == 'ot_shipping'){
|
| 1422 |
+
$shippinh_title = $row['title'];
|
| 1423 |
+
if (substr(trim($row['title']), -1) == ":"){
|
| 1424 |
+
$shippinh_title = substr(trim($row['title']), 0, -1);
|
| 1425 |
+
}
|
| 1426 |
+
break;
|
| 1427 |
+
}
|
| 1428 |
+
}
|
| 1429 |
+
return $shippinh_title;
|
| 1430 |
+
}
|
| 1431 |
+
|
| 1432 |
+
public function PrepareShoppingCart($osc_order_products,$_connection_remote,$osc_order_totals,$discount_modules,$others_modules){
|
| 1433 |
+
foreach($osc_order_products as $row) {
|
| 1434 |
+
if ($row['products_model'] != ''){
|
| 1435 |
+
$sku = $row['products_model'];
|
| 1436 |
+
}else{
|
| 1437 |
+
$sku = $row['products_id'];
|
| 1438 |
+
}
|
| 1439 |
+
// Get Product ID
|
| 1440 |
+
$oProduct = Mage::getModel("catalog/product")
|
| 1441 |
+
->getCollection()
|
| 1442 |
+
->setStoreId($storeId)
|
| 1443 |
+
->addAttributeToSelect("sku")
|
| 1444 |
+
->addFieldToFilter("sku", array('eq' => $sku))
|
| 1445 |
+
->getFirstItem();
|
| 1446 |
+
|
| 1447 |
+
if ( sizeof($oProduct->getData()) > 0){
|
| 1448 |
+
$shopping_cart[] = array("PartId" => $oProduct->getId(),
|
| 1449 |
+
"Quantity" => $row['products_quantity'],
|
| 1450 |
+
"products_id" => $row['products_id'],
|
| 1451 |
+
"products_price" => $row['products_price'],
|
| 1452 |
+
"products_title" => '',
|
| 1453 |
+
"item_type" => 'product');
|
| 1454 |
+
}else{
|
| 1455 |
+
// Get Product ID
|
| 1456 |
+
$product_Id = $this->CreateDeleteProduct($row);
|
| 1457 |
+
$shopping_cart[] = array("PartId" => $product_Id,
|
| 1458 |
+
"Quantity" => $row['products_quantity'],
|
| 1459 |
+
"products_id" => $row['products_id'],
|
| 1460 |
+
"products_price" => $row['products_price'],
|
| 1461 |
+
"products_title" => $row['products_name'],
|
| 1462 |
+
"item_type" => 'osc-product');
|
| 1463 |
+
}
|
| 1464 |
+
}
|
| 1465 |
+
|
| 1466 |
+
// Add to Shopping Cart -> Shipping Cost, Discount
|
| 1467 |
+
// $osc_order_totals,$discount_modules,$others_modules
|
| 1468 |
+
|
| 1469 |
+
// Get osc-shipping Product ID
|
| 1470 |
+
$oProduct = Mage::getModel("catalog/product")
|
| 1471 |
+
->getCollection()
|
| 1472 |
+
->setStoreId($storeId)
|
| 1473 |
+
->addAttributeToSelect("sku")
|
| 1474 |
+
->addFieldToFilter("sku", array('eq' => 'osc-shipping'))
|
| 1475 |
+
->getFirstItem();
|
| 1476 |
+
$shipping_id = $oProduct->getId();
|
| 1477 |
+
|
| 1478 |
+
// Get osc-discount Product ID
|
| 1479 |
+
$oProduct = Mage::getModel("catalog/product")
|
| 1480 |
+
->getCollection()
|
| 1481 |
+
->setStoreId($storeId)
|
| 1482 |
+
->addAttributeToSelect("sku")
|
| 1483 |
+
->addFieldToFilter("sku", array('eq' => 'osc-discount'))
|
| 1484 |
+
->getFirstItem();
|
| 1485 |
+
$discount_id = $oProduct->getId();
|
| 1486 |
+
|
| 1487 |
+
// Get osc-tax Product ID
|
| 1488 |
+
$oProduct = Mage::getModel("catalog/product")
|
| 1489 |
+
->getCollection()
|
| 1490 |
+
->setStoreId($storeId)
|
| 1491 |
+
->addAttributeToSelect("sku")
|
| 1492 |
+
->addFieldToFilter("sku", array('eq' => 'osc-tax'))
|
| 1493 |
+
->getFirstItem();
|
| 1494 |
+
$tax_id = $oProduct->getId();
|
| 1495 |
+
|
| 1496 |
+
// Get osc-other Product ID
|
| 1497 |
+
$oProduct = Mage::getModel("catalog/product")
|
| 1498 |
+
->getCollection()
|
| 1499 |
+
->setStoreId($storeId)
|
| 1500 |
+
->addAttributeToSelect("sku")
|
| 1501 |
+
->addFieldToFilter("sku", array('eq' => 'osc-other'))
|
| 1502 |
+
->getFirstItem();
|
| 1503 |
+
$other_id = $oProduct->getId();
|
| 1504 |
+
|
| 1505 |
+
foreach($osc_order_totals as $row) {
|
| 1506 |
+
if (in_array($row['class'], $discount_modules)){
|
| 1507 |
+
$shopping_cart[] = array("PartId" => $discount_id,
|
| 1508 |
+
"Quantity" => 1,
|
| 1509 |
+
"products_id" => $row['orders_total_id'],
|
| 1510 |
+
"products_price" => $row['value'],
|
| 1511 |
+
"products_title" => $row['title'],
|
| 1512 |
+
"item_type" => 'osc-extra');
|
| 1513 |
+
|
| 1514 |
+
}elseif ($row['class'] == 'ot_tax' ){
|
| 1515 |
+
$shopping_cart[] = array("PartId" => $tax_id,
|
| 1516 |
+
"Quantity" => 1,
|
| 1517 |
+
"products_id" => $row['orders_total_id'],
|
| 1518 |
+
"products_price" => $row['value'],
|
| 1519 |
+
"products_title" => $row['title'],
|
| 1520 |
+
"item_type" => 'osc-extra');
|
| 1521 |
+
|
| 1522 |
+
}elseif ($row['class'] == 'ot_shipping' ){
|
| 1523 |
+
$shopping_cart[] = array("PartId" => $shipping_id,
|
| 1524 |
+
"Quantity" => 1,
|
| 1525 |
+
"products_id" => $row['orders_total_id'],
|
| 1526 |
+
"products_price" => $row['value'],
|
| 1527 |
+
"products_title" => $row['title'],
|
| 1528 |
+
"item_type" => 'osc-extra');
|
| 1529 |
+
}else{
|
| 1530 |
+
$shopping_cart[] = array("PartId" => $other_id,
|
| 1531 |
+
"Quantity" => 1,
|
| 1532 |
+
"products_id" => $row['orders_total_id'],
|
| 1533 |
+
"products_price" => $row['value'],
|
| 1534 |
+
"products_title" => $row['title'],
|
| 1535 |
+
"item_type" => 'osc-extra');
|
| 1536 |
+
}
|
| 1537 |
+
}
|
| 1538 |
+
|
| 1539 |
+
return $shopping_cart;
|
| 1540 |
+
}
|
| 1541 |
+
|
| 1542 |
+
// GET Order Information
|
| 1543 |
+
public function GetOrderFromOSC($order_id,$_connection_remote){
|
| 1544 |
+
$query = 'select * from orders where orders_id = '.$order_id;
|
| 1545 |
+
$results = $_connection_remote->fetchAll($query);
|
| 1546 |
+
if (sizeof($results) == 1){
|
| 1547 |
+
$product = $results[0];
|
| 1548 |
+
}else{
|
| 1549 |
+
$product['products_id'] = 0;
|
| 1550 |
+
}
|
| 1551 |
+
return $product;
|
| 1552 |
+
}
|
| 1553 |
+
|
| 1554 |
+
// GET Order Products Information
|
| 1555 |
+
public function GetOrderProductsFromOSC($order_id,$_connection_remote){
|
| 1556 |
+
$query = 'SELECT * from orders_products where orders_id='.$order_id;
|
| 1557 |
+
$results = $_connection_remote->fetchAll($query);
|
| 1558 |
+
foreach($results as $row) {
|
| 1559 |
+
$order_products[] = $row;
|
| 1560 |
+
}
|
| 1561 |
+
return $order_products;
|
| 1562 |
+
}
|
| 1563 |
+
|
| 1564 |
+
// GET Orders Comments Information
|
| 1565 |
+
public function GetCommentsFromOSC($order_id,$_connection_remote){
|
| 1566 |
+
$query = 'SELECT orders_status_history . * , orders_status.orders_status_name FROM orders_status_history, orders_status where orders_status.orders_status_id = orders_status_history.orders_status_id AND orders_status.language_id =1 AND orders_status_history.orders_id ='.$order_id;
|
| 1567 |
+
$results = $_connection_remote->fetchAll($query);
|
| 1568 |
+
foreach($results as $row) {
|
| 1569 |
+
$order_comments[] = $row;
|
| 1570 |
+
}
|
| 1571 |
+
return $order_comments;
|
| 1572 |
+
}
|
| 1573 |
+
|
| 1574 |
+
// GET Order Totals Store
|
| 1575 |
+
public function GetOrderTotalsFromOSCAll($_connection_remote){
|
| 1576 |
+
$query = 'SELECT DISTINCT * FROM `orders_total` WHERE class <>"ot_total" and class<>"ot_subtotal"';
|
| 1577 |
+
$results = $_connection_remote->fetchAll($query);
|
| 1578 |
+
foreach($results as $row) {
|
| 1579 |
+
$order_totals[] = $row;
|
| 1580 |
+
}
|
| 1581 |
+
return $order_totals;
|
| 1582 |
+
}
|
| 1583 |
|
| 1584 |
+
// GET Order Totals Per Order
|
| 1585 |
+
public function GetOrderTotalsFromOSC($order_id,$_connection_remote){
|
| 1586 |
+
$query = 'SELECT * FROM `orders_total` WHERE class <>"ot_total" and class<>"ot_subtotal" and `orders_id`='.$order_id;
|
| 1587 |
+
$results = $_connection_remote->fetchAll($query);
|
| 1588 |
+
foreach($results as $row) {
|
| 1589 |
+
$order_totals[] = $row;
|
| 1590 |
+
}
|
| 1591 |
+
return $order_totals;
|
| 1592 |
+
}
|
| 1593 |
+
|
| 1594 |
+
|
| 1595 |
+
public function CreateGeneralProducts(){
|
| 1596 |
+
try {
|
| 1597 |
|
| 1598 |
+
$parent_category = Mage::getStoreConfig('oscommerceimportconf/mageconfiguration/conf_category',Mage::app()->getStore());
|
| 1599 |
+
$storeId = Mage::getStoreConfig('oscommerceimportconf/mageconfiguration/conf_website',Mage::app()->getStore());
|
| 1600 |
+
$AttributeSetId = Mage::getStoreConfig('oscommerceimportconf/mageconfiguration/conf_attribute',Mage::app()->getStore());
|
| 1601 |
+
|
| 1602 |
+
/////////////////////////////////////////////////////////////////////////////////////
|
| 1603 |
+
// Create Custom Product for Import Shipping
|
| 1604 |
+
/////////////////////////////////////////////////////////////////////////////////////
|
| 1605 |
+
|
| 1606 |
+
$pro_Model = 'osc-shipping';
|
| 1607 |
+
$pro_Name = 'Shipping';
|
| 1608 |
+
$oProduct = Mage::getModel("catalog/product")
|
| 1609 |
+
->getCollection()
|
| 1610 |
+
->setStoreId($storeId)
|
| 1611 |
+
->addAttributeToSelect("sku")
|
| 1612 |
+
->addFieldToFilter("sku", array('eq' => $pro_Model))
|
| 1613 |
+
->getFirstItem();
|
| 1614 |
+
|
| 1615 |
+
|
| 1616 |
+
if ( sizeof($oProduct->getData()) == 0){
|
| 1617 |
+
$product = new Mage_Catalog_Model_Product();
|
| 1618 |
+
// Build the product
|
| 1619 |
+
$product->setSku($pro_Model);
|
| 1620 |
+
$product->setAttributeSetId($AttributeSetId);
|
| 1621 |
+
$product->setTypeId('simple');
|
| 1622 |
+
$product->setName($pro_Name);
|
| 1623 |
+
$product->setCategoryIds($parent_category);
|
| 1624 |
+
$product->setWebsiteIDs(array($storeId));
|
| 1625 |
+
$product->setDescription('-');
|
| 1626 |
+
$product->setShortDescription('-');
|
| 1627 |
+
$product->setPrice(0);
|
| 1628 |
+
$product->setWeight(0);
|
| 1629 |
+
|
| 1630 |
+
$product->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE);
|
| 1631 |
+
$product->setStatus(1);
|
| 1632 |
+
$product->setTaxClassId(0); # My default tax class
|
| 1633 |
+
$product->setStockData(array(
|
| 1634 |
+
'is_in_stock' => 1,
|
| 1635 |
+
'qty' => 10000
|
| 1636 |
+
));
|
| 1637 |
+
|
| 1638 |
+
$product->setCreatedAt(strtotime('now'));
|
| 1639 |
+
$product->save();
|
| 1640 |
+
}
|
| 1641 |
+
|
| 1642 |
+
/////////////////////////////////////////////////////////////////////////////////////
|
| 1643 |
+
// Create Custom Product for Import Discount
|
| 1644 |
+
/////////////////////////////////////////////////////////////////////////////////////
|
| 1645 |
+
|
| 1646 |
+
$pro_Model = 'osc-discount';
|
| 1647 |
+
$pro_Name = 'Discount';
|
| 1648 |
+
$oProduct = Mage::getModel("catalog/product")
|
| 1649 |
+
->getCollection()
|
| 1650 |
+
->setStoreId($storeId)
|
| 1651 |
+
->addAttributeToSelect("sku")
|
| 1652 |
+
->addFieldToFilter("sku", array('eq' => $pro_Model))
|
| 1653 |
+
->getFirstItem();
|
| 1654 |
+
|
| 1655 |
+
|
| 1656 |
+
if ( sizeof($oProduct->getData()) == 0){
|
| 1657 |
+
$product = new Mage_Catalog_Model_Product();
|
| 1658 |
+
// Build the product
|
| 1659 |
+
$product->setSku($pro_Model);
|
| 1660 |
+
$product->setAttributeSetId($AttributeSetId);
|
| 1661 |
+
$product->setTypeId('simple');
|
| 1662 |
+
$product->setName($pro_Name);
|
| 1663 |
+
$product->setCategoryIds($parent_category);
|
| 1664 |
+
$product->setWebsiteIDs(array($storeId));
|
| 1665 |
+
$product->setDescription('-');
|
| 1666 |
+
$product->setShortDescription('-');
|
| 1667 |
+
$product->setPrice(0);
|
| 1668 |
+
$product->setWeight(0);
|
| 1669 |
+
|
| 1670 |
+
$product->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE);
|
| 1671 |
+
$product->setStatus(1);
|
| 1672 |
+
$product->setTaxClassId(0); # My default tax class
|
| 1673 |
+
$product->setStockData(array(
|
| 1674 |
+
'is_in_stock' => 1,
|
| 1675 |
+
'qty' => 10000
|
| 1676 |
+
));
|
| 1677 |
+
|
| 1678 |
+
$product->setCreatedAt(strtotime('now'));
|
| 1679 |
+
$product->save();
|
| 1680 |
+
}
|
| 1681 |
+
|
| 1682 |
+
/////////////////////////////////////////////////////////////////////////////////////
|
| 1683 |
+
// Create Custom Product for Import Taxes
|
| 1684 |
+
/////////////////////////////////////////////////////////////////////////////////////
|
| 1685 |
+
|
| 1686 |
+
$pro_Model = 'osc-tax';
|
| 1687 |
+
$pro_Name = 'Tax';
|
| 1688 |
+
$oProduct = Mage::getModel("catalog/product")
|
| 1689 |
+
->getCollection()
|
| 1690 |
+
->setStoreId($storeId)
|
| 1691 |
+
->addAttributeToSelect("sku")
|
| 1692 |
+
->addFieldToFilter("sku", array('eq' => $pro_Model))
|
| 1693 |
+
->getFirstItem();
|
| 1694 |
+
|
| 1695 |
+
|
| 1696 |
+
if ( sizeof($oProduct->getData()) == 0){
|
| 1697 |
+
$product = new Mage_Catalog_Model_Product();
|
| 1698 |
+
// Build the product
|
| 1699 |
+
$product->setSku($pro_Model);
|
| 1700 |
+
$product->setAttributeSetId($AttributeSetId);
|
| 1701 |
+
$product->setTypeId('simple');
|
| 1702 |
+
$product->setName($pro_Name);
|
| 1703 |
+
$product->setCategoryIds($parent_category);
|
| 1704 |
+
$product->setWebsiteIDs(array($storeId));
|
| 1705 |
+
$product->setDescription('-');
|
| 1706 |
+
$product->setShortDescription('-');
|
| 1707 |
+
$product->setPrice(0);
|
| 1708 |
+
$product->setWeight(0);
|
| 1709 |
+
|
| 1710 |
+
$product->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE);
|
| 1711 |
+
$product->setStatus(1);
|
| 1712 |
+
$product->setTaxClassId(0); # My default tax class
|
| 1713 |
+
$product->setStockData(array(
|
| 1714 |
+
'is_in_stock' => 1,
|
| 1715 |
+
'qty' => 10000
|
| 1716 |
+
));
|
| 1717 |
+
|
| 1718 |
+
$product->setCreatedAt(strtotime('now'));
|
| 1719 |
+
$product->save();
|
| 1720 |
+
}
|
| 1721 |
+
|
| 1722 |
+
/////////////////////////////////////////////////////////////////////////////////////
|
| 1723 |
+
// Create Custom Product for Import Other
|
| 1724 |
+
/////////////////////////////////////////////////////////////////////////////////////
|
| 1725 |
+
|
| 1726 |
+
$pro_Model = 'osc-other';
|
| 1727 |
+
$pro_Name = 'Other Charges';
|
| 1728 |
+
$oProduct = Mage::getModel("catalog/product")
|
| 1729 |
+
->getCollection()
|
| 1730 |
+
->setStoreId($storeId)
|
| 1731 |
+
->addAttributeToSelect("sku")
|
| 1732 |
+
->addFieldToFilter("sku", array('eq' => $pro_Model))
|
| 1733 |
+
->getFirstItem();
|
| 1734 |
+
|
| 1735 |
+
|
| 1736 |
+
if ( sizeof($oProduct->getData()) == 0){
|
| 1737 |
+
$product = new Mage_Catalog_Model_Product();
|
| 1738 |
+
// Build the product
|
| 1739 |
+
$product->setSku($pro_Model);
|
| 1740 |
+
$product->setAttributeSetId($AttributeSetId);
|
| 1741 |
+
$product->setTypeId('simple');
|
| 1742 |
+
$product->setName($pro_Name);
|
| 1743 |
+
$product->setCategoryIds($parent_category);
|
| 1744 |
+
$product->setWebsiteIDs(array($storeId));
|
| 1745 |
+
$product->setDescription('-');
|
| 1746 |
+
$product->setShortDescription('-');
|
| 1747 |
+
$product->setPrice(1);
|
| 1748 |
+
$product->setWeight(0);
|
| 1749 |
+
|
| 1750 |
+
$product->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE);
|
| 1751 |
+
$product->setStatus(1);
|
| 1752 |
+
$product->setTaxClassId(0); # My default tax class
|
| 1753 |
+
$product->setStockData(array(
|
| 1754 |
+
'is_in_stock' => 1,
|
| 1755 |
+
'qty' => 10000
|
| 1756 |
+
));
|
| 1757 |
+
|
| 1758 |
+
$product->setCreatedAt(strtotime('now'));
|
| 1759 |
+
$product->save();
|
| 1760 |
+
}
|
| 1761 |
+
|
| 1762 |
+
|
| 1763 |
+
}catch (Exception $ex) {
|
| 1764 |
+
//echo $ex->getMessage();
|
| 1765 |
+
Mage::getSingleton('core/session')->setErrorMSG('Creating Import Products: '.$pro_Name.' - '.$ex->getMessage());
|
| 1766 |
+
}
|
| 1767 |
+
}
|
| 1768 |
+
|
| 1769 |
/***************************************************************************************************************/
|
| 1770 |
// Utils
|
| 1771 |
/***************************************************************************************************************/
|
| 1772 |
|
| 1773 |
+
|
| 1774 |
+
// check image file extension
|
| 1775 |
+
public function getImageAllow($file){
|
| 1776 |
+
$path = pathinfo($file, PATHINFO_EXTENSION);
|
| 1777 |
+
if ( (strtolower($path) == 'jpg' ) or (strtolower($path) == 'gif' ) or (strtolower($path) == 'png' ) ){
|
| 1778 |
+
return true;
|
| 1779 |
+
}else{
|
| 1780 |
+
return false;
|
| 1781 |
+
}
|
| 1782 |
+
}
|
| 1783 |
+
|
| 1784 |
// Get product Information from oscommerce
|
| 1785 |
public function getProductFromOSC($osc_product_id,$readConnection,$_connection_remote){
|
| 1786 |
$query = 'select products_description.*,products.* from products left join products_description on products.products_id=products_description.products_id where products.products_id = '.$osc_product_id.' and products_description.language_id = 1';
|
| 1794 |
}
|
| 1795 |
|
| 1796 |
// Returns Mage Categories
|
| 1797 |
+
public function getCategoriesProductFromOSC($osc_product_id,$readConnection,$_connection_remote,$parent_cat){
|
| 1798 |
$query = 'select categories_id from products_to_categories where products_id = '.$osc_product_id;
|
| 1799 |
$results = $_connection_remote->fetchAll($query);
|
| 1800 |
foreach($results as $row) {
|
| 1804 |
if ($mage_cat_id > 0){
|
| 1805 |
$product_categories[] = $mage_cat_id;
|
| 1806 |
}
|
| 1807 |
+
}
|
| 1808 |
if (sizeof($product_categories) == 0){
|
| 1809 |
+
$product_categories[] = $parent_cat;
|
| 1810 |
+
}
|
| 1811 |
return $product_categories;
|
| 1812 |
}
|
| 1813 |
|
| 1901 |
$_config['dbname'] = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_db',Mage::app()->getStore());
|
| 1902 |
$_config['username'] = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_username',Mage::app()->getStore());
|
| 1903 |
$_config['password'] = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_password',Mage::app()->getStore());
|
| 1904 |
+
//$_config_prefix = Mage::getStoreConfig('oscommerceimportconf/oscconfiguration/conf_prefix',Mage::app()->getStore());
|
| 1905 |
// Setting the default Values
|
| 1906 |
$_config['initStatements'] = 'SET NAMES utf8';
|
| 1907 |
$_config['model'] = 'mysql4';
|
| 1911 |
|
| 1912 |
return $_config;
|
| 1913 |
}
|
| 1914 |
+
|
|
|
|
| 1915 |
}
|
app/code/community/Ezmage/OscommerceImport/controllers/_notes/dwsync.xml
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="utf-8" ?>
|
| 2 |
+
<dwsync>
|
| 3 |
+
<file name="IndexController.php" server="php53.ezosc.com//public_html/magento1.7/" local="129828699998440932" remote="129828771600000000" />
|
| 4 |
+
<file name="IndexController.php" server="boyztoystore.com//public_html/" local="129822929556234058" remote="129823574400000000" />
|
| 5 |
+
</dwsync>
|
app/code/community/Ezmage/OscommerceImport/etc/_notes/dwsync.xml
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?xml version="1.0" encoding="utf-8" ?>
|
| 2 |
+
<dwsync>
|
| 3 |
+
<file name="system.xml" server="php53.ezosc.com//public_html/magento1.7/" local="129822920764031173" remote="129822992400000000" />
|
| 4 |
+
<file name="config.xml" server="php53.ezosc.com//public_html/magento1.7/" local="129820225800000000" remote="129822085800000000" />
|
| 5 |
+
</dwsync>
|
app/code/community/Ezmage/OscommerceImport/etc/config.xml
CHANGED
|
@@ -1,53 +1,53 @@
|
|
| 1 |
-
<?xml version="1.0"?>
|
| 2 |
-
|
| 3 |
-
<config>
|
| 4 |
-
<modules>
|
| 5 |
-
<Ezmage_OscommerceImport>
|
| 6 |
-
<version>1.7.3</version>
|
| 7 |
-
</Ezmage_OscommerceImport>
|
| 8 |
-
</modules>
|
| 9 |
-
|
| 10 |
-
<frontend>
|
| 11 |
-
<routers>
|
| 12 |
-
<ezmage_oscommerceimport> <!-- name of router. for consistency sake, match this to frontName -->
|
| 13 |
-
<use>standard</use> <!-- this is a standard router -->
|
| 14 |
-
<args>
|
| 15 |
-
<module>Ezmage_OscommerceImport</module> <!-- what module we should look at for the 'helloworld' router -->
|
| 16 |
-
<frontName>oscommerceimport</frontName> <!-- for consistency sake, match this to router name -->
|
| 17 |
-
</args>
|
| 18 |
-
</ezmage_oscommerceimport>
|
| 19 |
-
</routers>
|
| 20 |
-
</frontend>
|
| 21 |
-
|
| 22 |
-
<global>
|
| 23 |
-
<helpers>
|
| 24 |
-
<oscommerceimporthelper1>
|
| 25 |
-
<class>Ezmage_OscommerceImport_Helper</class>
|
| 26 |
-
</oscommerceimporthelper1>
|
| 27 |
-
</helpers>
|
| 28 |
-
</global>
|
| 29 |
-
|
| 30 |
-
<adminhtml>
|
| 31 |
-
<acl>
|
| 32 |
-
<resources>
|
| 33 |
-
<admin>
|
| 34 |
-
<children>
|
| 35 |
-
<system>
|
| 36 |
-
<children>
|
| 37 |
-
<config>
|
| 38 |
-
<children>
|
| 39 |
-
<oscommerceimportconf translate="title" module="oscommerceimporthelper1">
|
| 40 |
-
<title>osCommerce Import</title>
|
| 41 |
-
<sort_order>50</sort_order>
|
| 42 |
-
</oscommerceimportconf>
|
| 43 |
-
</children>
|
| 44 |
-
</config>
|
| 45 |
-
</children>
|
| 46 |
-
</system>
|
| 47 |
-
</children>
|
| 48 |
-
</admin>
|
| 49 |
-
</resources>
|
| 50 |
-
</acl>
|
| 51 |
-
</adminhtml>
|
| 52 |
-
|
| 53 |
</config>
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
|
| 3 |
+
<config>
|
| 4 |
+
<modules>
|
| 5 |
+
<Ezmage_OscommerceImport>
|
| 6 |
+
<version>1.7.3</version>
|
| 7 |
+
</Ezmage_OscommerceImport>
|
| 8 |
+
</modules>
|
| 9 |
+
|
| 10 |
+
<frontend>
|
| 11 |
+
<routers>
|
| 12 |
+
<ezmage_oscommerceimport> <!-- name of router. for consistency sake, match this to frontName -->
|
| 13 |
+
<use>standard</use> <!-- this is a standard router -->
|
| 14 |
+
<args>
|
| 15 |
+
<module>Ezmage_OscommerceImport</module> <!-- what module we should look at for the 'helloworld' router -->
|
| 16 |
+
<frontName>oscommerceimport</frontName> <!-- for consistency sake, match this to router name -->
|
| 17 |
+
</args>
|
| 18 |
+
</ezmage_oscommerceimport>
|
| 19 |
+
</routers>
|
| 20 |
+
</frontend>
|
| 21 |
+
|
| 22 |
+
<global>
|
| 23 |
+
<helpers>
|
| 24 |
+
<oscommerceimporthelper1>
|
| 25 |
+
<class>Ezmage_OscommerceImport_Helper</class>
|
| 26 |
+
</oscommerceimporthelper1>
|
| 27 |
+
</helpers>
|
| 28 |
+
</global>
|
| 29 |
+
|
| 30 |
+
<adminhtml>
|
| 31 |
+
<acl>
|
| 32 |
+
<resources>
|
| 33 |
+
<admin>
|
| 34 |
+
<children>
|
| 35 |
+
<system>
|
| 36 |
+
<children>
|
| 37 |
+
<config>
|
| 38 |
+
<children>
|
| 39 |
+
<oscommerceimportconf translate="title" module="oscommerceimporthelper1">
|
| 40 |
+
<title>osCommerce Import</title>
|
| 41 |
+
<sort_order>50</sort_order>
|
| 42 |
+
</oscommerceimportconf>
|
| 43 |
+
</children>
|
| 44 |
+
</config>
|
| 45 |
+
</children>
|
| 46 |
+
</system>
|
| 47 |
+
</children>
|
| 48 |
+
</admin>
|
| 49 |
+
</resources>
|
| 50 |
+
</acl>
|
| 51 |
+
</adminhtml>
|
| 52 |
+
|
| 53 |
</config>
|
app/code/community/Ezmage/OscommerceImport/etc/system.xml
CHANGED
|
@@ -75,16 +75,7 @@
|
|
| 75 |
<show_in_store>1</show_in_store>
|
| 76 |
<validate>required-entry</validate>
|
| 77 |
</conf_password>
|
| 78 |
-
|
| 79 |
-
<conf_prefix translate="label">
|
| 80 |
-
<label>DataBase Prefix</label>
|
| 81 |
-
<frontend_type>text</frontend_type>
|
| 82 |
-
<sort_order>6</sort_order>
|
| 83 |
-
<show_in_default>1</show_in_default>
|
| 84 |
-
<show_in_website>1</show_in_website>
|
| 85 |
-
<show_in_store>1</show_in_store>
|
| 86 |
-
</conf_prefix>
|
| 87 |
-
|
| 88 |
<conf_imageurl translate="label">
|
| 89 |
<label>Image URL Location</label>
|
| 90 |
<frontend_type>text</frontend_type>
|
|
@@ -94,8 +85,7 @@
|
|
| 94 |
<show_in_store>1</show_in_store>
|
| 95 |
<validate>required-entry validate-url</validate>
|
| 96 |
<comment><![CDATA[osCommerce Image Folder url ex: http://yourstore.com/images/ ]]></comment>
|
| 97 |
-
</conf_imageurl>
|
| 98 |
-
|
| 99 |
</fields>
|
| 100 |
</oscconfiguration>
|
| 101 |
|
|
@@ -139,18 +129,52 @@
|
|
| 139 |
<show_in_store>1</show_in_store>
|
| 140 |
<validate>required-entry</validate>
|
| 141 |
</conf_attribute>
|
| 142 |
-
|
| 143 |
-
<
|
| 144 |
-
<label>Total
|
| 145 |
<frontend_type>text</frontend_type>
|
| 146 |
<sort_order>3</sort_order>
|
| 147 |
<show_in_default>1</show_in_default>
|
| 148 |
<show_in_website>1</show_in_website>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
<show_in_store>1</show_in_store>
|
| 150 |
<validate>required-entry validate-number</validate>
|
| 151 |
<comment><![CDATA[We recommend to do 50 products per batch]]></comment>
|
| 152 |
</conf_totalperimport>
|
| 153 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
</fields>
|
| 155 |
|
| 156 |
|
|
@@ -163,7 +187,7 @@
|
|
| 163 |
<show_in_default>1</show_in_default>
|
| 164 |
<show_in_website>1</show_in_website>
|
| 165 |
<show_in_store>1</show_in_store>
|
| 166 |
-
<comment><![CDATA[The URL will be http://www.<b>your-magento-domain.com</b>/oscommerceimport]]></comment>
|
| 167 |
</oscommercebegin>
|
| 168 |
|
| 169 |
</groups>
|
| 75 |
<show_in_store>1</show_in_store>
|
| 76 |
<validate>required-entry</validate>
|
| 77 |
</conf_password>
|
| 78 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
<conf_imageurl translate="label">
|
| 80 |
<label>Image URL Location</label>
|
| 81 |
<frontend_type>text</frontend_type>
|
| 85 |
<show_in_store>1</show_in_store>
|
| 86 |
<validate>required-entry validate-url</validate>
|
| 87 |
<comment><![CDATA[osCommerce Image Folder url ex: http://yourstore.com/images/ ]]></comment>
|
| 88 |
+
</conf_imageurl>
|
|
|
|
| 89 |
</fields>
|
| 90 |
</oscconfiguration>
|
| 91 |
|
| 129 |
<show_in_store>1</show_in_store>
|
| 130 |
<validate>required-entry</validate>
|
| 131 |
</conf_attribute>
|
| 132 |
+
|
| 133 |
+
<conf_totalperimportcat translate="label">
|
| 134 |
+
<label>Total Categories Per Batch</label>
|
| 135 |
<frontend_type>text</frontend_type>
|
| 136 |
<sort_order>3</sort_order>
|
| 137 |
<show_in_default>1</show_in_default>
|
| 138 |
<show_in_website>1</show_in_website>
|
| 139 |
+
<show_in_store>1</show_in_store>
|
| 140 |
+
<validate>required-entry validate-number</validate>
|
| 141 |
+
<comment><![CDATA[We recommend to do 20 products per batch]]></comment>
|
| 142 |
+
</conf_totalperimportcat>
|
| 143 |
+
|
| 144 |
+
<conf_totalperimport translate="label">
|
| 145 |
+
<label>Total Products Per Batch</label>
|
| 146 |
+
<frontend_type>text</frontend_type>
|
| 147 |
+
<sort_order>4</sort_order>
|
| 148 |
+
<show_in_default>1</show_in_default>
|
| 149 |
+
<show_in_website>1</show_in_website>
|
| 150 |
<show_in_store>1</show_in_store>
|
| 151 |
<validate>required-entry validate-number</validate>
|
| 152 |
<comment><![CDATA[We recommend to do 50 products per batch]]></comment>
|
| 153 |
</conf_totalperimport>
|
| 154 |
+
|
| 155 |
+
<conf_totalperimportcustomer translate="label">
|
| 156 |
+
<label>Total Customers Per Batch</label>
|
| 157 |
+
<frontend_type>text</frontend_type>
|
| 158 |
+
<sort_order>5</sort_order>
|
| 159 |
+
<show_in_default>1</show_in_default>
|
| 160 |
+
<show_in_website>1</show_in_website>
|
| 161 |
+
<show_in_store>1</show_in_store>
|
| 162 |
+
<validate>required-entry validate-number</validate>
|
| 163 |
+
<comment><![CDATA[We recommend to do 50 products per batch]]></comment>
|
| 164 |
+
</conf_totalperimportcustomer>
|
| 165 |
+
|
| 166 |
+
<conf_totalperimportorder translate="label">
|
| 167 |
+
<label>Total Orders Per Batch</label>
|
| 168 |
+
<frontend_type>text</frontend_type>
|
| 169 |
+
<sort_order>6</sort_order>
|
| 170 |
+
<show_in_default>1</show_in_default>
|
| 171 |
+
<show_in_website>1</show_in_website>
|
| 172 |
+
<show_in_store>1</show_in_store>
|
| 173 |
+
<validate>required-entry validate-number</validate>
|
| 174 |
+
<comment><![CDATA[We recommend to do 50 products per batch]]></comment>
|
| 175 |
+
</conf_totalperimportorder>
|
| 176 |
+
|
| 177 |
+
|
| 178 |
</fields>
|
| 179 |
|
| 180 |
|
| 187 |
<show_in_default>1</show_in_default>
|
| 188 |
<show_in_website>1</show_in_website>
|
| 189 |
<show_in_store>1</show_in_store>
|
| 190 |
+
<comment><![CDATA[The URL will be http://www.<b>your-magento-domain.com</b>/oscommerceimport or http://www.<b>your-magento-domain.com</b>/index.php/oscommerceimport]]></comment>
|
| 191 |
</oscommercebegin>
|
| 192 |
|
| 193 |
</groups>
|
app/design/frontend/default/default/template/ezmage/oscommerceimport/_notes/dwsync.xml
CHANGED
|
@@ -1,11 +1,11 @@
|
|
| 1 |
<?xml version="1.0" encoding="utf-8" ?>
|
| 2 |
<dwsync>
|
| 3 |
-
<file name="step5.phtml" server="php53.ezosc.com//public_html/magento1.7/" local="
|
| 4 |
-
<file name="step0.phtml" server="php53.ezosc.com//public_html/magento1.7/" local="
|
| 5 |
-
<file name="step6.phtml" server="php53.ezosc.com//public_html/magento1.7/" local="
|
| 6 |
-
<file name="step31.phtml" server="php53.ezosc.com//public_html/magento1.7/" local="
|
| 7 |
-
<file name="step2.phtml" server="php53.ezosc.com//public_html/magento1.7/" local="
|
| 8 |
-
<file name="step1.phtml" server="php53.ezosc.com//public_html/magento1.7/" local="
|
| 9 |
-
<file name="step3.phtml" server="php53.ezosc.com//public_html/magento1.7/" local="
|
| 10 |
-
<file name="step4.phtml" server="php53.ezosc.com//public_html/magento1.7/" local="
|
| 11 |
</dwsync>
|
| 1 |
<?xml version="1.0" encoding="utf-8" ?>
|
| 2 |
<dwsync>
|
| 3 |
+
<file name="step5.phtml" server="php53.ezosc.com//public_html/magento1.7/" local="129828692656020969" remote="129828765000000000" />
|
| 4 |
+
<file name="step0.phtml" server="php53.ezosc.com//public_html/magento1.7/" local="129828692653620832" remote="129828765000000000" />
|
| 5 |
+
<file name="step6.phtml" server="php53.ezosc.com//public_html/magento1.7/" local="129828692656390990" remote="129828765000000000" />
|
| 6 |
+
<file name="step31.phtml" server="php53.ezosc.com//public_html/magento1.7/" local="129828692655270926" remote="129828765000000000" />
|
| 7 |
+
<file name="step2.phtml" server="php53.ezosc.com//public_html/magento1.7/" local="129828692654240867" remote="129828765000000000" />
|
| 8 |
+
<file name="step1.phtml" server="php53.ezosc.com//public_html/magento1.7/" local="129828692653920849" remote="129828765000000000" />
|
| 9 |
+
<file name="step3.phtml" server="php53.ezosc.com//public_html/magento1.7/" local="129828692654660892" remote="129828765000000000" />
|
| 10 |
+
<file name="step4.phtml" server="php53.ezosc.com//public_html/magento1.7/" local="129828692655530941" remote="129828765000000000" />
|
| 11 |
</dwsync>
|
app/design/frontend/default/default/template/ezmage/oscommerceimport/step0.phtml
CHANGED
|
@@ -5,11 +5,12 @@
|
|
| 5 |
$image_status4 = Mage::registry('image_status4');
|
| 6 |
$image_status5 = Mage::registry('image_status5');
|
| 7 |
$image_status6 = Mage::registry('image_status6');
|
|
|
|
| 8 |
|
| 9 |
?>
|
| 10 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
| 11 |
<tr>
|
| 12 |
-
<td align="center"><h1><strong>osCommerce Products/Categories Import </strong></h1></td>
|
| 13 |
</tr>
|
| 14 |
<tr>
|
| 15 |
<td> </td>
|
|
@@ -65,12 +66,35 @@
|
|
| 65 |
|
| 66 |
<?php if ( $image_status5 == 'check-no.jpg') {?>
|
| 67 |
<tr>
|
| 68 |
-
<td><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); ?>Ezmage/OscommerceImport/<?php echo $image_status6; ?>" /> 6.
|
| 69 |
<br /></td>
|
| 70 |
</tr>
|
| 71 |
<?php }else{ ?>
|
| 72 |
<tr>
|
| 73 |
-
<td><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); ?>Ezmage/OscommerceImport/<?php echo $image_status6; ?>" /> <a href="<?php echo $this->getUrl('oscommerceimport/index/step6/')?>">6.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
</tr>
|
| 75 |
<?php }?>
|
| 76 |
|
|
@@ -85,9 +109,11 @@
|
|
| 85 |
<td> </td>
|
| 86 |
</tr>
|
| 87 |
<tr>
|
| 88 |
-
<td
|
|
|
|
|
|
|
| 89 |
</tr>
|
| 90 |
<tr>
|
| 91 |
-
<td><div align="center">Powered by <a href="http://www.
|
| 92 |
</tr>
|
| 93 |
</table>
|
| 5 |
$image_status4 = Mage::registry('image_status4');
|
| 6 |
$image_status5 = Mage::registry('image_status5');
|
| 7 |
$image_status6 = Mage::registry('image_status6');
|
| 8 |
+
$image_status7 = Mage::registry('image_status7');
|
| 9 |
|
| 10 |
?>
|
| 11 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
| 12 |
<tr>
|
| 13 |
+
<td align="center"><h1><strong>osCommerce Products/Categories/Customers/Orders Import </strong></h1></td>
|
| 14 |
</tr>
|
| 15 |
<tr>
|
| 16 |
<td> </td>
|
| 66 |
|
| 67 |
<?php if ( $image_status5 == 'check-no.jpg') {?>
|
| 68 |
<tr>
|
| 69 |
+
<td><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); ?>Ezmage/OscommerceImport/<?php echo $image_status6; ?>" /> 6. Import Customers<br />
|
| 70 |
<br /></td>
|
| 71 |
</tr>
|
| 72 |
<?php }else{ ?>
|
| 73 |
<tr>
|
| 74 |
+
<td><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); ?>Ezmage/OscommerceImport/<?php echo $image_status6; ?>" /> <a href="<?php echo $this->getUrl('oscommerceimport/index/step6/')?>">6. Import Customers</a><br /><br /></td>
|
| 75 |
+
</tr>
|
| 76 |
+
<?php }?>
|
| 77 |
+
|
| 78 |
+
<?php if ( $image_status6 == 'check-no.jpg') {?>
|
| 79 |
+
<tr>
|
| 80 |
+
<td><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); ?>Ezmage/OscommerceImport/<?php echo $image_status7; ?>" /> 7. Import Orders<br />
|
| 81 |
+
<br /></td>
|
| 82 |
+
</tr>
|
| 83 |
+
<?php }else{ ?>
|
| 84 |
+
<tr>
|
| 85 |
+
<td><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); ?>Ezmage/OscommerceImport/<?php echo $image_status7; ?>" /> <a href="<?php echo $this->getUrl('oscommerceimport/index/step7/')?>">7. Import Orders</a><br /><br /></td>
|
| 86 |
+
</tr>
|
| 87 |
+
<?php }?>
|
| 88 |
+
|
| 89 |
+
|
| 90 |
+
<?php if ( $image_status7 == 'check-no.jpg') {?>
|
| 91 |
+
<tr>
|
| 92 |
+
<td><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); ?>Ezmage/OscommerceImport/<?php echo $image_status8; ?>" /> 8. Uninstall and Enjoy<br />
|
| 93 |
+
<br /></td>
|
| 94 |
+
</tr>
|
| 95 |
+
<?php }else{ ?>
|
| 96 |
+
<tr>
|
| 97 |
+
<td><img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); ?>Ezmage/OscommerceImport/<?php echo $image_status8; ?>" /> <a href="<?php echo $this->getUrl('oscommerceimport/index/step8/')?>">8. Uninstall and Enjoy</a><br /><br /></td>
|
| 98 |
</tr>
|
| 99 |
<?php }?>
|
| 100 |
|
| 109 |
<td> </td>
|
| 110 |
</tr>
|
| 111 |
<tr>
|
| 112 |
+
<td><div align="center"><a href="http://www.ezmage.com" target="_blank"><img src="http://ezmage.com/wp-content/uploads/2012/05/logo2.gif" alt="Magento Support" border="0" /></a><br />
|
| 113 |
+
<br />
|
| 114 |
+
</div></td>
|
| 115 |
</tr>
|
| 116 |
<tr>
|
| 117 |
+
<td><div align="center">Powered by <a href="http://www.ezmage.com/" target="_blank">ezMage</a> - We provide Magento Support 702-485-3332</div></td>
|
| 118 |
</tr>
|
| 119 |
</table>
|
app/design/frontend/default/default/template/ezmage/oscommerceimport/step1.phtml
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
|
| 3 |
<tr>
|
| 4 |
|
| 5 |
-
<td align="center"><h1><strong>osCommerce Products/Categories Import </strong></h1></td>
|
| 6 |
|
| 7 |
</tr>
|
| 8 |
|
|
@@ -50,7 +50,7 @@
|
|
| 50 |
|
| 51 |
<tr>
|
| 52 |
|
| 53 |
-
<td><div align="center">Powered by <a href="http://www.
|
| 54 |
|
| 55 |
</tr>
|
| 56 |
|
| 2 |
|
| 3 |
<tr>
|
| 4 |
|
| 5 |
+
<td align="center"><h1><strong>osCommerce Products/Categories/Customers/Orders Import </strong></h1></td>
|
| 6 |
|
| 7 |
</tr>
|
| 8 |
|
| 50 |
|
| 51 |
<tr>
|
| 52 |
|
| 53 |
+
<td><div align="center">Powered by <a href="http://www.ezmage.com/" target="_blank">ezMage</a> - We provide Magento Support 702-485-3332</div></td>
|
| 54 |
|
| 55 |
</tr>
|
| 56 |
|
app/design/frontend/default/default/template/ezmage/oscommerceimport/step2.phtml
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
?>
|
| 4 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
| 5 |
<tr>
|
| 6 |
-
<td align="center"><h1><strong>osCommerce Products/Categories Import </strong></h1></td>
|
| 7 |
</tr>
|
| 8 |
<tr>
|
| 9 |
<td><strong>Step 2. Create TMP Tables</strong></td>
|
|
@@ -13,7 +13,7 @@
|
|
| 13 |
</td>
|
| 14 |
</tr>
|
| 15 |
<tr>
|
| 16 |
-
<td>TMP tables: <em>ezmage_categories
|
| 17 |
</tr>
|
| 18 |
<tr>
|
| 19 |
<td><br />
|
|
@@ -21,7 +21,9 @@
|
|
| 21 |
<br />
|
| 22 |
drop table ezmage_categories;<br />
|
| 23 |
drop table ezmage_log;<br />
|
| 24 |
-
drop table ezmage_products;
|
|
|
|
|
|
|
| 25 |
</tr>
|
| 26 |
<tr>
|
| 27 |
<td> </td>
|
|
@@ -44,6 +46,6 @@ drop table ezmage_products; </td>
|
|
| 44 |
<td> </td>
|
| 45 |
</tr>
|
| 46 |
<tr>
|
| 47 |
-
<td><div align="center">Powered by <a href="http://www.
|
| 48 |
</tr>
|
| 49 |
</table>
|
| 3 |
?>
|
| 4 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
| 5 |
<tr>
|
| 6 |
+
<td align="center"><h1><strong>osCommerce Products/Categories/Customers/Orders Import </strong></h1></td>
|
| 7 |
</tr>
|
| 8 |
<tr>
|
| 9 |
<td><strong>Step 2. Create TMP Tables</strong></td>
|
| 13 |
</td>
|
| 14 |
</tr>
|
| 15 |
<tr>
|
| 16 |
+
<td>TMP tables: <em>ezmage_categories, ezmage_products, ezmage_customers, ezmage_orders, ezmage_log </em>have been created</td>
|
| 17 |
</tr>
|
| 18 |
<tr>
|
| 19 |
<td><br />
|
| 21 |
<br />
|
| 22 |
drop table ezmage_categories;<br />
|
| 23 |
drop table ezmage_log;<br />
|
| 24 |
+
drop table ezmage_products; <br />
|
| 25 |
+
drop table ezmage_customers; <br />
|
| 26 |
+
drop table ezmage_orders; </td>
|
| 27 |
</tr>
|
| 28 |
<tr>
|
| 29 |
<td> </td>
|
| 46 |
<td> </td>
|
| 47 |
</tr>
|
| 48 |
<tr>
|
| 49 |
+
<td><div align="center">Powered by <a href="http://www.ezmage.com/" target="_blank">ezMage</a> - We provide Magento Support 702-485-3332</div></td>
|
| 50 |
</tr>
|
| 51 |
</table>
|
app/design/frontend/default/default/template/ezmage/oscommerceimport/step3.phtml
CHANGED
|
@@ -10,7 +10,7 @@
|
|
| 10 |
|
| 11 |
<tr>
|
| 12 |
|
| 13 |
-
<td align="center"><h1><strong>osCommerce Products/Categories Import </strong></h1></td>
|
| 14 |
|
| 15 |
</tr>
|
| 16 |
|
|
@@ -66,7 +66,7 @@
|
|
| 66 |
|
| 67 |
<tr>
|
| 68 |
|
| 69 |
-
<td><div align="center">Powered by <a href="http://www.
|
| 70 |
|
| 71 |
</tr>
|
| 72 |
|
| 10 |
|
| 11 |
<tr>
|
| 12 |
|
| 13 |
+
<td align="center"><h1><strong>osCommerce Products/Categories/Customers/Orders Import </strong></h1></td>
|
| 14 |
|
| 15 |
</tr>
|
| 16 |
|
| 66 |
|
| 67 |
<tr>
|
| 68 |
|
| 69 |
+
<td><div align="center">Powered by <a href="http://www.ezmage.com/" target="_blank">ezMage</a> - We provide Magento Support 702-485-3332</div></td>
|
| 70 |
|
| 71 |
</tr>
|
| 72 |
|
app/design/frontend/default/default/template/ezmage/oscommerceimport/step31.phtml
CHANGED
|
@@ -1,10 +1,14 @@
|
|
| 1 |
<?php
|
| 2 |
$importCategoryTotal = Mage::getSingleton('core/session')->getimportCategoryTotal();
|
| 3 |
-
$importProductsTotal = Mage::getSingleton('core/session')->getimportProductsTotal();
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
?>
|
| 5 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
| 6 |
<tr>
|
| 7 |
-
<td align="center"><h1><strong>osCommerce Products/Categories Import </strong></h1></td>
|
| 8 |
</tr>
|
| 9 |
<tr>
|
| 10 |
<td><strong>Step 3. Preparing TMP Tables</strong></td>
|
|
@@ -13,13 +17,20 @@
|
|
| 13 |
<td><br /><br />
|
| 14 |
</td>
|
| 15 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
<tr>
|
| 17 |
<td>We will go to conect to the oscommerce database and read all the products id and categories id and save the information in the tmp tables</td>
|
| 18 |
</tr>
|
| 19 |
<tr>
|
| 20 |
<td><br />
|
| 21 |
-
<strong>Total
|
| 22 |
-
<strong>Total
|
|
|
|
|
|
|
| 23 |
</tr>
|
| 24 |
<tr>
|
| 25 |
<td><br />
|
|
@@ -30,6 +41,6 @@
|
|
| 30 |
<td> </td>
|
| 31 |
</tr>
|
| 32 |
<tr>
|
| 33 |
-
<td><div align="center">Powered by <a href="http://www.
|
| 34 |
</tr>
|
| 35 |
</table>
|
| 1 |
<?php
|
| 2 |
$importCategoryTotal = Mage::getSingleton('core/session')->getimportCategoryTotal();
|
| 3 |
+
$importProductsTotal = Mage::getSingleton('core/session')->getimportProductsTotal();
|
| 4 |
+
$importCustomersTotal = Mage::getSingleton('core/session')->getimportCustomersTotal();
|
| 5 |
+
$importOrdersTotal = Mage::getSingleton('core/session')->getimportOrdersTotal();
|
| 6 |
+
|
| 7 |
+
$error_msg = Mage::getSingleton('core/session')->getErrorMSG();
|
| 8 |
?>
|
| 9 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
| 10 |
<tr>
|
| 11 |
+
<td align="center"><h1><strong>osCommerce Products/Categories/Customers/Orders Import </strong></h1></td>
|
| 12 |
</tr>
|
| 13 |
<tr>
|
| 14 |
<td><strong>Step 3. Preparing TMP Tables</strong></td>
|
| 17 |
<td><br /><br />
|
| 18 |
</td>
|
| 19 |
</tr>
|
| 20 |
+
<?php if ($error_msg != ''){?>
|
| 21 |
+
<tr>
|
| 22 |
+
<td class="error"><hr /><h1><strong>ERROR</strong></h1><?php echo $error_msg; ?><hr /></td>
|
| 23 |
+
</tr>
|
| 24 |
+
<?php } ?>
|
| 25 |
<tr>
|
| 26 |
<td>We will go to conect to the oscommerce database and read all the products id and categories id and save the information in the tmp tables</td>
|
| 27 |
</tr>
|
| 28 |
<tr>
|
| 29 |
<td><br />
|
| 30 |
+
<strong>Total Categories to import:</strong> <?php echo $importCategoryTotal; ?><br />
|
| 31 |
+
<strong>Total Products to import:</strong> <?php echo $importProductsTotal; ?><br />
|
| 32 |
+
<strong>Total Customerts to import:</strong> <?php echo $importCustomersTotal; ?><br />
|
| 33 |
+
<strong>Total Orders to import:</strong> <?php echo $importOrdersTotal; ?><br /></td>
|
| 34 |
</tr>
|
| 35 |
<tr>
|
| 36 |
<td><br />
|
| 41 |
<td> </td>
|
| 42 |
</tr>
|
| 43 |
<tr>
|
| 44 |
+
<td><div align="center">Powered by <a href="http://www.ezmage.com/" target="_blank">ezMage</a> - We provide Magento Support 702-485-3332</div></td>
|
| 45 |
</tr>
|
| 46 |
</table>
|
app/design/frontend/default/default/template/ezmage/oscommerceimport/step4.phtml
CHANGED
|
@@ -1,82 +1,48 @@
|
|
| 1 |
<?php
|
| 2 |
-
|
| 3 |
$importCategoryTotal = Mage::getSingleton('core/session')->getimportCategoryTotal();
|
| 4 |
-
|
| 5 |
$importedCategoryTotal = Mage::getSingleton('core/session')->getimportedCategoryTotal();
|
| 6 |
-
|
| 7 |
?>
|
| 8 |
-
|
| 9 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
| 10 |
-
|
| 11 |
<tr>
|
| 12 |
-
|
| 13 |
-
<td align="center"><h1><strong>osCommerce Products/Categories Import </strong></h1></td>
|
| 14 |
-
|
| 15 |
</tr>
|
| 16 |
-
|
| 17 |
<tr>
|
| 18 |
-
|
| 19 |
<td><strong>Step 4. Import Categories</strong></td>
|
| 20 |
-
|
| 21 |
</tr>
|
| 22 |
-
|
| 23 |
<tr>
|
| 24 |
-
|
| 25 |
<td><br /><br />
|
| 26 |
-
|
| 27 |
</td>
|
| 28 |
-
|
| 29 |
</tr>
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
<tr>
|
| 32 |
-
|
| 33 |
<td><br />
|
| 34 |
-
|
| 35 |
<?php if ($importCategoryTotal != $importedCategoryTotal) { ?>
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
<a href="<?php echo $this->getUrl('oscommerceimport/index/step41/')?>">Please click to import</a>
|
| 40 |
-
|
| 41 |
<?php }else{?>
|
| 42 |
-
|
| 43 |
Congratulation the categories have been imported <img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); ?>Ezmage/OscommerceImport/check-ok.jpg" />
|
| 44 |
-
|
| 45 |
<?php }?>
|
| 46 |
-
|
| 47 |
<br />
|
| 48 |
-
|
| 49 |
<br />
|
| 50 |
-
|
| 51 |
<br />
|
| 52 |
-
|
| 53 |
<strong>Total categories to import:</strong> <?php echo $importCategoryTotal; ?><br />
|
| 54 |
-
|
| 55 |
<strong>Total categories imported:</strong> <?php echo $importedCategoryTotal; ?></td>
|
| 56 |
-
|
| 57 |
</tr>
|
| 58 |
-
|
| 59 |
<tr>
|
| 60 |
-
|
| 61 |
<td><br />
|
| 62 |
-
|
| 63 |
<br />
|
| 64 |
-
|
| 65 |
<br /> <div align="center"><a href="<?php echo $this->getUrl('oscommerceimport')?>">Main Menu</a></div></td>
|
| 66 |
-
|
| 67 |
</tr>
|
| 68 |
-
|
| 69 |
<tr>
|
| 70 |
-
|
| 71 |
<td> </td>
|
| 72 |
-
|
| 73 |
</tr>
|
| 74 |
-
|
| 75 |
<tr>
|
| 76 |
-
|
| 77 |
-
<td><div align="center">Powered by <a href="http://www.atwoodz.com/" target="_blank">ezMage</a> - We provide Magento Support 702-485-3332</div></td>
|
| 78 |
-
|
| 79 |
</tr>
|
| 80 |
-
|
| 81 |
-
</table>
|
| 82 |
-
|
| 1 |
<?php
|
|
|
|
| 2 |
$importCategoryTotal = Mage::getSingleton('core/session')->getimportCategoryTotal();
|
|
|
|
| 3 |
$importedCategoryTotal = Mage::getSingleton('core/session')->getimportedCategoryTotal();
|
| 4 |
+
$error_msg = Mage::getSingleton('core/session')->getErrorMSG();
|
| 5 |
?>
|
|
|
|
| 6 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
|
|
|
| 7 |
<tr>
|
| 8 |
+
<td align="center"><h1><strong>osCommerce Products/Categories/Customers/Orders Import </strong></h1></td>
|
|
|
|
|
|
|
| 9 |
</tr>
|
|
|
|
| 10 |
<tr>
|
|
|
|
| 11 |
<td><strong>Step 4. Import Categories</strong></td>
|
|
|
|
| 12 |
</tr>
|
|
|
|
| 13 |
<tr>
|
|
|
|
| 14 |
<td><br /><br />
|
|
|
|
| 15 |
</td>
|
|
|
|
| 16 |
</tr>
|
| 17 |
+
<?php if ($error_msg != ''){?>
|
| 18 |
+
<tr>
|
| 19 |
+
<td class="error"><hr /><h1><strong>ERROR</strong></h1><?php echo $error_msg; ?><hr /></td>
|
| 20 |
+
</tr>
|
| 21 |
+
<?php } ?>
|
| 22 |
<tr>
|
|
|
|
| 23 |
<td><br />
|
|
|
|
| 24 |
<?php if ($importCategoryTotal != $importedCategoryTotal) { ?>
|
| 25 |
+
Click the link below to import the categories, every time that you click teh script will go to import <?php echo Mage::getStoreConfig('oscommerceimportconf/mageconfiguration/conf_totalperimportcat',Mage::app()->getStore()); ?> categories<br /><br />
|
| 26 |
+
<br /><br />
|
|
|
|
| 27 |
<a href="<?php echo $this->getUrl('oscommerceimport/index/step41/')?>">Please click to import</a>
|
|
|
|
| 28 |
<?php }else{?>
|
|
|
|
| 29 |
Congratulation the categories have been imported <img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); ?>Ezmage/OscommerceImport/check-ok.jpg" />
|
|
|
|
| 30 |
<?php }?>
|
|
|
|
| 31 |
<br />
|
|
|
|
| 32 |
<br />
|
|
|
|
| 33 |
<br />
|
|
|
|
| 34 |
<strong>Total categories to import:</strong> <?php echo $importCategoryTotal; ?><br />
|
|
|
|
| 35 |
<strong>Total categories imported:</strong> <?php echo $importedCategoryTotal; ?></td>
|
|
|
|
| 36 |
</tr>
|
|
|
|
| 37 |
<tr>
|
|
|
|
| 38 |
<td><br />
|
|
|
|
| 39 |
<br />
|
|
|
|
| 40 |
<br /> <div align="center"><a href="<?php echo $this->getUrl('oscommerceimport')?>">Main Menu</a></div></td>
|
|
|
|
| 41 |
</tr>
|
|
|
|
| 42 |
<tr>
|
|
|
|
| 43 |
<td> </td>
|
|
|
|
| 44 |
</tr>
|
|
|
|
| 45 |
<tr>
|
| 46 |
+
<td><div align="center">Powered by <a href="http://www.ezmage.com/" target="_blank">ezMage</a> - We provide Magento Support 702-485-3332</div></td>
|
|
|
|
|
|
|
| 47 |
</tr>
|
| 48 |
+
</table>
|
|
|
|
|
|
app/design/frontend/default/default/template/ezmage/oscommerceimport/step5.phtml
CHANGED
|
@@ -1,11 +1,12 @@
|
|
| 1 |
<?php
|
| 2 |
$importProductsTotal = Mage::getSingleton('core/session')->getimportProductsTotal();
|
| 3 |
$importedProductsTotal = Mage::getSingleton('core/session')->getimportedProductsTotal();
|
| 4 |
-
|
|
|
|
| 5 |
?>
|
| 6 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
| 7 |
<tr>
|
| 8 |
-
<td align="center"><h1><strong>osCommerce Products/Categories Import </strong></h1></td>
|
| 9 |
</tr>
|
| 10 |
<tr>
|
| 11 |
<td><strong>Step 5. Import Products</strong></td>
|
|
@@ -13,7 +14,13 @@
|
|
| 13 |
<tr>
|
| 14 |
<td><br /><br />
|
| 15 |
</td>
|
| 16 |
-
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
<tr>
|
| 18 |
<td><br />
|
| 19 |
<?php if ($importProductsTotal != $importedProductsTotal) { ?>
|
|
@@ -37,6 +44,6 @@
|
|
| 37 |
<td> </td>
|
| 38 |
</tr>
|
| 39 |
<tr>
|
| 40 |
-
<td><div align="center">Powered by <a href="http://www.
|
| 41 |
</tr>
|
| 42 |
</table>
|
| 1 |
<?php
|
| 2 |
$importProductsTotal = Mage::getSingleton('core/session')->getimportProductsTotal();
|
| 3 |
$importedProductsTotal = Mage::getSingleton('core/session')->getimportedProductsTotal();
|
| 4 |
+
$error_msg = Mage::getSingleton('core/session')->getErrorMSG();
|
| 5 |
+
|
| 6 |
?>
|
| 7 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
| 8 |
<tr>
|
| 9 |
+
<td align="center"><h1><strong>osCommerce Products/Categories/Customers/Orders Import </strong></h1></td>
|
| 10 |
</tr>
|
| 11 |
<tr>
|
| 12 |
<td><strong>Step 5. Import Products</strong></td>
|
| 14 |
<tr>
|
| 15 |
<td><br /><br />
|
| 16 |
</td>
|
| 17 |
+
</tr>
|
| 18 |
+
<?php if ($error_msg != ''){?>
|
| 19 |
+
<tr>
|
| 20 |
+
<td class="error"><hr /><h1><strong>ERROR</strong></h1><?php echo $error_msg; ?> <hr /></td>
|
| 21 |
+
</tr>
|
| 22 |
+
<?php } ?>
|
| 23 |
+
|
| 24 |
<tr>
|
| 25 |
<td><br />
|
| 26 |
<?php if ($importProductsTotal != $importedProductsTotal) { ?>
|
| 44 |
<td> </td>
|
| 45 |
</tr>
|
| 46 |
<tr>
|
| 47 |
+
<td><div align="center">Powered by <a href="http://www.ezmage.com/" target="_blank">ezMage</a> - We provide Magento Support 702-485-3332</div></td>
|
| 48 |
</tr>
|
| 49 |
</table>
|
app/design/frontend/default/default/template/ezmage/oscommerceimport/step6.phtml
CHANGED
|
@@ -1,32 +1,37 @@
|
|
| 1 |
<?php
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
?>
|
| 6 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
| 7 |
<tr>
|
| 8 |
-
<td align="center"><h1><strong>osCommerce Products/Categories Import </strong></h1></td>
|
| 9 |
</tr>
|
| 10 |
<tr>
|
| 11 |
-
<td><strong>Step 6.
|
| 12 |
</tr>
|
| 13 |
<tr>
|
| 14 |
<td><br /><br />
|
| 15 |
</td>
|
| 16 |
</tr>
|
|
|
|
| 17 |
<tr>
|
| 18 |
-
<td
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
<br />
|
| 22 |
-
<br />
|
| 23 |
-
</p></td>
|
| 24 |
-
</tr>
|
| 25 |
-
<tr>
|
| 26 |
-
<td valign="top"><div align="center"><h3>Need Help with Magento? Call us at 702-485-3332</h3></div></td>
|
| 27 |
-
</tr>
|
| 28 |
<tr>
|
| 29 |
-
<td
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
</tr>
|
| 31 |
<tr>
|
| 32 |
<td><br />
|
|
@@ -37,6 +42,6 @@
|
|
| 37 |
<td> </td>
|
| 38 |
</tr>
|
| 39 |
<tr>
|
| 40 |
-
<td><div align="center">Powered by <a href="http://www.
|
| 41 |
</tr>
|
| 42 |
</table>
|
| 1 |
<?php
|
| 2 |
+
$importCustomersTotal = Mage::getSingleton('core/session')->getimportCustomersTotal();
|
| 3 |
+
$importedCustomersTotal = Mage::getSingleton('core/session')->getimportedCustomersTotal();
|
| 4 |
+
$error_msg = Mage::getSingleton('core/session')->getErrorMSG();
|
| 5 |
?>
|
| 6 |
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
| 7 |
<tr>
|
| 8 |
+
<td align="center"><h1><strong>osCommerce Products/Categories/Customers/Orders Import </strong></h1></td>
|
| 9 |
</tr>
|
| 10 |
<tr>
|
| 11 |
+
<td><strong>Step 6. Import Customers</strong></td>
|
| 12 |
</tr>
|
| 13 |
<tr>
|
| 14 |
<td><br /><br />
|
| 15 |
</td>
|
| 16 |
</tr>
|
| 17 |
+
<?php if ($error_msg != ''){?>
|
| 18 |
<tr>
|
| 19 |
+
<td class="error"><hr /><h1><strong>ERROR</strong></h1><?php echo $error_msg; ?><hr /></td>
|
| 20 |
+
</tr>
|
| 21 |
+
<?php } ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 22 |
<tr>
|
| 23 |
+
<td><br />
|
| 24 |
+
<?php if ($importCustomersTotal != $importedCustomersTotal) { ?>
|
| 25 |
+
Click the link below to import the customers, every time that you click teh script will go to import <?php echo Mage::getStoreConfig('oscommerceimportconf/mageconfiguration/conf_totalperimportcustomer',Mage::app()->getStore()); ?> customers<br /><br />
|
| 26 |
+
<a href="<?php echo $this->getUrl('oscommerceimport/index/step61/')?>">Please click to import</a>
|
| 27 |
+
<?php }else{?>
|
| 28 |
+
Congratulation the customers have been imported <img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); ?>Ezmage/OscommerceImport/check-ok.jpg" />
|
| 29 |
+
<?php }?>
|
| 30 |
+
<br />
|
| 31 |
+
<br />
|
| 32 |
+
<br />
|
| 33 |
+
<strong>Total Customers to import:</strong> <?php echo $importCustomersTotal; ?><br />
|
| 34 |
+
<strong>Total Customers imported:</strong> <?php echo $importedCustomersTotal; ?></td>
|
| 35 |
</tr>
|
| 36 |
<tr>
|
| 37 |
<td><br />
|
| 42 |
<td> </td>
|
| 43 |
</tr>
|
| 44 |
<tr>
|
| 45 |
+
<td><div align="center">Powered by <a href="http://www.ezmage.com/" target="_blank">ezMage</a> - We provide Magento Support 702-485-3332</div></td>
|
| 46 |
</tr>
|
| 47 |
</table>
|
app/design/frontend/default/default/template/ezmage/oscommerceimport/step7.phtml
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
$importOrdersTotal = Mage::getSingleton('core/session')->getimportOrdersTotal();
|
| 3 |
+
$importedOrdersTotal = Mage::getSingleton('core/session')->getimportedOrdersTotal();
|
| 4 |
+
$error_msg = Mage::getSingleton('core/session')->getErrorMSG();
|
| 5 |
+
?>
|
| 6 |
+
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
| 7 |
+
<tr>
|
| 8 |
+
<td align="center"><h1><strong>osCommerce Products/Categories/Customers/Orders Import </strong></h1></td>
|
| 9 |
+
</tr>
|
| 10 |
+
<tr>
|
| 11 |
+
<td><strong>Step 6. Import Orders</strong></td>
|
| 12 |
+
</tr>
|
| 13 |
+
<tr>
|
| 14 |
+
<td><br /><br />
|
| 15 |
+
</td>
|
| 16 |
+
</tr>
|
| 17 |
+
<?php if ($error_msg != ''){?>
|
| 18 |
+
<tr>
|
| 19 |
+
<td class="error"><hr /><h1><strong>ERROR</strong></h1><?php echo $error_msg; ?><hr /></td>
|
| 20 |
+
</tr>
|
| 21 |
+
<?php } ?>
|
| 22 |
+
<tr>
|
| 23 |
+
<td><br />
|
| 24 |
+
<?php if ($importOrdersTotal != $importedOrdersTotal) { ?>
|
| 25 |
+
Click the link below to import the orders, every time that you click teh script will go to import <?php echo Mage::getStoreConfig('oscommerceimportconf/mageconfiguration/conf_totalperimportorder',Mage::app()->getStore()); ?> orders<br /><br />
|
| 26 |
+
<a href="<?php echo $this->getUrl('oscommerceimport/index/step71/')?>">Please click to import</a>
|
| 27 |
+
<?php }else{?>
|
| 28 |
+
Congratulation the orders have been imported <img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA); ?>Ezmage/OscommerceImport/check-ok.jpg" />
|
| 29 |
+
<?php }?>
|
| 30 |
+
<br />
|
| 31 |
+
<br />
|
| 32 |
+
<br />
|
| 33 |
+
<strong>Total Orders to import:</strong> <?php echo $importOrdersTotal; ?><br />
|
| 34 |
+
<strong>Total Orders imported:</strong> <?php echo $importedOrdersTotal; ?></td>
|
| 35 |
+
</tr>
|
| 36 |
+
<tr>
|
| 37 |
+
<td><br />
|
| 38 |
+
<br />
|
| 39 |
+
<br /> <div align="center"><a href="<?php echo $this->getUrl('oscommerceimport')?>">Main Menu</a></div></td>
|
| 40 |
+
</tr>
|
| 41 |
+
<tr>
|
| 42 |
+
<td> </td>
|
| 43 |
+
</tr>
|
| 44 |
+
<tr>
|
| 45 |
+
<td><div align="center">Powered by <a href="http://www.ezmage.com/" target="_blank">ezMage</a> - We provide Magento Support 702-485-3332</div></td>
|
| 46 |
+
</tr>
|
| 47 |
+
</table>
|
app/design/frontend/default/default/template/ezmage/oscommerceimport/step8.phtml
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
//$importProductsTotal = Mage::getSingleton('core/session')->getimportProductsTotal();
|
| 3 |
+
//$importedProductsTotal = Mage::getSingleton('core/session')->getimportedProductsTotal();
|
| 4 |
+
|
| 5 |
+
?>
|
| 6 |
+
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
| 7 |
+
<tr>
|
| 8 |
+
<td align="center"><h1><strong>osCommerce Products/Categories/Customers/Orders Import </strong></h1></td>
|
| 9 |
+
</tr>
|
| 10 |
+
<tr>
|
| 11 |
+
<td><strong>Step 8. Uninstall and Enjoy</strong></td>
|
| 12 |
+
</tr>
|
| 13 |
+
<tr>
|
| 14 |
+
<td><br /><br />
|
| 15 |
+
</td>
|
| 16 |
+
</tr>
|
| 17 |
+
<tr>
|
| 18 |
+
<td valign="top"><p>The import is done , please click the link below to remove the tmp tables and revome this extension</p>
|
| 19 |
+
<p><a href="<?php echo $this->getUrl('oscommerceimport/index/step81/')?>">Delete TMP Tables</a>
|
| 20 |
+
<br />
|
| 21 |
+
<br />
|
| 22 |
+
<br />
|
| 23 |
+
</p></td>
|
| 24 |
+
</tr>
|
| 25 |
+
<tr>
|
| 26 |
+
<td valign="top"><div align="center"><h3>Need Help with Magento? Call us at 702-485-3332</h3></div></td>
|
| 27 |
+
</tr>
|
| 28 |
+
<tr>
|
| 29 |
+
<td align="center" valign="top"><div align="center"></div></td>
|
| 30 |
+
</tr>
|
| 31 |
+
<tr>
|
| 32 |
+
<td><br />
|
| 33 |
+
<br />
|
| 34 |
+
<br /> <div align="center"><a href="<?php echo $this->getUrl('oscommerceimport')?>">Main Menu</a></div></td>
|
| 35 |
+
</tr>
|
| 36 |
+
<tr>
|
| 37 |
+
<td> </td>
|
| 38 |
+
</tr>
|
| 39 |
+
<tr>
|
| 40 |
+
<td><div align="center">Powered by <a href="http://www.ezmage.com/" target="_blank">ezMage</a> - We provide Magento Support 702-485-3332</div></td>
|
| 41 |
+
</tr>
|
| 42 |
+
</table>
|
app/etc/modules/Ezmage_OscommerceImport.xml
CHANGED
|
@@ -1,10 +1,10 @@
|
|
| 1 |
-
<?xml version="1.0"?>
|
| 2 |
-
|
| 3 |
-
<config>
|
| 4 |
-
<modules>
|
| 5 |
-
<Ezmage_OscommerceImport>
|
| 6 |
-
<active>true</active>
|
| 7 |
-
<codePool>community</codePool>
|
| 8 |
-
</Ezmage_OscommerceImport>
|
| 9 |
-
</modules>
|
| 10 |
</config>
|
| 1 |
+
<?xml version="1.0"?>
|
| 2 |
+
|
| 3 |
+
<config>
|
| 4 |
+
<modules>
|
| 5 |
+
<Ezmage_OscommerceImport>
|
| 6 |
+
<active>true</active>
|
| 7 |
+
<codePool>community</codePool>
|
| 8 |
+
</Ezmage_OscommerceImport>
|
| 9 |
+
</modules>
|
| 10 |
</config>
|
package.xml
CHANGED
|
@@ -1,18 +1,18 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Ezmage_OscommerceImport</name>
|
| 4 |
-
<version>1.7.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>OSL</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
-
<summary>Easily import categories and
|
| 10 |
<description>A tool that is designed for people who may have outgrown their current osCommerce platform or want to take the next step in e-commerce and move to an enterprise level platform. The osCommerce Categories / Products Migration tool allows you to easily export your products, images and product descriptions into a new Magento e-commerce store. Within minutes you can have your Magento store populated with the products you probably spent hours inserting into your osCommerce store!</description>
|
| 11 |
-
<notes>
|
| 12 |
<authors><author><name>ezMage</name><user>ezosc</user><email>luis@ezosc.com</email></author></authors>
|
| 13 |
-
<date>2012-06-
|
| 14 |
-
<time>
|
| 15 |
-
<contents><target name="magecommunity"><dir name="Ezmage"><dir name="OscommerceImport"><dir name="Helper"><file name="Data.php" hash="001ce1cd0278e96f0ebf2bcde0f1f740"/></dir><dir name="Model"><dir name="Source"><file name="GetAttributeSets.php" hash="b9b1f50222887f9724419b2e81c8c9bf"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="
|
| 16 |
<compatible/>
|
| 17 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
| 18 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>Ezmage_OscommerceImport</name>
|
| 4 |
+
<version>1.7.4</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>OSL</license>
|
| 7 |
<channel>community</channel>
|
| 8 |
<extends/>
|
| 9 |
+
<summary>Easily import categories/products/customers and orders from an osCommerce store into a Magento website! </summary>
|
| 10 |
<description>A tool that is designed for people who may have outgrown their current osCommerce platform or want to take the next step in e-commerce and move to an enterprise level platform. The osCommerce Categories / Products Migration tool allows you to easily export your products, images and product descriptions into a new Magento e-commerce store. Within minutes you can have your Magento store populated with the products you probably spent hours inserting into your osCommerce store!</description>
|
| 11 |
+
<notes>Now you can import the Customers and Orders</notes>
|
| 12 |
<authors><author><name>ezMage</name><user>ezosc</user><email>luis@ezosc.com</email></author></authors>
|
| 13 |
+
<date>2012-06-18</date>
|
| 14 |
+
<time>16:33:44</time>
|
| 15 |
+
<contents><target name="magecommunity"><dir name="Ezmage"><dir name="OscommerceImport"><dir name="Helper"><file name="Data.php" hash="001ce1cd0278e96f0ebf2bcde0f1f740"/><dir name="_notes"><file name="dwsync.xml" hash="92f5ab9f9ec159e4a9bfcdb426fa2101"/></dir></dir><dir name="Model"><dir name="Source"><file name="GetAttributeSets.php" hash="b9b1f50222887f9724419b2e81c8c9bf"/><dir name="_notes"><file name="dwsync.xml" hash="94d9ffa47bb72a83aa709a76d3cd6335"/></dir></dir></dir><dir name="controllers"><file name="IndexController.php" hash="8d7a36133f9d278bee8224ba2bb56dcb"/><dir name="_notes"><file name="dwsync.xml" hash="e6208632271b5ad0e5c74a8a9a1c3a7a"/></dir></dir><dir name="etc"><dir name="_notes"><file name="dwsync.xml" hash="f0baa67a1ea36697d607e697543db623"/></dir><file name="config.xml" hash="7f30aceb7cd172878cf160c8cfcaea18"/><file name="system.xml" hash="97d384e4e6e6640f6b45fd74b537f5fd"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ezmage_OscommerceImport.xml" hash="2000efb010c3f290d3170e00f14d3e4e"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="default"><dir name="default"><dir name="template"><dir name="ezmage"><dir name="oscommerceimport"><dir name="_notes"><file name="dwsync.xml" hash="3f49638b54a9eb4da1152d2d80429807"/></dir><file name="step0.phtml" hash="956082acc5eeabfed69374e1f7f77b1c"/><file name="step1.phtml" hash="ac70c6a807973c32d1186430a23e530b"/><file name="step2.phtml" hash="cf2dbfd3fb368f874b3e61ccca6591e1"/><file name="step3.phtml" hash="879265b22ea20c81f9cd4a4ad48948a8"/><file name="step31.phtml" hash="8c449ec34a91eea2987aa8861af9eb75"/><file name="step4.phtml" hash="df3f1bde5348494c6deaeeaf0cc6150f"/><file name="step5.phtml" hash="93b563ff93248a6cf12435797e074ac0"/><file name="step6.phtml" hash="683dad8d83966857772267dbe457fa88"/><file name="step7.phtml" hash="bfda65469851da45b2d413b71a713abd"/><file name="step8.phtml" hash="014e65886688b06744e3b221a489410f"/></dir></dir></dir></dir></dir></dir></target><target name="magemedia"><dir name="Ezmage"><dir name="OscommerceImport"><file name="check-no.jpg" hash="1c9c306222acaf4150291d5f82e15389"/><file name="check-ok.jpg" hash="1a990bbbbead79f7af02883406c420f9"/><file name="step1.png" hash="4ca193b1b5ccc8012ef85c0e62743cf7"/></dir></dir></target></contents>
|
| 16 |
<compatible/>
|
| 17 |
<dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
|
| 18 |
</package>
|
