Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterdietz/2641418 to your computer and use it in GitHub Desktop.
Save peterdietz/2641418 to your computer and use it in GitHub Desktop.
The Magento oscommerce-migration-tool is broken and needs to be manually patched to successfully import. This is the changes I had to do (picked it up from forum posts) to get the import to work. Also, make sure all products have images, and none of your
diff --git a/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Run.php b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Run.php
index 4b5e822..7d46a2a 100644
--- a/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Run.php
+++ b/app/code/core/Mage/Oscommerce/Block/Adminhtml/Import/Run.php
@@ -158,7 +158,7 @@ function sendImportData(data) {
new Ajax.Request("'.$this->getUrl('*/*/batchRun').'", {
- method: "post",
+ method: "get",
parameters: data,
onSuccess: function(transport) {
diff --git a/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce.php b/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce.php
index 4db67d7..026512a 100644
--- a/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce.php
+++ b/app/code/core/Mage/Oscommerce/Model/Mysql4/Oscommerce.php
@@ -696,6 +696,9 @@ class Mage_Oscommerce_Model_Mysql4_Oscommerce extends Mage_Core_Model_Mysql4_Abs
}
if (!file_exists(Mage::getBaseDir('media'). DS . 'import' . $data['image'])) {
+ $this->_addErrors(Mage::helper('oscommerce')->__('SKU %s cannot find image, looked at: media/import%s',
+ $data['sku'],
+ $data['image']));
unset($data['image']);
} else {
$data['thumbnail'] = $data['small_image'] = $data['image'];
@@ -2019,24 +2022,30 @@ class Mage_Oscommerce_Model_Mysql4_Oscommerce extends Mage_Core_Model_Mysql4_Abs
* @param array $notIncludedFields
* @return mixed
*/
- public function convert($data, array $notIncludedFields = array())
- {
- $charset = $this->getDataCharset();
- if (!is_null($charset) || $charset != self::DEFAULT_FIELD_CHARSET) {
- if (is_array($data)) {
- foreach($data as $field => $value) {
- if (!in_array($field, $notIncludedFields)) {
- $data[$field] = @iconv($charset, self::DEFAULT_FIELD_CHARSET, $value);
- }
- }
- } else {
- $data = @iconv($charset, self::DEFAULT_MAGENTO_CHARSET, $data);
- }
- }
- return $data;
- }
+ public function convert($data, array $notIncludedFields = array())
+ {
+ $charset = $this->getDataCharset();
+ if (!is_null($charset) || $charset != self::DEFAULT_FIELD_CHARSET) {
+ if (is_array($data)) {
+ foreach($data as $field => $value) {
+ if (!in_array($field, $notIncludedFields)) {
+ if (@iconv($charset, self::DEFAULT_FIELD_CHARSET, $value) !== FALSE)
+ $data[$field] = @iconv($charset, self::DEFAULT_FIELD_CHARSET, $value);
+ else
+ $data[$field] = $value;
+ }
+ }
+ } else {
+ if (@iconv($charset, self::DEFAULT_MAGENTO_CHARSET, $data) !== FALSE)
+ $data = @iconv($charset, self::DEFAULT_MAGENTO_CHARSET, $data);
+ else
+ $data = $data;
+ }
+ }
+ return $data;
+ }
- /**
+ /**
* Getting saveRows
*
* @return integer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment