Version Notes
Migrates data from VirtueMart to Magento
Download this release
Release Info
Developer | Yireo |
Extension | Yireo_Vm2Mage |
Version | 0.10.0 |
Comparing to | |
See all releases |
Code changes from version 0.8.215 to 0.10.0
- app/code/community/Yireo/Vm2Mage/Block/Check.php +40 -1
- app/code/community/Yireo/Vm2Mage/Helper/Image.php +5 -0
- app/code/community/Yireo/Vm2Mage/Model/Attribute/Api.php +1 -1
- app/code/community/Yireo/Vm2Mage/Model/Category/Api.php +5 -3
- app/code/community/Yireo/Vm2Mage/Model/Product/Api.php +32 -9
- app/code/community/Yireo/Vm2Mage/Model/User/Api.php +65 -37
- app/code/community/Yireo/Vm2Mage/etc/config.xml +1 -1
- app/code/community/Zend/XmlRpc/Server.php +0 -587
- app/design/adminhtml/default/default/template/vm2mage/check.phtml +1 -0
- package.xml +12 -114
- skin/adminhtml/default/default/images/vm2mage/check-error.png +0 -0
- skin/adminhtml/default/default/images/vm2mage/check-ok.png +0 -0
- skin/adminhtml/default/default/images/vm2mage/check-warning.png +0 -0
app/code/community/Yireo/Vm2Mage/Block/Check.php
CHANGED
@@ -134,7 +134,46 @@ class Yireo_Vm2Mage_Block_Check extends Mage_Core_Block_Template
|
|
134 |
|
135 |
$collection = Mage::getResourceModel('api/user_collection');
|
136 |
$result = ($collection->count() > 0) ? self::CHECK_OK : self::CHECK_ERROR;
|
137 |
-
$this->addResult('
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
|
139 |
return $this->system_checks;
|
140 |
}
|
134 |
|
135 |
$collection = Mage::getResourceModel('api/user_collection');
|
136 |
$result = ($collection->count() > 0) ? self::CHECK_OK : self::CHECK_ERROR;
|
137 |
+
$this->addResult('conf', 'API-user', $result, 'You should create an API-user with API resource-access');
|
138 |
+
|
139 |
+
$config = Mage::app()->getConfig()->getModuleConfig('Yireo_Vm2Mage');
|
140 |
+
if(!empty($config) && !empty($config->version)) {
|
141 |
+
$version = (string)$config->version;
|
142 |
+
$result = self::CHECK_OK;
|
143 |
+
} else {
|
144 |
+
$result = self::CHECK_ERROR;
|
145 |
+
$version = '[unknown]';
|
146 |
+
}
|
147 |
+
$this->addResult('conf', 'Vm2Mage version', $result, 'Module version: '.$version);
|
148 |
+
|
149 |
+
$config = Mage::app()->getConfig()->getModuleConfig('Yireo_VmOrder');
|
150 |
+
if(!empty($config) && !empty($config->version)) {
|
151 |
+
$version = (string)$config->version;
|
152 |
+
$result = self::CHECK_OK;
|
153 |
+
} else {
|
154 |
+
$result = self::CHECK_ERROR;
|
155 |
+
$version = '[unknown]';
|
156 |
+
}
|
157 |
+
$this->addResult('conf', 'VmOrder version', $result, 'Module version: '.$version);
|
158 |
+
|
159 |
+
$count = Mage::getResourceModel('catalog/product_collection')->count();
|
160 |
+
$this->addResult('stats', 'Products', self::CHECK_OK, 'Product collection count: '.(int)$count);
|
161 |
+
|
162 |
+
$count = Mage::getResourceModel('catalog/category_collection')->count();
|
163 |
+
$this->addResult('stats', 'Categories', self::CHECK_OK, 'Category collection count: '.(int)$count);
|
164 |
+
|
165 |
+
$count = Mage::getResourceModel('customer/customer_collection')->count();
|
166 |
+
$this->addResult('stats', 'Customers', self::CHECK_OK, 'Customer collection count: '.(int)$count);
|
167 |
+
|
168 |
+
$collection = Mage::getResourceModel('vmorder/order_collection');
|
169 |
+
if(empty($collection)) {
|
170 |
+
$result = self::CHECK_ERROR;
|
171 |
+
$count = 0;
|
172 |
+
} else {
|
173 |
+
$result = self::CHECK_OK;
|
174 |
+
$count = $collection->count();
|
175 |
+
}
|
176 |
+
$this->addResult('stats', 'VmOrder', $result, 'VmOrder order-collection count: '.(int)$count);
|
177 |
|
178 |
return $this->system_checks;
|
179 |
}
|
app/code/community/Yireo/Vm2Mage/Helper/Image.php
CHANGED
@@ -54,6 +54,8 @@ class Yireo_Vm2Mage_Helper_Image extends Yireo_Vm2Mage_Helper_Data
|
|
54 |
*/
|
55 |
public function addImages($product = null, $images = null)
|
56 |
{
|
|
|
|
|
57 |
// Check whether the images are already there
|
58 |
$gallery_images = $product->getMediaGalleryImages();
|
59 |
if(is_object($gallery_images) && $gallery_images->count() >= count($images)) {
|
@@ -65,6 +67,9 @@ class Yireo_Vm2Mage_Helper_Image extends Yireo_Vm2Mage_Helper_Data
|
|
65 |
foreach($images as $image) {
|
66 |
|
67 |
if(empty($image['label'])) $image['label'] = $product->getName();
|
|
|
|
|
|
|
68 |
$result = self::addLocalImage($product, $image['file'], $image['label']);
|
69 |
if($result != false) {
|
70 |
$product = $result;
|
54 |
*/
|
55 |
public function addImages($product = null, $images = null)
|
56 |
{
|
57 |
+
//Mage::helper('vm2mage')->debug('Images', $images);
|
58 |
+
|
59 |
// Check whether the images are already there
|
60 |
$gallery_images = $product->getMediaGalleryImages();
|
61 |
if(is_object($gallery_images) && $gallery_images->count() >= count($images)) {
|
67 |
foreach($images as $image) {
|
68 |
|
69 |
if(empty($image['label'])) $image['label'] = $product->getName();
|
70 |
+
if(empty($image['file'])) $image['file'] = null;
|
71 |
+
if(empty($image['md5sum'])) $image['md5sum'] = null;
|
72 |
+
|
73 |
$result = self::addLocalImage($product, $image['file'], $image['label']);
|
74 |
if($result != false) {
|
75 |
$product = $result;
|
app/code/community/Yireo/Vm2Mage/Model/Attribute/Api.php
CHANGED
@@ -24,7 +24,7 @@ class Yireo_Vm2Mage_Model_Attribute_Api extends Mage_Api_Model_Resource_Abstract
|
|
24 |
return array(0, "Attribute is not an array");
|
25 |
}
|
26 |
// @todo: Option to enable debugging
|
27 |
-
|
28 |
|
29 |
// Quick filter for the attribute-name
|
30 |
$data['name'] = strtolower($data['name']);
|
24 |
return array(0, "Attribute is not an array");
|
25 |
}
|
26 |
// @todo: Option to enable debugging
|
27 |
+
#Mage::helper('vm2mage')->debug('VirtueMart attribute', $data);
|
28 |
|
29 |
// Quick filter for the attribute-name
|
30 |
$data['name'] = strtolower($data['name']);
|
app/code/community/Yireo/Vm2Mage/Model/Category/Api.php
CHANGED
@@ -26,7 +26,7 @@ class Yireo_Vm2Mage_Model_Category_Api extends Mage_Catalog_Model_Category_Api
|
|
26 |
|
27 |
// Decode all values
|
28 |
$data = Mage::helper('vm2mage')->decode($data);
|
29 |
-
|
30 |
|
31 |
// Get a clean category-object
|
32 |
$category = Mage::getModel('catalog/category');
|
@@ -51,7 +51,7 @@ class Yireo_Vm2Mage_Model_Category_Api extends Mage_Catalog_Model_Category_Api
|
|
51 |
}
|
52 |
|
53 |
// Take the parent from Magento
|
54 |
-
$storeId = (isset($data['store_id'])) ?
|
55 |
if($parentId == 0 && !empty($storeId)) {
|
56 |
$parentId = Mage::app()->getStore($storeId)->getRootCategoryId();
|
57 |
}
|
@@ -81,11 +81,13 @@ class Yireo_Vm2Mage_Model_Category_Api extends Mage_Catalog_Model_Category_Api
|
|
81 |
$isNew = false;
|
82 |
}
|
83 |
|
|
|
|
|
84 |
// Set common attributes
|
85 |
$category->setData($category->getData())
|
86 |
->setName($data['name'])
|
87 |
->setDescription($data['description'])
|
88 |
-
->setIsActive($
|
89 |
;
|
90 |
|
91 |
// @todo: Get the remote images
|
26 |
|
27 |
// Decode all values
|
28 |
$data = Mage::helper('vm2mage')->decode($data);
|
29 |
+
#Mage::helper('vm2mage')->debug('VirtueMart category', $data);
|
30 |
|
31 |
// Get a clean category-object
|
32 |
$category = Mage::getModel('catalog/category');
|
51 |
}
|
52 |
|
53 |
// Take the parent from Magento
|
54 |
+
$storeId = (isset($data['store_id'])) ? $data['store_id'] : 0;
|
55 |
if($parentId == 0 && !empty($storeId)) {
|
56 |
$parentId = Mage::app()->getStore($storeId)->getRootCategoryId();
|
57 |
}
|
81 |
$isNew = false;
|
82 |
}
|
83 |
|
84 |
+
$state = (isset($data['status'])) ? $data['status'] : $data['published'];
|
85 |
+
|
86 |
// Set common attributes
|
87 |
$category->setData($category->getData())
|
88 |
->setName($data['name'])
|
89 |
->setDescription($data['description'])
|
90 |
+
->setIsActive($state)
|
91 |
;
|
92 |
|
93 |
// @todo: Get the remote images
|
app/code/community/Yireo/Vm2Mage/Model/Product/Api.php
CHANGED
@@ -21,14 +21,14 @@ class Yireo_Vm2Mage_Model_Product_Api extends Mage_Catalog_Model_Product_Api
|
|
21 |
{
|
22 |
// Check for empty data
|
23 |
if(!is_array($data)) {
|
24 |
-
Mage::helper('vm2mage')->debug('VirtueMart product', $data);
|
25 |
return array(0, "Data is not an array");
|
26 |
}
|
27 |
|
28 |
// Decode all values
|
29 |
$data = Mage::helper('vm2mage')->decode($data);
|
30 |
// @todo: Option to enable debugging
|
31 |
-
|
32 |
|
33 |
// @todo: Optionally lock the indexer
|
34 |
//Mage::getSingleton('index/indexer')->lockIndexer();
|
@@ -65,6 +65,12 @@ class Yireo_Vm2Mage_Model_Product_Api extends Mage_Catalog_Model_Product_Api
|
|
65 |
}
|
66 |
}
|
67 |
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
// Make sure there is a short-description
|
69 |
if(empty($data['short_description'])) {
|
70 |
$data['short_description'] = $data['name'];
|
@@ -78,11 +84,15 @@ class Yireo_Vm2Mage_Model_Product_Api extends Mage_Catalog_Model_Product_Api
|
|
78 |
->setName($data['name'])
|
79 |
->setDescription($data['description'])
|
80 |
->setShortDescription($data['short_description'])
|
81 |
-
->setWeight($data['weight'])
|
82 |
->setStatus($data['status'])
|
83 |
->setTaxClassId($taxId)
|
84 |
;
|
85 |
|
|
|
|
|
|
|
|
|
|
|
86 |
// Set visibility
|
87 |
if(isset($data['visibility']) && $data['visibility'] == 'none') {
|
88 |
$product->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE);
|
@@ -91,13 +101,26 @@ class Yireo_Vm2Mage_Model_Product_Api extends Mage_Catalog_Model_Product_Api
|
|
91 |
}
|
92 |
|
93 |
// Set Meta-information
|
94 |
-
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
// Set the custom attributes
|
98 |
if(isset($data['attributes'])) {
|
99 |
foreach($data['attributes'] as $name => $value) {
|
100 |
-
|
101 |
$product = Mage::helper('vm2mage/attribute')->addAttributeToProduct($product, $name, $value);
|
102 |
}
|
103 |
}
|
@@ -126,7 +149,7 @@ class Yireo_Vm2Mage_Model_Product_Api extends Mage_Catalog_Model_Product_Api
|
|
126 |
// Handle the stock
|
127 |
if(isset($data['in_stock']) && $data['in_stock'] > 0) {
|
128 |
$stockData = $product->getStockData();
|
129 |
-
Mage::helper('vm2mage')->debug('VirtueMart product stock-data', $stockData);
|
130 |
$stockData['qty'] = $data['in_stock'];
|
131 |
$stockData['is_in_stock'] = 1;
|
132 |
$stockData['manage_stock'] = 1;
|
@@ -179,9 +202,9 @@ class Yireo_Vm2Mage_Model_Product_Api extends Mage_Catalog_Model_Product_Api
|
|
179 |
|
180 |
// Return true by default
|
181 |
if($isNew) {
|
182 |
-
return array(1, "Created new product ".$product->getName()." [".$product->
|
183 |
} else {
|
184 |
-
return array(1, "Updated product ".$product->getName()." [".$product->
|
185 |
}
|
186 |
}
|
187 |
}
|
21 |
{
|
22 |
// Check for empty data
|
23 |
if(!is_array($data)) {
|
24 |
+
#Mage::helper('vm2mage')->debug('VirtueMart product', $data);
|
25 |
return array(0, "Data is not an array");
|
26 |
}
|
27 |
|
28 |
// Decode all values
|
29 |
$data = Mage::helper('vm2mage')->decode($data);
|
30 |
// @todo: Option to enable debugging
|
31 |
+
#Mage::helper('vm2mage')->debug('VirtueMart product', $data);
|
32 |
|
33 |
// @todo: Optionally lock the indexer
|
34 |
//Mage::getSingleton('index/indexer')->lockIndexer();
|
65 |
}
|
66 |
}
|
67 |
|
68 |
+
// Make sure the status is set
|
69 |
+
if(!isset($data['status'])) {
|
70 |
+
$data['status'] = 1;
|
71 |
+
}
|
72 |
+
$data['status'] = 1;
|
73 |
+
|
74 |
// Make sure there is a short-description
|
75 |
if(empty($data['short_description'])) {
|
76 |
$data['short_description'] = $data['name'];
|
84 |
->setName($data['name'])
|
85 |
->setDescription($data['description'])
|
86 |
->setShortDescription($data['short_description'])
|
|
|
87 |
->setStatus($data['status'])
|
88 |
->setTaxClassId($taxId)
|
89 |
;
|
90 |
|
91 |
+
// Set weight
|
92 |
+
if(isset($data['weight'])) {
|
93 |
+
$product->setWeight($data['weight']);
|
94 |
+
}
|
95 |
+
|
96 |
// Set visibility
|
97 |
if(isset($data['visibility']) && $data['visibility'] == 'none') {
|
98 |
$product->setVisibility(Mage_Catalog_Model_Product_Visibility::VISIBILITY_NOT_VISIBLE);
|
101 |
}
|
102 |
|
103 |
// Set Meta-information
|
104 |
+
if(!empty($data['metadesc'])) {
|
105 |
+
$product->setMetaDescription(htmlspecialchars($data['metadesc']));
|
106 |
+
} else {
|
107 |
+
$product->setMetaDescription(strip_tags($product->getDescription()));
|
108 |
+
}
|
109 |
+
|
110 |
+
if(!empty($data['metakey'])) {
|
111 |
+
$product->setMetaKeyword(htmlspecialchars($data['metakey']));
|
112 |
+
}
|
113 |
+
|
114 |
+
if(!empty($data['metatitle'])) {
|
115 |
+
$product->setMetaTitle(htmlspecialchars($data['metatitle']));
|
116 |
+
} else {
|
117 |
+
$product->setMetaTitle($product->getTitle());
|
118 |
+
}
|
119 |
|
120 |
// Set the custom attributes
|
121 |
if(isset($data['attributes'])) {
|
122 |
foreach($data['attributes'] as $name => $value) {
|
123 |
+
#Mage::helper('vm2mage')->debug('Product attribute', $name);
|
124 |
$product = Mage::helper('vm2mage/attribute')->addAttributeToProduct($product, $name, $value);
|
125 |
}
|
126 |
}
|
149 |
// Handle the stock
|
150 |
if(isset($data['in_stock']) && $data['in_stock'] > 0) {
|
151 |
$stockData = $product->getStockData();
|
152 |
+
#Mage::helper('vm2mage')->debug('VirtueMart product stock-data', $stockData);
|
153 |
$stockData['qty'] = $data['in_stock'];
|
154 |
$stockData['is_in_stock'] = 1;
|
155 |
$stockData['manage_stock'] = 1;
|
202 |
|
203 |
// Return true by default
|
204 |
if($isNew) {
|
205 |
+
return array(1, "Created new product ".$product->getName()." [".$product->getId()."]", $data['id']);
|
206 |
} else {
|
207 |
+
return array(1, "Updated product ".$product->getName()." [".$product->getId()."]", $data['id']);
|
208 |
}
|
209 |
}
|
210 |
}
|
app/code/community/Yireo/Vm2Mage/Model/User/Api.php
CHANGED
@@ -26,7 +26,7 @@ class Yireo_Vm2Mage_Model_User_Api extends Mage_Customer_Model_Customer_Api
|
|
26 |
|
27 |
// Decode all values
|
28 |
$data = Mage::helper('vm2mage')->decode($data);
|
29 |
-
Mage::helper('vm2mage')->debug('VirtueMart user', $data);
|
30 |
|
31 |
// Check for email
|
32 |
if(empty($data['email'])) {
|
@@ -49,9 +49,9 @@ class Yireo_Vm2Mage_Model_User_Api extends Mage_Customer_Model_Customer_Api
|
|
49 |
$isNew = true;
|
50 |
$customer->setData($customer->getData())
|
51 |
->setId(null)
|
52 |
-
->setCreatedAt($data['created_at'])
|
53 |
-
->setUpdatedAt($data['modified_at'])
|
54 |
;
|
|
|
|
|
55 |
|
56 |
} else {
|
57 |
$customer->setData($customer->getData())
|
@@ -60,16 +60,29 @@ class Yireo_Vm2Mage_Model_User_Api extends Mage_Customer_Model_Customer_Api
|
|
60 |
$isNew = false;
|
61 |
}
|
62 |
|
63 |
-
//
|
64 |
-
$
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
|
74 |
// Set the group and tax class
|
75 |
if(isset($data['customer_group_id'])) {
|
@@ -77,13 +90,9 @@ class Yireo_Vm2Mage_Model_User_Api extends Mage_Customer_Model_Customer_Api
|
|
77 |
$customer->setTaxClassId(Mage::getModel('customer/group')->getTaxClassId($data['customer_group_id']));
|
78 |
}
|
79 |
|
80 |
-
// Set the
|
81 |
-
if(
|
82 |
-
|
83 |
-
// Set the password (but only if it's a plain MD5-string)
|
84 |
-
if(preg_match('/^([0-9a-fA-F]{32})$/', $data['password'])) {
|
85 |
-
$hash = $data['password'].':';
|
86 |
-
$customer->setPasswordHash($hash);
|
87 |
}
|
88 |
|
89 |
// Try to safe this customer to the database
|
@@ -145,7 +154,7 @@ class Yireo_Vm2Mage_Model_User_Api extends Mage_Customer_Model_Customer_Api
|
|
145 |
$address = $billingAddress;
|
146 |
$is_billing = true;
|
147 |
}
|
148 |
-
|
149 |
|
150 |
// Some extra overrides
|
151 |
$is_shipping = (empty($shippingAddress)) ? true : false;
|
@@ -159,34 +168,49 @@ class Yireo_Vm2Mage_Model_User_Api extends Mage_Customer_Model_Customer_Api
|
|
159 |
}
|
160 |
|
161 |
// Compile the street
|
162 |
-
$street =
|
|
|
163 |
if(!empty($data['address_2'])) $street .= "\n".$data['address_2'];
|
164 |
|
|
|
|
|
|
|
|
|
|
|
165 |
// Load the country and region
|
166 |
-
$country =
|
167 |
-
$region =
|
|
|
|
|
168 |
|
169 |
-
// Set
|
170 |
$address
|
171 |
->setIsPrimaryBilling($is_billing)
|
172 |
->setIsPrimaryShipping($is_shipping)
|
173 |
->setIsDefaultBilling($is_billing)
|
174 |
->setIsDefaultShipping($is_shipping)
|
175 |
-
->setTelephone($data['phone_1'])
|
176 |
-
->setFirstname($data['first_name'])
|
177 |
-
->setMiddlename($data['middle_name'])
|
178 |
-
->setLastname($data['last_name'])
|
179 |
-
->setCompany($data['company'])
|
180 |
-
->setFax($data['fax'])
|
181 |
->setStreet($street)
|
182 |
-
->setCity($data['city'])
|
183 |
-
->setPostcode($data['zip'])
|
184 |
-
->setRegion($data['state'])
|
185 |
-
->setCountry($data['country'])
|
186 |
;
|
187 |
|
188 |
-
//
|
189 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
|
191 |
// Load the country and region
|
192 |
if(!empty($country)) $address->setCountryId($country->getId());
|
@@ -218,6 +242,10 @@ class Yireo_Vm2Mage_Model_User_Api extends Mage_Customer_Model_Customer_Api
|
|
218 |
*/
|
219 |
private function saveProductReviews($customer, $data)
|
220 |
{
|
|
|
|
|
|
|
|
|
221 |
$sku = trim($data['product_sku']);
|
222 |
if(empty($sku)) {
|
223 |
return null;
|
26 |
|
27 |
// Decode all values
|
28 |
$data = Mage::helper('vm2mage')->decode($data);
|
29 |
+
#Mage::helper('vm2mage')->debug('VirtueMart user', $data);
|
30 |
|
31 |
// Check for email
|
32 |
if(empty($data['email'])) {
|
49 |
$isNew = true;
|
50 |
$customer->setData($customer->getData())
|
51 |
->setId(null)
|
|
|
|
|
52 |
;
|
53 |
+
if(!empty($data['created_at'])) $customer->setCreatedAt($data['created_at']);
|
54 |
+
if(!empty($data['modified_at'])) $customer->setUpdatedAt($data['modified_at']);
|
55 |
|
56 |
} else {
|
57 |
$customer->setData($customer->getData())
|
60 |
$isNew = false;
|
61 |
}
|
62 |
|
63 |
+
// Fix bogus dates
|
64 |
+
$createdAt = strtotime($customer->getCreatedAt());
|
65 |
+
$updatedAt = strtotime($customer->getUpdatedAt());
|
66 |
+
$birthOfJoomla = strtotime('01 January 1991');
|
67 |
+
if($createdAt < $birthOfJoomla || $createdAt > time()) $customer->setCreatedAt(strftime('%Y-%m-%d %H:%M:%S', time()));
|
68 |
+
if($updatedAt < $birthOfJoomla || $updatedAt > time()) $customer->setUpdatedAt(strftime('%Y-%m-%d %H:%M:%S', time()));
|
69 |
+
|
70 |
+
// Set common fields (vmField => mageField)
|
71 |
+
$fields = array(
|
72 |
+
'name' => 'name',
|
73 |
+
'email' => 'email',
|
74 |
+
'first_name' => 'firstname',
|
75 |
+
'middle_name' => 'middlename',
|
76 |
+
'last_name' => 'lastname',
|
77 |
+
'taxvat' => 'taxvat',
|
78 |
+
);
|
79 |
+
foreach($fields as $vmField => $mageField) {
|
80 |
+
if(isset($data[$vmField])) $customer->setData($mageField, $data[$vmField]);
|
81 |
+
}
|
82 |
+
|
83 |
+
// Set store-ID and website-ID
|
84 |
+
$customer->setStoreId($storeId);
|
85 |
+
$customer->setWebsiteId($websiteId);
|
86 |
|
87 |
// Set the group and tax class
|
88 |
if(isset($data['customer_group_id'])) {
|
90 |
$customer->setTaxClassId(Mage::getModel('customer/group')->getTaxClassId($data['customer_group_id']));
|
91 |
}
|
92 |
|
93 |
+
// Set the password
|
94 |
+
if(isset($data['password'])) {
|
95 |
+
$customer->setPasswordHash($data['password']);
|
|
|
|
|
|
|
|
|
96 |
}
|
97 |
|
98 |
// Try to safe this customer to the database
|
154 |
$address = $billingAddress;
|
155 |
$is_billing = true;
|
156 |
}
|
157 |
+
#Mage::helper('vm2mage')->debug('Magento address', $address->debug());
|
158 |
|
159 |
// Some extra overrides
|
160 |
$is_shipping = (empty($shippingAddress)) ? true : false;
|
168 |
}
|
169 |
|
170 |
// Compile the street
|
171 |
+
$street = null;
|
172 |
+
if(!empty($data['address_1'])) $street .= $data['address_1'];
|
173 |
if(!empty($data['address_2'])) $street .= "\n".$data['address_2'];
|
174 |
|
175 |
+
// Don't continue with empty street
|
176 |
+
if(empty($street)) {
|
177 |
+
return false;
|
178 |
+
}
|
179 |
+
|
180 |
// Load the country and region
|
181 |
+
$country = null;
|
182 |
+
$region = null;
|
183 |
+
if(!empty($data['country'])) $country = Mage::getModel('directory/country')->loadByCode($data['country']);
|
184 |
+
if(!empty($data['region'])) $region = Mage::getModel('directory/region')->loadByCode($data['state'], $country->getId());
|
185 |
|
186 |
+
// Set basic values
|
187 |
$address
|
188 |
->setIsPrimaryBilling($is_billing)
|
189 |
->setIsPrimaryShipping($is_shipping)
|
190 |
->setIsDefaultBilling($is_billing)
|
191 |
->setIsDefaultShipping($is_shipping)
|
|
|
|
|
|
|
|
|
|
|
|
|
192 |
->setStreet($street)
|
|
|
|
|
|
|
|
|
193 |
;
|
194 |
|
195 |
+
// Set other fields (vmField => mageField)
|
196 |
+
$fields = array(
|
197 |
+
'phone_1' => 'telephone',
|
198 |
+
'first_name' => 'firstname',
|
199 |
+
'middle_name' => 'middlename',
|
200 |
+
'last_name' => 'lastname',
|
201 |
+
'company' => 'company',
|
202 |
+
'fax' => 'fax',
|
203 |
+
'city' => 'city',
|
204 |
+
'zip' => 'postcode',
|
205 |
+
'state' => 'region',
|
206 |
+
'country' => 'country',
|
207 |
+
'taxvat' => 'vat_id',
|
208 |
+
);
|
209 |
+
foreach($fields as $vmField => $mageField) {
|
210 |
+
if(isset($data[$vmField])) {
|
211 |
+
$address->setData($mageField, $data[$vmField]);
|
212 |
+
}
|
213 |
+
}
|
214 |
|
215 |
// Load the country and region
|
216 |
if(!empty($country)) $address->setCountryId($country->getId());
|
242 |
*/
|
243 |
private function saveProductReviews($customer, $data)
|
244 |
{
|
245 |
+
if(empty($data['product_sku'])) {
|
246 |
+
return null;
|
247 |
+
}
|
248 |
+
|
249 |
$sku = trim($data['product_sku']);
|
250 |
if(empty($sku)) {
|
251 |
return null;
|
app/code/community/Yireo/Vm2Mage/etc/config.xml
CHANGED
@@ -14,7 +14,7 @@
|
|
14 |
|
15 |
<modules>
|
16 |
<Yireo_Vm2Mage>
|
17 |
-
<version>0.
|
18 |
</Yireo_Vm2Mage>
|
19 |
</modules>
|
20 |
|
14 |
|
15 |
<modules>
|
16 |
<Yireo_Vm2Mage>
|
17 |
+
<version>0.10.0</version>
|
18 |
</Yireo_Vm2Mage>
|
19 |
</modules>
|
20 |
|
app/code/community/Zend/XmlRpc/Server.php
DELETED
@@ -1,587 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Zend Framework
|
4 |
-
*
|
5 |
-
* LICENSE
|
6 |
-
*
|
7 |
-
* This source file is subject to the new BSD license that is bundled
|
8 |
-
* with this package in the file LICENSE.txt.
|
9 |
-
* It is also available through the world-wide-web at this URL:
|
10 |
-
* http://framework.zend.com/license/new-bsd
|
11 |
-
* If you did not receive a copy of the license and are unable to
|
12 |
-
* obtain it through the world-wide-web, please send an email
|
13 |
-
* to license@zend.com so we can send you a copy immediately.
|
14 |
-
*
|
15 |
-
* @category Zend
|
16 |
-
* @package Zend_XmlRpc
|
17 |
-
* @subpackage Server
|
18 |
-
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
19 |
-
* @license http://framework.zend.com/license/new-bsd New BSD License
|
20 |
-
* @version $Id: Server.php 13223 2008-12-14 11:21:31Z thomas $
|
21 |
-
*/
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Extends Zend_Server_Abstract
|
25 |
-
*/
|
26 |
-
#require_once 'Zend/Server/Abstract.php';
|
27 |
-
|
28 |
-
/**
|
29 |
-
* XMLRPC Request
|
30 |
-
*/
|
31 |
-
#require_once 'Zend/XmlRpc/Request.php';
|
32 |
-
|
33 |
-
/**
|
34 |
-
* XMLRPC Response
|
35 |
-
*/
|
36 |
-
#require_once 'Zend/XmlRpc/Response.php';
|
37 |
-
|
38 |
-
/**
|
39 |
-
* XMLRPC HTTP Response
|
40 |
-
*/
|
41 |
-
#require_once 'Zend/XmlRpc/Response/Http.php';
|
42 |
-
|
43 |
-
/**
|
44 |
-
* XMLRPC server fault class
|
45 |
-
*/
|
46 |
-
#require_once 'Zend/XmlRpc/Server/Fault.php';
|
47 |
-
|
48 |
-
/**
|
49 |
-
* XMLRPC server system methods class
|
50 |
-
*/
|
51 |
-
#require_once 'Zend/XmlRpc/Server/System.php';
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Convert PHP to and from xmlrpc native types
|
55 |
-
*/
|
56 |
-
#require_once 'Zend/XmlRpc/Value.php';
|
57 |
-
|
58 |
-
/**
|
59 |
-
* Reflection API for function/method introspection
|
60 |
-
*/
|
61 |
-
#require_once 'Zend/Server/Reflection.php';
|
62 |
-
|
63 |
-
/**
|
64 |
-
* Zend_Server_Reflection_Function_Abstract
|
65 |
-
*/
|
66 |
-
#require_once 'Zend/Server/Reflection/Function/Abstract.php';
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Specifically grab the Zend_Server_Reflection_Method for manually setting up
|
70 |
-
* system.* methods and handling callbacks in {@link loadFunctions()}.
|
71 |
-
*/
|
72 |
-
#require_once 'Zend/Server/Reflection/Method.php';
|
73 |
-
|
74 |
-
/**
|
75 |
-
* An XML-RPC server implementation
|
76 |
-
*
|
77 |
-
* Example:
|
78 |
-
* <code>
|
79 |
-
* #require_once 'Zend/XmlRpc/Server.php';
|
80 |
-
* #require_once 'Zend/XmlRpc/Server/Cache.php';
|
81 |
-
* #require_once 'Zend/XmlRpc/Server/Fault.php';
|
82 |
-
* #require_once 'My/Exception.php';
|
83 |
-
* #require_once 'My/Fault/Observer.php';
|
84 |
-
*
|
85 |
-
* // Instantiate server
|
86 |
-
* $server = new Zend_XmlRpc_Server();
|
87 |
-
*
|
88 |
-
* // Allow some exceptions to report as fault responses:
|
89 |
-
* Zend_XmlRpc_Server_Fault::attachFaultException('My_Exception');
|
90 |
-
* Zend_XmlRpc_Server_Fault::attachObserver('My_Fault_Observer');
|
91 |
-
*
|
92 |
-
* // Get or build dispatch table:
|
93 |
-
* if (!Zend_XmlRpc_Server_Cache::get($filename, $server)) {
|
94 |
-
* #require_once 'Some/Service/Class.php';
|
95 |
-
* #require_once 'Another/Service/Class.php';
|
96 |
-
*
|
97 |
-
* // Attach Some_Service_Class in 'some' namespace
|
98 |
-
* $server->setClass('Some_Service_Class', 'some');
|
99 |
-
*
|
100 |
-
* // Attach Another_Service_Class in 'another' namespace
|
101 |
-
* $server->setClass('Another_Service_Class', 'another');
|
102 |
-
*
|
103 |
-
* // Create dispatch table cache file
|
104 |
-
* Zend_XmlRpc_Server_Cache::save($filename, $server);
|
105 |
-
* }
|
106 |
-
*
|
107 |
-
* $response = $server->handle();
|
108 |
-
* echo $response;
|
109 |
-
* </code>
|
110 |
-
*
|
111 |
-
* @category Zend
|
112 |
-
* @package Zend_XmlRpc
|
113 |
-
* @subpackage Server
|
114 |
-
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
115 |
-
* @license http://framework.zend.com/license/new-bsd New BSD License
|
116 |
-
*/
|
117 |
-
class Zend_XmlRpc_Server extends Zend_Server_Abstract
|
118 |
-
{
|
119 |
-
/**
|
120 |
-
* Character encoding
|
121 |
-
* @var string
|
122 |
-
*/
|
123 |
-
protected $_encoding = 'UTF-8';
|
124 |
-
|
125 |
-
/**
|
126 |
-
* Request processed
|
127 |
-
* @var null|Zend_XmlRpc_Request
|
128 |
-
*/
|
129 |
-
protected $_request = null;
|
130 |
-
|
131 |
-
/**
|
132 |
-
* Class to use for responses; defaults to {@link Zend_XmlRpc_Response_Http}
|
133 |
-
* @var string
|
134 |
-
*/
|
135 |
-
protected $_responseClass = 'Zend_XmlRpc_Response_Http';
|
136 |
-
|
137 |
-
/**
|
138 |
-
* Dispatch table of name => method pairs
|
139 |
-
* @var Zend_XmlRpc_Server_ServerDefinition
|
140 |
-
*/
|
141 |
-
protected $_table;
|
142 |
-
|
143 |
-
/**
|
144 |
-
* PHP types => XML-RPC types
|
145 |
-
* @var array
|
146 |
-
*/
|
147 |
-
protected $_typeMap = array(
|
148 |
-
'i4' => 'i4',
|
149 |
-
'int' => 'int',
|
150 |
-
'integer' => 'int',
|
151 |
-
'double' => 'double',
|
152 |
-
'float' => 'double',
|
153 |
-
'real' => 'double',
|
154 |
-
'boolean' => 'boolean',
|
155 |
-
'bool' => 'boolean',
|
156 |
-
'true' => 'boolean',
|
157 |
-
'false' => 'boolean',
|
158 |
-
'string' => 'string',
|
159 |
-
'str' => 'string',
|
160 |
-
'base64' => 'base64',
|
161 |
-
'dateTime.iso8601' => 'dateTime.iso8601',
|
162 |
-
'date' => 'dateTime.iso8601',
|
163 |
-
'time' => 'dateTime.iso8601',
|
164 |
-
'time' => 'dateTime.iso8601',
|
165 |
-
'array' => 'array',
|
166 |
-
'struct' => 'struct',
|
167 |
-
'null' => 'nil',
|
168 |
-
'nil' => 'nil',
|
169 |
-
'void' => 'void',
|
170 |
-
'mixed' => 'struct'
|
171 |
-
);
|
172 |
-
|
173 |
-
/**
|
174 |
-
* Constructor
|
175 |
-
*
|
176 |
-
* Creates system.* methods.
|
177 |
-
*
|
178 |
-
* @return void
|
179 |
-
*/
|
180 |
-
public function __construct()
|
181 |
-
{
|
182 |
-
$this->_table = new Zend_Server_Definition();
|
183 |
-
$this->_registerSystemMethods();
|
184 |
-
}
|
185 |
-
|
186 |
-
/**
|
187 |
-
* Proxy calls to system object
|
188 |
-
*
|
189 |
-
* @param string $method
|
190 |
-
* @param array $params
|
191 |
-
* @return mixed
|
192 |
-
* @throws Zend_XmlRpc_Server_Exception
|
193 |
-
*/
|
194 |
-
public function __call($method, $params)
|
195 |
-
{
|
196 |
-
$system = $this->getSystem();
|
197 |
-
if (!method_exists($system, $method)) {
|
198 |
-
#require_once 'Zend/XmlRpc/Server/Exception.php';
|
199 |
-
throw new Zend_XmlRpc_Server_Exception('Unknown instance method called on server: ' . $method);
|
200 |
-
}
|
201 |
-
return call_user_func_array(array($system, $method), $params);
|
202 |
-
}
|
203 |
-
|
204 |
-
/**
|
205 |
-
* Attach a callback as an XMLRPC method
|
206 |
-
*
|
207 |
-
* Attaches a callback as an XMLRPC method, prefixing the XMLRPC method name
|
208 |
-
* with $namespace, if provided. Reflection is done on the callback's
|
209 |
-
* docblock to create the methodHelp for the XMLRPC method.
|
210 |
-
*
|
211 |
-
* Additional arguments to pass to the function at dispatch may be passed;
|
212 |
-
* any arguments following the namespace will be aggregated and passed at
|
213 |
-
* dispatch time.
|
214 |
-
*
|
215 |
-
* @param string|array $function Valid callback
|
216 |
-
* @param string $namespace Optional namespace prefix
|
217 |
-
* @return void
|
218 |
-
* @throws Zend_XmlRpc_Server_Exception
|
219 |
-
*/
|
220 |
-
public function addFunction($function, $namespace = '')
|
221 |
-
{
|
222 |
-
if (!is_string($function) && !is_array($function)) {
|
223 |
-
#require_once 'Zend/XmlRpc/Server/Exception.php';
|
224 |
-
throw new Zend_XmlRpc_Server_Exception('Unable to attach function; invalid', 611);
|
225 |
-
}
|
226 |
-
|
227 |
-
$argv = null;
|
228 |
-
if (2 < func_num_args()) {
|
229 |
-
$argv = func_get_args();
|
230 |
-
$argv = array_slice($argv, 2);
|
231 |
-
}
|
232 |
-
|
233 |
-
$function = (array) $function;
|
234 |
-
foreach ($function as $func) {
|
235 |
-
if (!is_string($func) || !function_exists($func)) {
|
236 |
-
#require_once 'Zend/XmlRpc/Server/Exception.php';
|
237 |
-
throw new Zend_XmlRpc_Server_Exception('Unable to attach function; invalid', 611);
|
238 |
-
}
|
239 |
-
$reflection = Zend_Server_Reflection::reflectFunction($func, $argv, $namespace);
|
240 |
-
$this->_buildSignature($reflection);
|
241 |
-
}
|
242 |
-
}
|
243 |
-
|
244 |
-
/**
|
245 |
-
* Attach class methods as XMLRPC method handlers
|
246 |
-
*
|
247 |
-
* $class may be either a class name or an object. Reflection is done on the
|
248 |
-
* class or object to determine the available public methods, and each is
|
249 |
-
* attached to the server as an available method; if a $namespace has been
|
250 |
-
* provided, that namespace is used to prefix the XMLRPC method names.
|
251 |
-
*
|
252 |
-
* Any additional arguments beyond $namespace will be passed to a method at
|
253 |
-
* invocation.
|
254 |
-
*
|
255 |
-
* @param string|object $class
|
256 |
-
* @param string $namespace Optional
|
257 |
-
* @param mixed $argv Optional arguments to pass to methods
|
258 |
-
* @return void
|
259 |
-
* @throws Zend_XmlRpc_Server_Exception on invalid input
|
260 |
-
*/
|
261 |
-
public function setClass($class, $namespace = '', $argv = null)
|
262 |
-
{
|
263 |
-
if (is_string($class) && !class_exists($class)) {
|
264 |
-
if (!class_exists($class)) {
|
265 |
-
#require_once 'Zend/XmlRpc/Server/Exception.php';
|
266 |
-
throw new Zend_XmlRpc_Server_Exception('Invalid method class', 610);
|
267 |
-
}
|
268 |
-
}
|
269 |
-
|
270 |
-
$argv = null;
|
271 |
-
if (3 < func_num_args()) {
|
272 |
-
$argv = func_get_args();
|
273 |
-
$argv = array_slice($argv, 3);
|
274 |
-
}
|
275 |
-
|
276 |
-
$dispatchable = Zend_Server_Reflection::reflectClass($class, $argv, $namespace);
|
277 |
-
foreach ($dispatchable->getMethods() as $reflection) {
|
278 |
-
$this->_buildSignature($reflection, $class);
|
279 |
-
}
|
280 |
-
}
|
281 |
-
|
282 |
-
/**
|
283 |
-
* Raise an xmlrpc server fault
|
284 |
-
*
|
285 |
-
* @param string|Exception $fault
|
286 |
-
* @param int $code
|
287 |
-
* @return Zend_XmlRpc_Server_Fault
|
288 |
-
*/
|
289 |
-
public function fault($fault = null, $code = 404)
|
290 |
-
{
|
291 |
-
if (!$fault instanceof Exception) {
|
292 |
-
$fault = (string) $fault;
|
293 |
-
if (empty($fault)) {
|
294 |
-
$fault = 'Unknown error';
|
295 |
-
}
|
296 |
-
#require_once 'Zend/XmlRpc/Server/Exception.php';
|
297 |
-
$fault = new Zend_XmlRpc_Server_Exception($fault, $code);
|
298 |
-
}
|
299 |
-
|
300 |
-
return Zend_XmlRpc_Server_Fault::getInstance($fault);
|
301 |
-
}
|
302 |
-
|
303 |
-
/**
|
304 |
-
* Handle an xmlrpc call
|
305 |
-
*
|
306 |
-
* @param Zend_XmlRpc_Request $request Optional
|
307 |
-
* @return Zend_XmlRpc_Response|Zend_XmlRpc_Fault
|
308 |
-
*/
|
309 |
-
public function handle($request = false)
|
310 |
-
{
|
311 |
-
// Get request
|
312 |
-
if ((!$request || !$request instanceof Zend_XmlRpc_Request)
|
313 |
-
&& (null === ($request = $this->getRequest()))
|
314 |
-
) {
|
315 |
-
#require_once 'Zend/XmlRpc/Request/Http.php';
|
316 |
-
$request = new Zend_XmlRpc_Request_Http();
|
317 |
-
$request->setEncoding($this->getEncoding());
|
318 |
-
}
|
319 |
-
|
320 |
-
$this->setRequest($request);
|
321 |
-
|
322 |
-
if ($request->isFault()) {
|
323 |
-
$response = $request->getFault();
|
324 |
-
} else {
|
325 |
-
try {
|
326 |
-
$response = $this->_handle($request);
|
327 |
-
} catch (Exception $e) {
|
328 |
-
$response = $this->fault($e);
|
329 |
-
}
|
330 |
-
}
|
331 |
-
|
332 |
-
// Set output encoding
|
333 |
-
$response->setEncoding($this->getEncoding());
|
334 |
-
|
335 |
-
return $response;
|
336 |
-
}
|
337 |
-
|
338 |
-
/**
|
339 |
-
* Load methods as returned from {@link getFunctions}
|
340 |
-
*
|
341 |
-
* Typically, you will not use this method; it will be called using the
|
342 |
-
* results pulled from {@link Zend_XmlRpc_Server_Cache::get()}.
|
343 |
-
*
|
344 |
-
* @param array|Zend_Server_Definition $definition
|
345 |
-
* @return void
|
346 |
-
* @throws Zend_XmlRpc_Server_Exception on invalid input
|
347 |
-
*/
|
348 |
-
public function loadFunctions($definition)
|
349 |
-
{
|
350 |
-
if (!is_array($definition) && (!$definition instanceof Zend_Server_Definition)) {
|
351 |
-
if (is_object($definition)) {
|
352 |
-
$type = get_class($definition);
|
353 |
-
} else {
|
354 |
-
$type = gettype($definition);
|
355 |
-
}
|
356 |
-
#require_once 'Zend/XmlRpc/Server/Exception.php';
|
357 |
-
throw new Zend_XmlRpc_Server_Exception('Unable to load server definition; must be an array or Zend_Server_Definition, received ' . $type, 612);
|
358 |
-
}
|
359 |
-
|
360 |
-
$this->_table->clearMethods();
|
361 |
-
$this->_registerSystemMethods();
|
362 |
-
|
363 |
-
if ($definition instanceof Zend_Server_Definition) {
|
364 |
-
$definition = $definition->getMethods();
|
365 |
-
}
|
366 |
-
|
367 |
-
foreach ($definition as $key => $method) {
|
368 |
-
if ('system.' == substr($key, 0, 7)) {
|
369 |
-
continue;
|
370 |
-
}
|
371 |
-
$this->_table->addMethod($method, $key);
|
372 |
-
}
|
373 |
-
}
|
374 |
-
|
375 |
-
/**
|
376 |
-
* Set encoding
|
377 |
-
*
|
378 |
-
* @param string $encoding
|
379 |
-
* @return Zend_XmlRpc_Server
|
380 |
-
*/
|
381 |
-
public function setEncoding($encoding)
|
382 |
-
{
|
383 |
-
$this->_encoding = $encoding;
|
384 |
-
return $this;
|
385 |
-
}
|
386 |
-
|
387 |
-
/**
|
388 |
-
* Retrieve current encoding
|
389 |
-
*
|
390 |
-
* @return string
|
391 |
-
*/
|
392 |
-
public function getEncoding()
|
393 |
-
{
|
394 |
-
return $this->_encoding;
|
395 |
-
}
|
396 |
-
|
397 |
-
/**
|
398 |
-
* Do nothing; persistence is handled via {@link Zend_XmlRpc_Server_Cache}
|
399 |
-
*
|
400 |
-
* @param mixed $mode
|
401 |
-
* @return void
|
402 |
-
*/
|
403 |
-
public function setPersistence($mode)
|
404 |
-
{
|
405 |
-
}
|
406 |
-
|
407 |
-
/**
|
408 |
-
* Set the request object
|
409 |
-
*
|
410 |
-
* @param string|Zend_XmlRpc_Request $request
|
411 |
-
* @return Zend_XmlRpc_Server
|
412 |
-
* @throws Zend_XmlRpc_Server_Exception on invalid request class or object
|
413 |
-
*/
|
414 |
-
public function setRequest($request)
|
415 |
-
{
|
416 |
-
if (is_string($request) && class_exists($request)) {
|
417 |
-
$request = new $request();
|
418 |
-
if (!$request instanceof Zend_XmlRpc_Request) {
|
419 |
-
#require_once 'Zend/XmlRpc/Server/Exception.php';
|
420 |
-
throw new Zend_XmlRpc_Server_Exception('Invalid request class');
|
421 |
-
}
|
422 |
-
$request->setEncoding($this->getEncoding());
|
423 |
-
} elseif (!$request instanceof Zend_XmlRpc_Request) {
|
424 |
-
#require_once 'Zend/XmlRpc/Server/Exception.php';
|
425 |
-
throw new Zend_XmlRpc_Server_Exception('Invalid request object');
|
426 |
-
}
|
427 |
-
|
428 |
-
$this->_request = $request;
|
429 |
-
return $this;
|
430 |
-
}
|
431 |
-
|
432 |
-
/**
|
433 |
-
* Return currently registered request object
|
434 |
-
*
|
435 |
-
* @return null|Zend_XmlRpc_Request
|
436 |
-
*/
|
437 |
-
public function getRequest()
|
438 |
-
{
|
439 |
-
return $this->_request;
|
440 |
-
}
|
441 |
-
|
442 |
-
/**
|
443 |
-
* Set the class to use for the response
|
444 |
-
*
|
445 |
-
* @param string $class
|
446 |
-
* @return boolean True if class was set, false if not
|
447 |
-
*/
|
448 |
-
public function setResponseClass($class)
|
449 |
-
{
|
450 |
-
if (class_exists($class)) {
|
451 |
-
$reflection = new ReflectionClass($class);
|
452 |
-
if ($reflection->isSubclassOf(new ReflectionClass('Zend_XmlRpc_Response'))) {
|
453 |
-
$this->_responseClass = $class;
|
454 |
-
return true;
|
455 |
-
}
|
456 |
-
}
|
457 |
-
|
458 |
-
return false;
|
459 |
-
}
|
460 |
-
|
461 |
-
/**
|
462 |
-
* Retrieve current response class
|
463 |
-
*
|
464 |
-
* @return string
|
465 |
-
*/
|
466 |
-
public function getResponseClass()
|
467 |
-
{
|
468 |
-
return $this->_responseClass;
|
469 |
-
}
|
470 |
-
|
471 |
-
/**
|
472 |
-
* Retrieve dispatch table
|
473 |
-
*
|
474 |
-
* @return array
|
475 |
-
*/
|
476 |
-
public function getDispatchTable()
|
477 |
-
{
|
478 |
-
return $this->_table;
|
479 |
-
}
|
480 |
-
|
481 |
-
/**
|
482 |
-
* Returns a list of registered methods
|
483 |
-
*
|
484 |
-
* Returns an array of dispatchables (Zend_Server_Reflection_Function,
|
485 |
-
* _Method, and _Class items).
|
486 |
-
*
|
487 |
-
* @return array
|
488 |
-
*/
|
489 |
-
public function getFunctions()
|
490 |
-
{
|
491 |
-
return $this->_table->toArray();
|
492 |
-
}
|
493 |
-
|
494 |
-
/**
|
495 |
-
* Retrieve system object
|
496 |
-
*
|
497 |
-
* @return Zend_XmlRpc_Server_System
|
498 |
-
*/
|
499 |
-
public function getSystem()
|
500 |
-
{
|
501 |
-
return $this->_system;
|
502 |
-
}
|
503 |
-
|
504 |
-
/**
|
505 |
-
* Map PHP type to XML-RPC type
|
506 |
-
*
|
507 |
-
* @param string $type
|
508 |
-
* @return string
|
509 |
-
*/
|
510 |
-
protected function _fixType($type)
|
511 |
-
{
|
512 |
-
if (isset($this->_typeMap[$type])) {
|
513 |
-
return $this->_typeMap[$type];
|
514 |
-
}
|
515 |
-
return 'void';
|
516 |
-
}
|
517 |
-
|
518 |
-
/**
|
519 |
-
* Handle an xmlrpc call (actual work)
|
520 |
-
*
|
521 |
-
* @param Zend_XmlRpc_Request $request
|
522 |
-
* @return Zend_XmlRpc_Response
|
523 |
-
* @throws Zend_XmlRpcServer_Exception|Exception
|
524 |
-
* Zend_XmlRpcServer_Exceptions are thrown for internal errors; otherwise,
|
525 |
-
* any other exception may be thrown by the callback
|
526 |
-
*/
|
527 |
-
protected function _handle(Zend_XmlRpc_Request $request)
|
528 |
-
{
|
529 |
-
$method = $request->getMethod();
|
530 |
-
|
531 |
-
// Check for valid method
|
532 |
-
if (!$this->_table->hasMethod($method)) {
|
533 |
-
#require_once 'Zend/XmlRpc/Server/Exception.php';
|
534 |
-
throw new Zend_XmlRpc_Server_Exception('Method "' . $method . '" does not exist', 620);
|
535 |
-
}
|
536 |
-
|
537 |
-
$info = $this->_table->getMethod($method);
|
538 |
-
$params = $request->getParams();
|
539 |
-
$argv = $info->getInvokeArguments();
|
540 |
-
if (0 < count($argv)) {
|
541 |
-
$params = array_merge($params, $argv);
|
542 |
-
}
|
543 |
-
|
544 |
-
// Check calling parameters against signatures
|
545 |
-
$matched = false;
|
546 |
-
$sigCalled = $request->getTypes();
|
547 |
-
|
548 |
-
$sigLength = count($sigCalled);
|
549 |
-
$paramsLen = count($params);
|
550 |
-
if ($sigLength < $paramsLen) {
|
551 |
-
for ($i = $sigLength; $i < $paramsLen; ++$i) {
|
552 |
-
$xmlRpcValue = Zend_XmlRpc_Value::getXmlRpcValue($params[$i]);
|
553 |
-
$sigCalled[] = $xmlRpcValue->getType();
|
554 |
-
}
|
555 |
-
}
|
556 |
-
|
557 |
-
$signatures = $info->getPrototypes();
|
558 |
-
foreach ($signatures as $signature) {
|
559 |
-
$sigParams = $signature->getParameters();
|
560 |
-
if ($sigCalled === $sigParams) {
|
561 |
-
$matched = true;
|
562 |
-
break;
|
563 |
-
}
|
564 |
-
}
|
565 |
-
// Mod by Yireo: Remove signature-matching for troublesome environments
|
566 |
-
/*if (!$matched) {
|
567 |
-
#require_once 'Zend/XmlRpc/Server/Exception.php';
|
568 |
-
throw new Zend_XmlRpc_Server_Exception('Calling parameters do not match signature', 623);
|
569 |
-
}*/
|
570 |
-
|
571 |
-
$return = $this->_dispatch($info, $params);
|
572 |
-
$responseClass = $this->getResponseClass();
|
573 |
-
return new $responseClass($return);
|
574 |
-
}
|
575 |
-
|
576 |
-
/**
|
577 |
-
* Register system methods with the server
|
578 |
-
*
|
579 |
-
* @return void
|
580 |
-
*/
|
581 |
-
protected function _registerSystemMethods()
|
582 |
-
{
|
583 |
-
$system = new Zend_XmlRpc_Server_System($this);
|
584 |
-
$this->_system = $system;
|
585 |
-
$this->setClass($system, 'system');
|
586 |
-
}
|
587 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/adminhtml/default/default/template/vm2mage/check.phtml
CHANGED
@@ -21,6 +21,7 @@
|
|
21 |
<?php foreach($this->getChecks() as $group => $checks) { ?>
|
22 |
<?php if($group == 'conf') $title = 'Magento Configuration'; ?>
|
23 |
<?php if($group == 'system') $title = 'Hosting Requirements'; ?>
|
|
|
24 |
<div class="entry-edit">
|
25 |
<div class="entry-edit-head">
|
26 |
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__($title); ?></h4>
|
21 |
<?php foreach($this->getChecks() as $group => $checks) { ?>
|
22 |
<?php if($group == 'conf') $title = 'Magento Configuration'; ?>
|
23 |
<?php if($group == 'system') $title = 'Hosting Requirements'; ?>
|
24 |
+
<?php if($group == 'stats') $title = 'Statistics'; ?>
|
25 |
<div class="entry-edit">
|
26 |
<div class="entry-edit-head">
|
27 |
<h4 class="icon-head head-edit-form fieldset-legend"><?php echo $this->__($title); ?></h4>
|
package.xml
CHANGED
@@ -1,120 +1,18 @@
|
|
1 |
-
<?xml version="1.0"
|
2 |
<package>
|
3 |
<name>Yireo_Vm2Mage</name>
|
4 |
-
<version>0.
|
5 |
<stability>stable</stability>
|
|
|
6 |
<channel>community</channel>
|
7 |
-
<
|
8 |
-
<summary>
|
9 |
-
<description>
|
10 |
-
<notes>
|
11 |
-
<
|
12 |
-
<
|
13 |
-
<
|
14 |
-
|
15 |
-
<name>Yireo</name>
|
16 |
-
<user>yireo</user>
|
17 |
-
<email>info@yireo.com</email>
|
18 |
-
</author>
|
19 |
-
</authors>
|
20 |
-
|
21 |
-
<contents>
|
22 |
-
<target name="mageskin">
|
23 |
-
<dir name="adminhtml">
|
24 |
-
<dir name="default">
|
25 |
-
<dir name="default">
|
26 |
-
<dir name="images">
|
27 |
-
<dir name="vm2mage">
|
28 |
-
<file name="check-ok.png" />
|
29 |
-
<file name="check-warning.png" />
|
30 |
-
<file name="check-error.png" />
|
31 |
-
</dir>
|
32 |
-
</dir>
|
33 |
-
</dir>
|
34 |
-
</dir>
|
35 |
-
</dir>
|
36 |
-
</target>
|
37 |
-
<target name="magedesign">
|
38 |
-
<dir name="adminhtml">
|
39 |
-
<dir name="default">
|
40 |
-
<dir name="default">
|
41 |
-
<dir name="template">
|
42 |
-
<dir name="vm2mage">
|
43 |
-
<file name="check.phtml" />
|
44 |
-
</dir>
|
45 |
-
</dir>
|
46 |
-
</dir>
|
47 |
-
</dir>
|
48 |
-
</dir>
|
49 |
-
</target>
|
50 |
-
<target name="magecommunity">
|
51 |
-
<dir name="Zend">
|
52 |
-
<dir name="XmlRpc">
|
53 |
-
<file name="Server.php" />
|
54 |
-
</dir>
|
55 |
-
</dir>
|
56 |
-
<dir name="Yireo">
|
57 |
-
<dir name="Vm2Mage">
|
58 |
-
<dir name="Block">
|
59 |
-
<file name="Check.php" />
|
60 |
-
</dir>
|
61 |
-
<dir name="controllers">
|
62 |
-
<file name="IndexController.php" />
|
63 |
-
</dir>
|
64 |
-
<dir name="etc">
|
65 |
-
<file name="api.xml" />
|
66 |
-
<file name="config.xml" />
|
67 |
-
</dir>
|
68 |
-
<dir name="Helper">
|
69 |
-
<file name="Attribute.php" />
|
70 |
-
<file name="Category.php" />
|
71 |
-
<file name="Data.php" />
|
72 |
-
<file name="Image.php" />
|
73 |
-
<file name="Price.php" />
|
74 |
-
<file name="Product.php" />
|
75 |
-
</dir>
|
76 |
-
<dir name="sql">
|
77 |
-
<dir name="vm2mage_setup">
|
78 |
-
<file name="mysql4-install-0.5.4.php" />
|
79 |
-
</dir>
|
80 |
-
</dir>
|
81 |
-
<dir name="Model">
|
82 |
-
<file name="Observer.php" />
|
83 |
-
<dir name="Attribute">
|
84 |
-
<file name="Api.php" />
|
85 |
-
</dir>
|
86 |
-
<dir name="Category">
|
87 |
-
<file name="Api.php" />
|
88 |
-
</dir>
|
89 |
-
<dir name="Order">
|
90 |
-
<file name="Api.php" />
|
91 |
-
</dir>
|
92 |
-
<dir name="Product">
|
93 |
-
<file name="Api.php" />
|
94 |
-
</dir>
|
95 |
-
<dir name="User">
|
96 |
-
<file name="Api.php" />
|
97 |
-
</dir>
|
98 |
-
<dir name="Widget">
|
99 |
-
<file name="Api.php" />
|
100 |
-
</dir>
|
101 |
-
</dir>
|
102 |
-
</dir>
|
103 |
-
</dir>
|
104 |
-
</target>
|
105 |
-
<target name="mageetc">
|
106 |
-
<dir name="modules">
|
107 |
-
<file name="Yireo_Vm2Mage.xml" />
|
108 |
-
</dir>
|
109 |
-
</target>
|
110 |
-
</contents>
|
111 |
<compatible/>
|
112 |
-
<dependencies>
|
113 |
-
<required>
|
114 |
-
<php>
|
115 |
-
<min>5.2.8</min>
|
116 |
-
<max>6.0.0</max>
|
117 |
-
</php>
|
118 |
-
</required>
|
119 |
-
</dependencies>
|
120 |
</package>
|
1 |
+
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Yireo_Vm2Mage</name>
|
4 |
+
<version>0.10.0</version>
|
5 |
<stability>stable</stability>
|
6 |
+
<license>Open Source License</license>
|
7 |
<channel>community</channel>
|
8 |
+
<extends/>
|
9 |
+
<summary>Migrates data from VirtueMart to Magento</summary>
|
10 |
+
<description>Migrates data from VirtueMart to Magento</description>
|
11 |
+
<notes>Migrates data from VirtueMart to Magento</notes>
|
12 |
+
<authors><author><name>Yireo</name><user>yireo</user><email>info@yireo.com</email></author></authors>
|
13 |
+
<date>2013-02-26</date>
|
14 |
+
<time>09:15:07</time>
|
15 |
+
<contents><target name="mageetc"><dir name="modules"><file name="Yireo_Vm2Mage.xml" hash="bee76713ff8df9db330a8385b2465041"/></dir></target><target name="magecommunity"><dir name="Yireo"><dir name="Vm2Mage"><dir name="Block"><file name="Check.php" hash="dae596a80acf62fd798cafec13a05584"/></dir><dir name="Helper"><file name="Attribute.php" hash="d73a26b0540348e8ad35f1e6a5789c87"/><file name="Category.php" hash="7d8311ec4cc146ef7ac9fa477cad05bc"/><file name="Data.php" hash="7184457a80bb2a974753d6bba7e045b9"/><file name="Image.php" hash="7374dddacd4ac0c6b71a34ad6904e243"/><file name="Price.php" hash="c21f7e2106c2f818fcc363349e727b9b"/><file name="Product.php" hash="8b1804224432971d11d73ce993fd49d3"/><file name="Product.php.old" hash="be8e09d7fd14e1f054dd540c26da6542"/></dir><dir name="Model"><dir name="Attribute"><file name="Api.php" hash="5774987d0db27eb1c587e7ed814afc68"/></dir><dir name="Category"><file name="Api.php" hash="0cd640c547cc6b141320f98932948105"/></dir><file name="Observer.php" hash="cdee87eb6b9b6904f00b1440b2517ba3"/><dir name="Order"><file name="Api.php" hash="6031c65939565544cec8553a6ce6f6a0"/></dir><dir name="Product"><file name="Api.php" hash="615e10c79dfa333680bca5e3110c50f9"/></dir><dir name="User"><file name="Api.php" hash="bff5f2b63aa610533bf3acc711a2368c"/></dir><dir name="Widget"><file name="Api.php" hash="e1e93c3125e6f45a62c20faf2543df65"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="37eacaa1353bf798ba0d1a98e27d3fc4"/></dir><dir name="etc"><file name="api.xml" hash="9f11bf6ce08e658064fa06ae577dab61"/><file name="config.old" hash="32c8c8682c10d08fa11fc422ee29972d"/><file name="config.xml" hash="95769a56eb659528a597dd39d0b9010f"/></dir><dir name="sql"><dir name="vm2mage_setup"><file name="mysql4-install-0.5.4.php" hash="7897eff4982379777523254b6e37b90a"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="vm2mage"><file name="check.phtml" hash="3e8e7562214ddb2d3c52f7f9c3e87ed2"/></dir></dir></dir></dir></dir></target></contents>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
<compatible/>
|
17 |
+
<dependencies><required><php><min>5.2.8</min><max>6.0.0</max></php></required></dependencies>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
</package>
|
skin/adminhtml/default/default/images/vm2mage/check-error.png
DELETED
Binary file
|
skin/adminhtml/default/default/images/vm2mage/check-ok.png
DELETED
Binary file
|
skin/adminhtml/default/default/images/vm2mage/check-warning.png
DELETED
Binary file
|