Version Notes
Set bigger time limit at install
Download this release
Release Info
Developer | Moshe |
Extension | Wisepricer_Syncer |
Version | 1.3.0.0 |
Comparing to | |
See all releases |
Code changes from version 1.2.0.1 to 1.3.0.0
- app/code/local/Wisepricer/Syncer/Block/Adminhtml/Mapping.php +2 -2
- app/code/local/Wisepricer/Syncer/Helper/Data.php +119 -2
- app/code/local/Wisepricer/Syncer/Model/Reprice.php +61 -74
- app/code/local/Wisepricer/Syncer/controllers/Adminhtml/SyncerController.php +25 -19
- app/code/local/Wisepricer/Syncer/controllers/ProductsController.php +137 -69
- app/code/local/Wisepricer/Syncer/etc/config.xml +3 -3
- app/code/local/Wisepricer/Syncer/sql/syncer_setup/mysql4-install-1.1.3.8.php +4 -2
- app/code/local/Wisepricer/Syncer/sql/syncer_setup/mysql4-upgrade-1.1.3.8-1.1.3.9.php +0 -35
- app/code/local/Wisepricer/Syncer/sql/syncer_setup/mysql4-upgrade-1.1.3.9-1.1.4.1.php +0 -12
- app/code/local/Wisepricer/Syncer/sql/syncer_setup/mysql4-upgrade-1.1.4.1-1.1.4.2.php +0 -65
- app/code/local/Wisepricer/Syncer/sql/syncer_setup/mysql4-upgrade-1.1.4.6-1.1.4.7.php +1 -1
- app/code/local/Wisepricer/Syncer/sql/syncer_setup/mysql4-upgrade-1.1.4.7-1.1.4.8.php +28 -0
- app/design/adminhtml/default/default/template/wisepricer/mapping.phtml +16 -1
- app/etc/modules/Wisepricer_Syncer.xml +0 -14
- package.xml +6 -6
app/code/local/Wisepricer/Syncer/Block/Adminhtml/Mapping.php
CHANGED
@@ -175,7 +175,7 @@ class Wisepricer_Syncer_Block_Adminhtml_Mapping extends Mage_Adminhtml_Block_Wid
|
|
175 |
$websites = $switcher->getWebsites();
|
176 |
|
177 |
$options=array();
|
178 |
-
$options[]=array('label'=>'All','value'=>
|
179 |
foreach($websites as $website){
|
180 |
foreach($website->getGroups() as $group){
|
181 |
|
@@ -235,7 +235,7 @@ class Wisepricer_Syncer_Block_Adminhtml_Mapping extends Mage_Adminhtml_Block_Wid
|
|
235 |
public function getImportOutStockSet(){
|
236 |
$model = Mage::getModel('wisepricer_syncer/config');
|
237 |
$lisenceData=$model->load(1);
|
238 |
-
if($lisenceData->getImport_outofstock()
|
239 |
return 'checked';
|
240 |
}else{
|
241 |
return '';
|
175 |
$websites = $switcher->getWebsites();
|
176 |
|
177 |
$options=array();
|
178 |
+
$options[]=array('label'=>'All','value'=>770);
|
179 |
foreach($websites as $website){
|
180 |
foreach($website->getGroups() as $group){
|
181 |
|
235 |
public function getImportOutStockSet(){
|
236 |
$model = Mage::getModel('wisepricer_syncer/config');
|
237 |
$lisenceData=$model->load(1);
|
238 |
+
if($lisenceData->getImport_outofstock()=='0'){
|
239 |
return 'checked';
|
240 |
}else{
|
241 |
return '';
|
app/code/local/Wisepricer/Syncer/Helper/Data.php
CHANGED
@@ -2,10 +2,127 @@
|
|
2 |
|
3 |
|
4 |
|
5 |
-
class Wisepricer_Syncer_Helper_Data extends Mage_Core_Helper_Abstract
|
6 |
|
7 |
-
{
|
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
|
|
|
|
|
|
|
10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
11 |
}
|
2 |
|
3 |
|
4 |
|
5 |
+
class Wisepricer_Syncer_Helper_Data extends Mage_Core_Helper_Abstract{
|
6 |
|
7 |
+
public function getConfigDataByFullPath($path){
|
8 |
|
9 |
+
if (!$row = Mage::getSingleton('core/config_data')->getCollection()->getItemByColumnValue('path', $path)) {
|
10 |
+
$conf = Mage::getSingleton('core/config')->init()->getXpath('/config/default/'.$path);
|
11 |
+
if(is_array($conf)){
|
12 |
+
$value = array_shift($conf);
|
13 |
+
}else{
|
14 |
+
return '';
|
15 |
+
}
|
16 |
|
17 |
+
} else {
|
18 |
+
$value = $row->getValue();
|
19 |
+
}
|
20 |
|
21 |
+
return $value;
|
22 |
+
|
23 |
+
}
|
24 |
+
|
25 |
+
public function getConfigMultiDataByFullPath($path){
|
26 |
+
|
27 |
+
if (!$rows = Mage::getSingleton('core/config_data')->getCollection()->getItemsByColumnValue('path', $path)) {
|
28 |
+
$conf = Mage::getSingleton('core/config')->init()->getXpath('/config/default/'.$path);
|
29 |
+
$value = array_shift($conf);
|
30 |
+
} else {
|
31 |
+
$values=array();
|
32 |
+
foreach($rows as $row){
|
33 |
+
$values[$row->getScopeId()]=$row->getValue();
|
34 |
+
}
|
35 |
+
}
|
36 |
+
|
37 |
+
return $values;
|
38 |
+
|
39 |
+
}
|
40 |
+
|
41 |
+
public function getMultiStoreDataJson(){
|
42 |
+
|
43 |
+
$websites=Mage::getModel('core/website')->getCollection();
|
44 |
+
|
45 |
+
$multistoreData=array();
|
46 |
+
$multistoreJson='';
|
47 |
+
$useStoreCode=$this->getConfigDataByFullPath('web/url/use_store');
|
48 |
+
$mage=Mage::getVersion();
|
49 |
+
$ext=(string) Mage::getConfig()->getNode()->modules->Wisepricer_Syncer->version;
|
50 |
+
$version=array('mage'=>$mage,'ext'=>$ext);
|
51 |
+
|
52 |
+
//getting site url
|
53 |
+
$url=$this->getConfigDataByFullPath('web/unsecure/base_url');
|
54 |
+
|
55 |
+
$storesArr=array();
|
56 |
+
foreach($websites as $website){
|
57 |
+
$code=$website->getCode();
|
58 |
+
$stores=$website->getStores();
|
59 |
+
foreach($stores as $store){
|
60 |
+
$storesArr[$store->getStoreId()]=$store->getData();
|
61 |
+
}
|
62 |
+
}
|
63 |
+
|
64 |
+
if(count($storesArr)==1){
|
65 |
+
try{
|
66 |
+
$dataArr = array(
|
67 |
+
// 'stores' => array(array_pop($storesArr)),
|
68 |
+
'stores' => array_pop($storesArr),
|
69 |
+
'version' => $version
|
70 |
+
);
|
71 |
+
} catch (Exception $e){
|
72 |
+
$dataArr = array(
|
73 |
+
'stores' => $multistoreData,
|
74 |
+
'version' => $version
|
75 |
+
);
|
76 |
+
}
|
77 |
+
|
78 |
+
$dataArr['site'] = $url;
|
79 |
+
$multistoreJson = json_encode($dataArr);
|
80 |
+
|
81 |
+
}else{
|
82 |
+
|
83 |
+
$storeUrls=$this->getConfigMultiDataByFullPath('web/unsecure/base_url');
|
84 |
+
$locales=$this->getConfigMultiDataByFullPath('general/locale/code');
|
85 |
+
$storeComplete=array();
|
86 |
+
|
87 |
+
foreach($storesArr as $key=>$value){
|
88 |
+
|
89 |
+
if(!$value['is_active']){
|
90 |
+
continue;
|
91 |
+
}
|
92 |
+
|
93 |
+
$storeComplete=$value;
|
94 |
+
if(array_key_exists($key,$locales)){
|
95 |
+
$storeComplete['lang']=$locales[$key];
|
96 |
+
}else{
|
97 |
+
$storeComplete['lang']=$locales[0];
|
98 |
+
}
|
99 |
+
|
100 |
+
if(array_key_exists($key,$storeUrls)){
|
101 |
+
$storeComplete['url']=$storeUrls[$key];
|
102 |
+
}else{
|
103 |
+
$storeComplete['url']=$storeUrls[0];
|
104 |
+
}
|
105 |
+
|
106 |
+
if($useStoreCode){
|
107 |
+
$storeComplete['url']=$storeUrls[0].$value['code'];
|
108 |
+
}
|
109 |
+
|
110 |
+
$multistoreData[]=$storeComplete;
|
111 |
+
}
|
112 |
+
|
113 |
+
$dataArr=array(
|
114 |
+
'stores'=>$multistoreData,
|
115 |
+
'version'=>$version
|
116 |
+
);
|
117 |
+
|
118 |
+
$dataArr['site']=$url;
|
119 |
+
|
120 |
+
$multistoreJson=json_encode($dataArr);
|
121 |
+
|
122 |
+
}
|
123 |
+
|
124 |
+
Mage::log($multistoreJson,null,'wplog.log');
|
125 |
+
|
126 |
+
return $multistoreJson;
|
127 |
+
}
|
128 |
}
|
app/code/local/Wisepricer/Syncer/Model/Reprice.php
CHANGED
@@ -29,7 +29,7 @@ class Wisepricer_Syncer_Model_Reprice extends Mage_Core_Model_Abstract{
|
|
29 |
return $connection->fetchOne($sql, array($entity_type_code));
|
30 |
}
|
31 |
|
32 |
-
|
33 |
$connection = $this->_getConnection('core_read');
|
34 |
$sql = "SELECT entity_id FROM " . $this->_getTableName('catalog_product_entity') . " WHERE sku = ?";
|
35 |
return $connection->fetchOne($sql, array($sku));
|
@@ -78,97 +78,84 @@ class Wisepricer_Syncer_Model_Reprice extends Mage_Core_Model_Abstract{
|
|
78 |
}
|
79 |
}
|
80 |
|
81 |
-
public function
|
|
|
82 |
$connection = $this->_getConnection('core_write');
|
83 |
|
84 |
if(!is_array($prodArr)){
|
85 |
-
$
|
86 |
-
$newPrice = $prodArr->price;
|
87 |
}else{
|
88 |
-
$
|
89 |
-
$newPrice = $prodArr['price'];
|
90 |
-
}
|
91 |
-
try{
|
92 |
-
$productId = $this->_getIdFromSku($sku);
|
93 |
-
$attributeId = $this->_getAttributeId($price_field);
|
94 |
-
$spAttributeId = $this->_getAttributeId('special_price');
|
95 |
-
$specialPrice = $this->_getSpecialPrice($productId,$spAttributeId);
|
96 |
-
|
97 |
-
if($specialPrice){
|
98 |
-
$attributeId= $spAttributeId;
|
99 |
}
|
100 |
|
101 |
-
|
102 |
-
throw new Exception("Price [$newPrice] is invalid Product Id: $productId");
|
103 |
-
}
|
104 |
-
|
105 |
-
$sql = "UPDATE " . $this->_getTableName('catalog_product_entity_decimal') . " cped
|
106 |
-
SET cped.value = ?
|
107 |
-
WHERE cped.attribute_id = ?
|
108 |
-
AND cped.entity_id = ?";
|
109 |
-
$connection->query($sql, array($newPrice, $attributeId, $productId));
|
110 |
-
$this->_getConfigurableIds($productId, $newPrice);
|
111 |
-
|
112 |
-
}catch(Exception $e){
|
113 |
-
Mage::log($e->getMessage(),null,'wplog.log');
|
114 |
-
echo $e->getMessage();
|
115 |
-
}
|
116 |
-
}
|
117 |
|
118 |
-
|
119 |
-
$connection = $this->_getConnection('core_write');
|
120 |
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
$productId = $prodArr['sku'];
|
126 |
-
$newPrice = $prodArr['price'];
|
127 |
-
}
|
128 |
-
try{
|
129 |
-
$attributeId = $this->_getAttributeId($price_field);
|
130 |
|
131 |
-
|
132 |
-
$specialPrice = $this->_getSpecialPrice($productId,$spAttributeId);
|
133 |
|
134 |
-
|
135 |
-
$attributeId= $spAttributeId;
|
136 |
-
}
|
137 |
|
138 |
-
|
139 |
-
throw new Exception("Price [$newPrice] is invalid Product Id: $productId");
|
140 |
-
}
|
141 |
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
AND cped.entity_id = ?";
|
146 |
-
$connection->query($sql, array($newPrice, $attributeId, $productId));
|
147 |
-
$this->_getConfigurableIds($productId, $newPrice);
|
148 |
|
149 |
-
|
150 |
-
Mage::log($e->getMessage(),null,'wplog.log');
|
151 |
-
echo $e->getMessage();
|
152 |
-
}
|
153 |
-
}
|
154 |
|
155 |
-
|
156 |
-
|
157 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
|
159 |
-
|
160 |
-
|
161 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
|
163 |
-
if($oldPrice <= $newPrice){
|
164 |
-
throw new Exception("New price is larger or equal to old price Product Id: $productId");
|
165 |
}
|
|
|
|
|
166 |
|
167 |
-
|
168 |
-
|
169 |
-
$prodArr['price'] = $newPrice;
|
170 |
-
$this->updatePricesById($prodArr, $priceField);
|
171 |
-
return $newPrice;
|
172 |
}
|
173 |
|
174 |
private function getProductPrice($product){
|
29 |
return $connection->fetchOne($sql, array($entity_type_code));
|
30 |
}
|
31 |
|
32 |
+
public function getIdFromSku($sku){
|
33 |
$connection = $this->_getConnection('core_read');
|
34 |
$sql = "SELECT entity_id FROM " . $this->_getTableName('catalog_product_entity') . " WHERE sku = ?";
|
35 |
return $connection->fetchOne($sql, array($sku));
|
78 |
}
|
79 |
}
|
80 |
|
81 |
+
public function updatePricesById($prodArr,$entityTypeId,$store_id,$mappings){
|
82 |
+
|
83 |
$connection = $this->_getConnection('core_write');
|
84 |
|
85 |
if(!is_array($prodArr)){
|
86 |
+
$productId = $prodArr->sku;
|
|
|
87 |
}else{
|
88 |
+
$productId = $prodArr['sku'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
}
|
90 |
|
91 |
+
$sql='';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
|
93 |
+
foreach($prodArr as $pricesName=>$priceValue){
|
|
|
94 |
|
95 |
+
try{
|
96 |
+
if($pricesName=='sku'){
|
97 |
+
continue;
|
98 |
+
}
|
|
|
|
|
|
|
|
|
|
|
99 |
|
100 |
+
$mPriceName=isset($mappings[$pricesName])? $mappings[$pricesName]['magento_field'] : '';
|
|
|
101 |
|
102 |
+
$attributeId = $this->_getAttributeId($mPriceName);
|
|
|
|
|
103 |
|
104 |
+
if(!$attributeId){
|
|
|
|
|
105 |
|
106 |
+
Mage::log('Product '.$productId.', could not find field '.$pricesName,null,'wplog.log');
|
107 |
+
continue;
|
108 |
+
}
|
|
|
|
|
|
|
109 |
|
110 |
+
if($priceValue == 0 || $pricesName==''){
|
|
|
|
|
|
|
|
|
111 |
|
112 |
+
if($mPriceName=='price'){
|
113 |
+
throw new Exception("Price [$priceValue] is invalid Product Id: $productId");
|
114 |
+
}else{
|
115 |
+
$sql="DELETE FROM " . $this->_getTableName('catalog_product_entity_decimal') . " WHERE entity_type_id=? AND attribute_id=? AND store_id=? AND entity_id=?";
|
116 |
+
|
117 |
+
$res=$connection->query($sql, array($entityTypeId, $attributeId,$store_id,$productId));
|
118 |
+
}
|
119 |
+
|
120 |
+
}else{
|
121 |
+
|
122 |
+
$sql="SELECT value_id FROM ".$this->_getTableName('catalog_product_entity_decimal')
|
123 |
+
." WHERE attribute_id=? AND entity_id=? AND store_id=?";
|
124 |
+
|
125 |
+
$res=$connection->fetchOne($sql, array($attributeId,$productId,$store_id));
|
126 |
+
|
127 |
+
if(!is_numeric($res)){
|
128 |
+
$sql="INSERT INTO " . $this->_getTableName('catalog_product_entity_decimal') . "
|
129 |
+
(entity_type_id,attribute_id,store_id,entity_id,value)
|
130 |
+
VALUES (?,?,?,?,?)";
|
131 |
+
|
132 |
+
$res=$connection->query($sql, array($entityTypeId, $attributeId,$store_id,$productId,$priceValue));
|
133 |
|
134 |
+
}else{
|
135 |
+
$sql = "UPDATE " . $this->_getTableName('catalog_product_entity_decimal') . " cped
|
136 |
+
SET cped.value = {$priceValue}
|
137 |
+
WHERE cped.attribute_id = {$attributeId}
|
138 |
+
AND cped.entity_id = {$productId}";
|
139 |
+
//if($attributeId=='76') {echo $sql; die;}
|
140 |
+
$res=$connection->query($sql);
|
141 |
+
}
|
142 |
+
}
|
143 |
+
|
144 |
+
|
145 |
+
|
146 |
+
}catch(Exception $e){
|
147 |
+
Mage::log($e->getMessage(),null,'wplog.log');
|
148 |
+
|
149 |
+
// echo $sql;
|
150 |
+
// echo 'Line '.__LINE__.' '.$e->getMessage();
|
151 |
+
}
|
152 |
|
|
|
|
|
153 |
}
|
154 |
+
|
155 |
+
}
|
156 |
|
157 |
+
public function getParrentIds(){
|
158 |
+
return $this->_parrentIds;
|
|
|
|
|
|
|
159 |
}
|
160 |
|
161 |
private function getProductPrice($product){
|
app/code/local/Wisepricer/Syncer/controllers/Adminhtml/SyncerController.php
CHANGED
@@ -21,9 +21,10 @@ class Wisepricer_Syncer_Adminhtml_SyncerController extends Mage_Adminhtml_Contro
|
|
21 |
$this->loadLayout()->_setActiveMenu('wisepricer');
|
22 |
$this->renderLayout();
|
23 |
}
|
|
|
24 |
public function mappingAction()
|
25 |
{
|
26 |
-
|
27 |
$model = Mage::getModel('wisepricer_syncer/config');
|
28 |
$lisenceData=$model->load(1);
|
29 |
if(count($lisenceData->getData())>0){
|
@@ -37,13 +38,14 @@ class Wisepricer_Syncer_Adminhtml_SyncerController extends Mage_Adminhtml_Contro
|
|
37 |
$this->loadLayout()->_setActiveMenu('wisepricer');
|
38 |
$this->renderLayout();
|
39 |
}
|
|
|
40 |
public function _savekey()
|
41 |
{
|
42 |
$post = $this->getRequest()->getPost('register_form');
|
43 |
$lisensekey = $post['licensekey'];
|
44 |
$website = $post['website'];
|
45 |
-
$type = $post['product_type'];
|
46 |
-
|
47 |
if(isset($post['reprice_configurable'])){
|
48 |
$reprConf = $post['reprice_configurable'];
|
49 |
if(!$reprConf){
|
@@ -54,40 +56,40 @@ class Wisepricer_Syncer_Adminhtml_SyncerController extends Mage_Adminhtml_Contro
|
|
54 |
}else{
|
55 |
$reprConf=0;
|
56 |
}
|
57 |
-
|
58 |
-
if(isset($post['import_outofstock'])){
|
59 |
$import_outofstock = $post['import_outofstock'];
|
60 |
if(!$import_outofstock){
|
61 |
-
$import_outofstock=0;
|
62 |
-
}else{
|
63 |
$import_outofstock=1;
|
|
|
|
|
64 |
}
|
65 |
}else{
|
66 |
-
$import_outofstock=
|
67 |
}
|
68 |
-
|
69 |
try {
|
70 |
if (empty($lisensekey)) {
|
71 |
Mage::throwException($this->__('Invalid form data. The license key is missing!'));
|
72 |
}
|
|
|
73 |
$model = Mage::getModel('wisepricer_syncer/config');
|
|
|
74 |
$lisenceData=$model->load(1);
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
}else{
|
83 |
-
$model->setLicensekey($lisensekey)->save();
|
84 |
-
}
|
85 |
|
86 |
}
|
87 |
catch (Exception $e) {
|
88 |
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
89 |
}
|
90 |
}
|
|
|
91 |
protected function _validateMapping($post){
|
92 |
|
93 |
$isValid=false;
|
@@ -109,9 +111,13 @@ class Wisepricer_Syncer_Adminhtml_SyncerController extends Mage_Adminhtml_Contro
|
|
109 |
|
110 |
return $isValid;
|
111 |
}
|
|
|
112 |
public function savemappingAction(){
|
|
|
113 |
set_time_limit (1800);
|
|
|
114 |
$post= $this->getRequest()->getPost('mapping_form');
|
|
|
115 |
$this->_savekey();
|
116 |
|
117 |
$isValid=$this->_validateMapping($post);
|
21 |
$this->loadLayout()->_setActiveMenu('wisepricer');
|
22 |
$this->renderLayout();
|
23 |
}
|
24 |
+
|
25 |
public function mappingAction()
|
26 |
{
|
27 |
+
set_time_limit (1800);
|
28 |
$model = Mage::getModel('wisepricer_syncer/config');
|
29 |
$lisenceData=$model->load(1);
|
30 |
if(count($lisenceData->getData())>0){
|
38 |
$this->loadLayout()->_setActiveMenu('wisepricer');
|
39 |
$this->renderLayout();
|
40 |
}
|
41 |
+
|
42 |
public function _savekey()
|
43 |
{
|
44 |
$post = $this->getRequest()->getPost('register_form');
|
45 |
$lisensekey = $post['licensekey'];
|
46 |
$website = $post['website'];
|
47 |
+
$type = $post['product_type'];
|
48 |
+
|
49 |
if(isset($post['reprice_configurable'])){
|
50 |
$reprConf = $post['reprice_configurable'];
|
51 |
if(!$reprConf){
|
56 |
}else{
|
57 |
$reprConf=0;
|
58 |
}
|
59 |
+
|
60 |
+
if(isset($post['import_outofstock'])){
|
61 |
$import_outofstock = $post['import_outofstock'];
|
62 |
if(!$import_outofstock){
|
|
|
|
|
63 |
$import_outofstock=1;
|
64 |
+
}else{
|
65 |
+
$import_outofstock=0;
|
66 |
}
|
67 |
}else{
|
68 |
+
$import_outofstock=1;
|
69 |
}
|
70 |
+
|
71 |
try {
|
72 |
if (empty($lisensekey)) {
|
73 |
Mage::throwException($this->__('Invalid form data. The license key is missing!'));
|
74 |
}
|
75 |
+
|
76 |
$model = Mage::getModel('wisepricer_syncer/config');
|
77 |
+
|
78 |
$lisenceData=$model->load(1);
|
79 |
+
|
80 |
+
$lisenceData->setLicensekey($lisensekey);
|
81 |
+
$lisenceData->setWebsite($website);
|
82 |
+
$lisenceData->setProduct_type($type);
|
83 |
+
$lisenceData->setReprice_configurable($reprConf);
|
84 |
+
$lisenceData->setImport_outofstock($import_outofstock);
|
85 |
+
$lisenceData->save();
|
|
|
|
|
|
|
86 |
|
87 |
}
|
88 |
catch (Exception $e) {
|
89 |
Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
|
90 |
}
|
91 |
}
|
92 |
+
|
93 |
protected function _validateMapping($post){
|
94 |
|
95 |
$isValid=false;
|
111 |
|
112 |
return $isValid;
|
113 |
}
|
114 |
+
|
115 |
public function savemappingAction(){
|
116 |
+
|
117 |
set_time_limit (1800);
|
118 |
+
|
119 |
$post= $this->getRequest()->getPost('mapping_form');
|
120 |
+
|
121 |
$this->_savekey();
|
122 |
|
123 |
$isValid=$this->_validateMapping($post);
|
app/code/local/Wisepricer/Syncer/controllers/ProductsController.php
CHANGED
@@ -14,7 +14,9 @@ class Wisepricer_Syncer_ProductsController extends Wisepricer_Syncer_BaseControl
|
|
14 |
public function sendAction(){
|
15 |
// Mage::log('start sending',null,'wplog.log');
|
16 |
set_time_limit (1800);
|
|
|
17 |
$licenseData =Mage::getModel('wisepricer_syncer/config')->load(1);
|
|
|
18 |
if(!$licenseData->getData()||$licenseData->getIs_confirmed()==0){
|
19 |
|
20 |
$returnArr=array(
|
@@ -43,6 +45,13 @@ class Wisepricer_Syncer_ProductsController extends Wisepricer_Syncer_BaseControl
|
|
43 |
|
44 |
|
45 |
$startInd = $post['start'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
if(!$startInd){
|
47 |
$startInd=0;
|
48 |
}
|
@@ -52,12 +61,12 @@ class Wisepricer_Syncer_ProductsController extends Wisepricer_Syncer_BaseControl
|
|
52 |
$count=200;
|
53 |
}
|
54 |
|
55 |
-
$
|
56 |
-
|
57 |
|
58 |
$fieldsEncoded= $post['params'];
|
|
|
59 |
$fields =json_decode(urldecode ($fieldsEncoded));
|
60 |
-
if(empty($fields)){
|
61 |
Mage::log(print_r('post[params]= '.$post['params'],true),null,'wplog.log');
|
62 |
Mage::log(print_r('fields= '.$fields,true),null,'wplog.log');
|
63 |
// slashes prevents from json decoding on some systems
|
@@ -101,12 +110,20 @@ class Wisepricer_Syncer_ProductsController extends Wisepricer_Syncer_BaseControl
|
|
101 |
|
102 |
}
|
103 |
|
|
|
|
|
|
|
|
|
|
|
104 |
|
105 |
-
if($licenseData->getWebsite()!=
|
106 |
$collection->addStoreFilter($licenseData->getWebsite());
|
|
|
|
|
|
|
107 |
}
|
108 |
-
|
109 |
-
if($licenseData->getImport_outofstock()){
|
110 |
Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($collection);
|
111 |
}
|
112 |
|
@@ -128,7 +145,9 @@ class Wisepricer_Syncer_ProductsController extends Wisepricer_Syncer_BaseControl
|
|
128 |
foreach ($collection as $product) {
|
129 |
|
130 |
$productCollData=$product->getData();
|
131 |
-
$productModel=Mage::getModel('catalog/product')
|
|
|
|
|
132 |
|
133 |
$this->productOrigData=$productModel->getData();
|
134 |
$productData=array();
|
@@ -204,6 +223,8 @@ class Wisepricer_Syncer_ProductsController extends Wisepricer_Syncer_BaseControl
|
|
204 |
|
205 |
$productData['producturl']=Mage::helper('catalog/product')->getProductUrl($productCollData['entity_id']);
|
206 |
|
|
|
|
|
207 |
$productsOutput[]=$productData;
|
208 |
}
|
209 |
|
@@ -285,7 +306,7 @@ class Wisepricer_Syncer_ProductsController extends Wisepricer_Syncer_BaseControl
|
|
285 |
|
286 |
$sessionId=$this->_randString(8);
|
287 |
|
288 |
-
Mage::getModel('core/cookie')->set('wpsession',$sessionId ,
|
289 |
|
290 |
$returnArr=array(
|
291 |
'status'=>'success',
|
@@ -320,6 +341,7 @@ class Wisepricer_Syncer_ProductsController extends Wisepricer_Syncer_BaseControl
|
|
320 |
|
321 |
echo json_encode($returnArr);
|
322 |
}
|
|
|
323 |
public function getpublicAction(){
|
324 |
|
325 |
$publickey=$this->_getpublickey();
|
@@ -333,11 +355,14 @@ class Wisepricer_Syncer_ProductsController extends Wisepricer_Syncer_BaseControl
|
|
333 |
echo json_encode($returnArr);
|
334 |
}
|
335 |
|
336 |
-
|
337 |
public function repriceAction(){
|
|
|
338 |
Mage::log(print_r('Entered reprice action',true),null,'wplog.log');
|
|
|
339 |
set_time_limit (1800);
|
|
|
340 |
$licenseData =Mage::getModel('wisepricer_syncer/config')->load(1);
|
|
|
341 |
if(!$licenseData->getData()||$licenseData->getIs_confirmed()==0){
|
342 |
|
343 |
$returnArr=array(
|
@@ -363,77 +388,99 @@ class Wisepricer_Syncer_ProductsController extends Wisepricer_Syncer_BaseControl
|
|
363 |
echo json_encode($returnArr);
|
364 |
die;
|
365 |
}
|
|
|
|
|
366 |
|
367 |
$productsEncoded= $post['products'];
|
|
|
368 |
$products =json_decode(urldecode ($productsEncoded));
|
|
|
369 |
$responseArr=array();
|
|
|
370 |
$sucessCounter=0;
|
|
|
371 |
$failedCounter=0;
|
|
|
372 |
Mage::log(print_r('repricing '.count($products),true),null,'wplog.log');
|
373 |
-
$repriceModel=Mage::getModel('wisepricer_syncer/reprice');
|
374 |
-
$id_type= $this->_getMagentoFieldByWsField('sku');
|
375 |
-
$price_field= $this->_getMagentoFieldByWsField('price');
|
376 |
|
377 |
-
|
378 |
|
379 |
-
|
380 |
|
381 |
-
|
382 |
-
|
|
|
383 |
|
384 |
-
$repriceModel->updatePricesBySku($prodArr,$price_field);
|
385 |
-
$responseArr[]=array('sku'=>$prodArr->sku,'price'=>$prodArr->price,'error_code'=>'0');
|
386 |
-
$sucessCounter++;
|
387 |
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
|
396 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
397 |
|
|
|
398 |
}
|
399 |
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
$repriceModel->updatePricesById($prodArr,$price_field);
|
408 |
-
$responseArr[]=array('sku'=>$prodArr->sku,'price'=>$prodArr->price,'error_code'=>'0');
|
409 |
$sucessCounter++;
|
410 |
|
411 |
} catch (Exception $exc) {
|
412 |
-
$responseArr[]=array('sku'=>$
|
413 |
$failedCounter++;
|
414 |
}
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
$sucessCounter++;
|
431 |
-
}catch (Exception $exc) {
|
432 |
-
$responseArr[]=array('sku'=>$parId,'error_code'=>'444','error_details'=>$exc->getMessage());
|
433 |
-
$failedCounter++;
|
434 |
-
}
|
435 |
-
|
436 |
-
}
|
437 |
|
438 |
|
439 |
Mage::log(print_r('finished repricing',true),null,'wplog.log');
|
@@ -457,6 +504,8 @@ class Wisepricer_Syncer_ProductsController extends Wisepricer_Syncer_BaseControl
|
|
457 |
|
458 |
public function reindexAction(){
|
459 |
|
|
|
|
|
460 |
Mage::log(print_r('Entered reindex action',true),null,'wplog.log');
|
461 |
|
462 |
$licenseData =Mage::getModel('wisepricer_syncer/config')->load(1);
|
@@ -486,20 +535,39 @@ class Wisepricer_Syncer_ProductsController extends Wisepricer_Syncer_BaseControl
|
|
486 |
die;
|
487 |
}
|
488 |
Mage::getSingleton('index/indexer')->getProcessByCode('catalog_product_price')->reindexAll();
|
|
|
|
|
|
|
|
|
|
|
|
|
489 |
}
|
490 |
|
491 |
public function generatejasonAction(){
|
492 |
-
|
493 |
-
|
494 |
-
|
495 |
-
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
503 |
die;
|
504 |
}
|
505 |
|
14 |
public function sendAction(){
|
15 |
// Mage::log('start sending',null,'wplog.log');
|
16 |
set_time_limit (1800);
|
17 |
+
|
18 |
$licenseData =Mage::getModel('wisepricer_syncer/config')->load(1);
|
19 |
+
|
20 |
if(!$licenseData->getData()||$licenseData->getIs_confirmed()==0){
|
21 |
|
22 |
$returnArr=array(
|
45 |
|
46 |
|
47 |
$startInd = $post['start'];
|
48 |
+
|
49 |
+
$fromId=0;
|
50 |
+
|
51 |
+
if(isset($post['from_id'])){
|
52 |
+
$fromId=$post['from_id'];
|
53 |
+
}
|
54 |
+
|
55 |
if(!$startInd){
|
56 |
$startInd=0;
|
57 |
}
|
61 |
$count=200;
|
62 |
}
|
63 |
|
64 |
+
$store_id=isset($post['store_id']) ? $post['store_id'] : 1;
|
|
|
65 |
|
66 |
$fieldsEncoded= $post['params'];
|
67 |
+
|
68 |
$fields =json_decode(urldecode ($fieldsEncoded));
|
69 |
+
if(empty($fields)){ //params=["all"]
|
70 |
Mage::log(print_r('post[params]= '.$post['params'],true),null,'wplog.log');
|
71 |
Mage::log(print_r('fields= '.$fields,true),null,'wplog.log');
|
72 |
// slashes prevents from json decoding on some systems
|
110 |
|
111 |
}
|
112 |
|
113 |
+
if($fromId>0){
|
114 |
+
$collection->addAttributeToFilter('entity_id', array(
|
115 |
+
'from' => $fromId
|
116 |
+
));
|
117 |
+
}
|
118 |
|
119 |
+
if($licenseData->getWebsite()!=770){
|
120 |
$collection->addStoreFilter($licenseData->getWebsite());
|
121 |
+
//if user set from config to send only products from one store
|
122 |
+
//he can send it only from there
|
123 |
+
$store_id=$licenseData->getWebsite();
|
124 |
}
|
125 |
+
|
126 |
+
if($licenseData->getImport_outofstock()==0){
|
127 |
Mage::getSingleton('cataloginventory/stock')->addInStockFilterToCollection($collection);
|
128 |
}
|
129 |
|
145 |
foreach ($collection as $product) {
|
146 |
|
147 |
$productCollData=$product->getData();
|
148 |
+
$productModel=Mage::getModel('catalog/product')
|
149 |
+
->setStoreId($store_id)
|
150 |
+
->load($productCollData['entity_id']);
|
151 |
|
152 |
$this->productOrigData=$productModel->getData();
|
153 |
$productData=array();
|
223 |
|
224 |
$productData['producturl']=Mage::helper('catalog/product')->getProductUrl($productCollData['entity_id']);
|
225 |
|
226 |
+
$productData['product_id']=$productCollData['entity_id'];
|
227 |
+
|
228 |
$productsOutput[]=$productData;
|
229 |
}
|
230 |
|
306 |
|
307 |
$sessionId=$this->_randString(8);
|
308 |
|
309 |
+
Mage::getModel('core/cookie')->set('wpsession',$sessionId , 86400);
|
310 |
|
311 |
$returnArr=array(
|
312 |
'status'=>'success',
|
341 |
|
342 |
echo json_encode($returnArr);
|
343 |
}
|
344 |
+
|
345 |
public function getpublicAction(){
|
346 |
|
347 |
$publickey=$this->_getpublickey();
|
355 |
echo json_encode($returnArr);
|
356 |
}
|
357 |
|
|
|
358 |
public function repriceAction(){
|
359 |
+
|
360 |
Mage::log(print_r('Entered reprice action',true),null,'wplog.log');
|
361 |
+
|
362 |
set_time_limit (1800);
|
363 |
+
|
364 |
$licenseData =Mage::getModel('wisepricer_syncer/config')->load(1);
|
365 |
+
|
366 |
if(!$licenseData->getData()||$licenseData->getIs_confirmed()==0){
|
367 |
|
368 |
$returnArr=array(
|
388 |
echo json_encode($returnArr);
|
389 |
die;
|
390 |
}
|
391 |
+
|
392 |
+
$store_id=isset($post['store_id']) ? $post['store_id'] : 0;
|
393 |
|
394 |
$productsEncoded= $post['products'];
|
395 |
+
|
396 |
$products =json_decode(urldecode ($productsEncoded));
|
397 |
+
//echo '<pre>'.print_r($products,true); die;
|
398 |
$responseArr=array();
|
399 |
+
|
400 |
$sucessCounter=0;
|
401 |
+
|
402 |
$failedCounter=0;
|
403 |
+
|
404 |
Mage::log(print_r('repricing '.count($products),true),null,'wplog.log');
|
|
|
|
|
|
|
405 |
|
406 |
+
$mappings =Mage::getModel('wisepricer_syncer/mapping')->getCollection()->getData();
|
407 |
|
408 |
+
$newMappings=array();
|
409 |
|
410 |
+
foreach ($mappings as $mp) {
|
411 |
+
$newMappings[$mp['wsp_field']]=$mp;
|
412 |
+
}
|
413 |
|
|
|
|
|
|
|
414 |
|
415 |
+
$repriceModel=Mage::getModel('wisepricer_syncer/reprice');
|
416 |
+
|
417 |
+
$id_type= $this->_getMagentoFieldByWsField('sku');
|
418 |
+
|
419 |
+
$price_field= $this->_getMagentoFieldByWsField('price'); //
|
420 |
+
|
421 |
+
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
|
422 |
|
423 |
+
$entityTypeId = $setup->getEntityTypeId('catalog_product');
|
424 |
+
|
425 |
+
foreach ($products as $prodArr) {
|
426 |
+
|
427 |
+
$productId=0;
|
428 |
+
|
429 |
+
$sku= $prodArr->sku;
|
430 |
+
|
431 |
+
if(strtolower($id_type)=='sku'){
|
432 |
+
|
433 |
+
if (!$repriceModel->checkIfSkuExists($prodArr->sku)) {
|
434 |
+
|
435 |
+
$responseArr[]=array('sku'=>$sku,'error_code'=>'333','error_details'=>'SKU could not be loaded');
|
436 |
+
|
437 |
+
$failedCounter++;
|
438 |
+
|
439 |
+
continue;
|
440 |
+
}
|
441 |
+
|
442 |
+
$productId=$repriceModel->getIdFromSku($prodArr->sku);
|
443 |
+
//we change the sku to id because all reprices will be made by id only
|
444 |
+
$prodArr->sku= $productId;
|
445 |
+
|
446 |
+
}else{
|
447 |
+
|
448 |
+
if(!$repriceModel->checkIfIdExists($prodArr->sku)){
|
449 |
+
|
450 |
+
$responseArr[]=array('sku'=>$sku,'error_code'=>'333','error_details'=>'ID could not be loaded');
|
451 |
+
|
452 |
+
$failedCounter++;
|
453 |
|
454 |
+
continue;
|
455 |
}
|
456 |
|
457 |
+
}
|
458 |
+
|
459 |
+
try {
|
460 |
|
461 |
+
$repriceModel->updatePricesById($prodArr,$entityTypeId,$store_id,$newMappings);
|
462 |
+
$responseArr[]=array('sku'=>$sku,'price'=>$prodArr,'error_code'=>'0');
|
|
|
|
|
|
|
463 |
$sucessCounter++;
|
464 |
|
465 |
} catch (Exception $exc) {
|
466 |
+
$responseArr[]=array('sku'=>$sku,'error_code'=>'444','error_details'=>$exc->getMessage());
|
467 |
$failedCounter++;
|
468 |
}
|
469 |
+
|
470 |
+
}
|
471 |
+
|
472 |
+
// $parrentsIds=$repriceModel->getParrentIds();
|
473 |
+
// foreach($parrentsIds as $parId => $price){
|
474 |
+
// try{
|
475 |
+
// $minPrice=$repriceModel->repriceConfigurable($parId, $price, $price_field);
|
476 |
+
// $responseArr[]=array('sku'=>$parId,'price'=>$minPrice,'error_code'=>'0');
|
477 |
+
// $sucessCounter++;
|
478 |
+
// }catch (Exception $exc) {
|
479 |
+
// $responseArr[]=array('sku'=>$parId,'error_code'=>'444','error_details'=>$exc->getMessage());
|
480 |
+
// $failedCounter++;
|
481 |
+
// }
|
482 |
+
//
|
483 |
+
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
484 |
|
485 |
|
486 |
Mage::log(print_r('finished repricing',true),null,'wplog.log');
|
504 |
|
505 |
public function reindexAction(){
|
506 |
|
507 |
+
set_time_limit (1800);
|
508 |
+
|
509 |
Mage::log(print_r('Entered reindex action',true),null,'wplog.log');
|
510 |
|
511 |
$licenseData =Mage::getModel('wisepricer_syncer/config')->load(1);
|
535 |
die;
|
536 |
}
|
537 |
Mage::getSingleton('index/indexer')->getProcessByCode('catalog_product_price')->reindexAll();
|
538 |
+
|
539 |
+
$returnArr=array(
|
540 |
+
'status'=>'success',
|
541 |
+
'error_code'=>'0'
|
542 |
+
);
|
543 |
+
echo json_encode($returnArr);
|
544 |
}
|
545 |
|
546 |
public function generatejasonAction(){
|
547 |
+
echo '[{"sku":"128905","price":"529.99","special_price":"500","amazon_price":"560","ebay_price":"550"}]';
|
548 |
+
die;
|
549 |
+
}
|
550 |
+
|
551 |
+
public function getstoresAction(){
|
552 |
+
|
553 |
+
$post = $this->getRequest()->getParams();
|
554 |
+
|
555 |
+
$magentoSessionId=Mage::getModel('core/cookie')->get('wpsession');
|
556 |
+
|
557 |
+
if((!$magentoSessionId)||($magentoSessionId!=$post['sesssionid'])){
|
558 |
+
|
559 |
+
$returnArr=array(
|
560 |
+
'status'=>'failure',
|
561 |
+
'error_code'=>'771',
|
562 |
+
'error_details'=>'Unauthorized access.'
|
563 |
+
);
|
564 |
+
echo json_encode($returnArr);
|
565 |
+
die;
|
566 |
+
}
|
567 |
+
|
568 |
+
$helper=Mage::helper('syncer');
|
569 |
+
|
570 |
+
echo $helper->getMultiStoreDataJson();
|
571 |
die;
|
572 |
}
|
573 |
|
app/code/local/Wisepricer/Syncer/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Wisepricer_Syncer>
|
5 |
-
<version>1.
|
6 |
<url>http://www.wisepricer.com/index.php</url>
|
7 |
<modulename>Wisepricer Syncer</modulename>
|
8 |
</Wisepricer_Syncer>
|
@@ -26,7 +26,7 @@
|
|
26 |
</wisepricer_syncer_mysql4>
|
27 |
</models>
|
28 |
<events>
|
29 |
-
|
30 |
<observers>
|
31 |
<wisepricer_syncer>
|
32 |
<class>wisepricer_syncer/observer</class>
|
@@ -49,7 +49,7 @@
|
|
49 |
<method>checkout_type_onepage_save_order</method>
|
50 |
</wisepricer_syncer>
|
51 |
</observers>
|
52 |
-
</checkout_type_onepage_save_order
|
53 |
</events>
|
54 |
<resources>
|
55 |
<syncer_setup>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Wisepricer_Syncer>
|
5 |
+
<version>1.3.0.0</version>
|
6 |
<url>http://www.wisepricer.com/index.php</url>
|
7 |
<modulename>Wisepricer Syncer</modulename>
|
8 |
</Wisepricer_Syncer>
|
26 |
</wisepricer_syncer_mysql4>
|
27 |
</models>
|
28 |
<events>
|
29 |
+
<!--<catalog_controller_product_init>
|
30 |
<observers>
|
31 |
<wisepricer_syncer>
|
32 |
<class>wisepricer_syncer/observer</class>
|
49 |
<method>checkout_type_onepage_save_order</method>
|
50 |
</wisepricer_syncer>
|
51 |
</observers>
|
52 |
+
</checkout_type_onepage_save_order>-->
|
53 |
</events>
|
54 |
<resources>
|
55 |
<syncer_setup>
|
app/code/local/Wisepricer/Syncer/sql/syncer_setup/mysql4-install-1.1.3.8.php
CHANGED
@@ -12,7 +12,7 @@ CREATE TABLE IF NOT EXISTS {$this->getTable('wisepricer_syncer_config')} (
|
|
12 |
|
13 |
`licensekey` varchar(255) character set utf8 NOT NULL,
|
14 |
|
15 |
-
`is_confirmed`
|
16 |
|
17 |
`publickey` text character set utf8 NOT NULL,
|
18 |
|
@@ -22,7 +22,9 @@ CREATE TABLE IF NOT EXISTS {$this->getTable('wisepricer_syncer_config')} (
|
|
22 |
|
23 |
`product_type` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT 'simple',
|
24 |
|
25 |
-
`reprice_configurable`
|
|
|
|
|
26 |
|
27 |
PRIMARY KEY (`licensekey_id`)
|
28 |
|
12 |
|
13 |
`licensekey` varchar(255) character set utf8 NOT NULL,
|
14 |
|
15 |
+
`is_confirmed` TINYINT(1) unsigned NOT NULL default '0',
|
16 |
|
17 |
`publickey` text character set utf8 NOT NULL,
|
18 |
|
22 |
|
23 |
`product_type` varchar(255) CHARACTER SET utf8 NOT NULL DEFAULT 'simple',
|
24 |
|
25 |
+
`reprice_configurable` TINYINT(1) NOT NULL DEFAULT '1',
|
26 |
+
|
27 |
+
`import_outofstock` TINYINT(1) NOT NULL DEFAULT '1',
|
28 |
|
29 |
PRIMARY KEY (`licensekey_id`)
|
30 |
|
app/code/local/Wisepricer/Syncer/sql/syncer_setup/mysql4-upgrade-1.1.3.8-1.1.3.9.php
DELETED
@@ -1,35 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
$installer = $this;
|
4 |
-
|
5 |
-
$installer->startSetup();
|
6 |
-
|
7 |
-
$installer->run("
|
8 |
-
|
9 |
-
CREATE TABLE IF NOT EXISTS {$this->getTable('wisepricer_syncer_hits_counter')} (
|
10 |
-
|
11 |
-
`hits_id` int(11) NOT NULL auto_increment,
|
12 |
-
|
13 |
-
`sku` varchar(255) character set utf8 NOT NULL,
|
14 |
-
|
15 |
-
`hits` int(11) unsigned NOT NULL default '0',
|
16 |
-
|
17 |
-
PRIMARY KEY (`hits_id`)
|
18 |
-
|
19 |
-
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
20 |
-
|
21 |
-
CREATE TABLE IF NOT EXISTS {$this->getTable('wisepricer_syncer_sales')} (
|
22 |
-
|
23 |
-
`sales_id` int(11) NOT NULL auto_increment,
|
24 |
-
|
25 |
-
`order_id` varchar( 1024 ) NOT NULL,
|
26 |
-
|
27 |
-
`status` int(1) unsigned NOT NULL default '0',
|
28 |
-
|
29 |
-
PRIMARY KEY (`sales_id`)
|
30 |
-
|
31 |
-
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
32 |
-
|
33 |
-
");
|
34 |
-
|
35 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Wisepricer/Syncer/sql/syncer_setup/mysql4-upgrade-1.1.3.9-1.1.4.1.php
DELETED
@@ -1,12 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
$installer = $this;
|
4 |
-
|
5 |
-
$installer->startSetup();
|
6 |
-
|
7 |
-
$installer->run("
|
8 |
-
|
9 |
-
ALTER TABLE {$this->getTable('wisepricer_syncer_config')} ADD `import_outofstock` INT( 255 ) NULL default '1';
|
10 |
-
");
|
11 |
-
|
12 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Wisepricer/Syncer/sql/syncer_setup/mysql4-upgrade-1.1.4.1-1.1.4.2.php
DELETED
@@ -1,65 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
$installer = $this;
|
4 |
-
|
5 |
-
$installer->startSetup();
|
6 |
-
|
7 |
-
$insertStr='';
|
8 |
-
|
9 |
-
try{
|
10 |
-
|
11 |
-
$dt=strtotime('-30 days');
|
12 |
-
$mysqldate = date( 'Y-m-d H:i:s', $dt );
|
13 |
-
|
14 |
-
$orders=Mage::getModel('sales/order')->getCollection()
|
15 |
-
->addFieldToFilter('status',array('in'=> array('processing', 'processed', 'complete')))
|
16 |
-
->addFieldToFilter('created_at',array('gt'=>$mysqldate));
|
17 |
-
|
18 |
-
foreach($orders as $order){
|
19 |
-
|
20 |
-
$insertStr.= 'INSERT INTO '.$this->getTable('wisepricer_syncer_sales').' ( `sales_id` ,`order_id` ,`status`,order_date) VALUES (NULL , "'.$order->getIncrementId().'", "0","'.$order->getCreatedAt().'");';
|
21 |
-
}
|
22 |
-
|
23 |
-
}catch(Exception $e){
|
24 |
-
|
25 |
-
}
|
26 |
-
|
27 |
-
$installer->run("
|
28 |
-
|
29 |
-
|
30 |
-
DROP TABLE IF EXISTS {$this->getTable('wisepricer_syncer_hits_counter')};
|
31 |
-
|
32 |
-
CREATE TABLE IF NOT EXISTS {$this->getTable('wisepricer_syncer_hits_counter')} (
|
33 |
-
|
34 |
-
`hits_id` int(11) NOT NULL auto_increment,
|
35 |
-
|
36 |
-
`sku` varchar(255) character set utf8 NOT NULL,
|
37 |
-
|
38 |
-
`hits` int(11) unsigned NOT NULL default '0',
|
39 |
-
|
40 |
-
`hit_date` date DEFAULT NULL,
|
41 |
-
|
42 |
-
PRIMARY KEY (`hits_id`)
|
43 |
-
|
44 |
-
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
45 |
-
|
46 |
-
DROP TABLE IF EXISTS {$this->getTable('wisepricer_syncer_sales')};
|
47 |
-
|
48 |
-
CREATE TABLE IF NOT EXISTS {$this->getTable('wisepricer_syncer_sales')} (
|
49 |
-
|
50 |
-
`sales_id` int(11) NOT NULL auto_increment,
|
51 |
-
|
52 |
-
`order_id` varchar( 1024 ) NOT NULL,
|
53 |
-
|
54 |
-
`status` int(1) unsigned NOT NULL default '0',
|
55 |
-
|
56 |
-
`order_date` date DEFAULT NULL,
|
57 |
-
|
58 |
-
PRIMARY KEY (`sales_id`)
|
59 |
-
|
60 |
-
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
|
61 |
-
|
62 |
-
".$insertStr."
|
63 |
-
");
|
64 |
-
|
65 |
-
$installer->endSetup();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/local/Wisepricer/Syncer/sql/syncer_setup/mysql4-upgrade-1.1.4.6-1.1.4.7.php
CHANGED
@@ -8,7 +8,7 @@ $installer->addAttribute('catalog_product', 'ignore_wisepricer', array(
|
|
8 |
'type' => 'int',
|
9 |
'backend' => '',
|
10 |
'frontend' => '',
|
11 |
-
'label' => 'Ignore
|
12 |
'input' => 'select',
|
13 |
'class' => '',
|
14 |
'source' => 'eav/entity_attribute_source_boolean',
|
8 |
'type' => 'int',
|
9 |
'backend' => '',
|
10 |
'frontend' => '',
|
11 |
+
'label' => 'Ignore Wiser',
|
12 |
'input' => 'select',
|
13 |
'class' => '',
|
14 |
'source' => 'eav/entity_attribute_source_boolean',
|
app/code/local/Wisepricer/Syncer/sql/syncer_setup/mysql4-upgrade-1.1.4.7-1.1.4.8.php
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$installer = $this;
|
4 |
+
|
5 |
+
$installer->startSetup();
|
6 |
+
|
7 |
+
$attributeId=$installer->getAttribute('catalog_product','ignore_wisepricer');
|
8 |
+
|
9 |
+
$allAttributeSetIds=$installer->getAllAttributeSetIds('catalog_product');
|
10 |
+
|
11 |
+
if(is_array($attributeId)){
|
12 |
+
foreach ($allAttributeSetIds as $attributeSetId) {
|
13 |
+
try{
|
14 |
+
$attributeGroupId=$installer->getAttributeGroup('catalog_product',$attributeSetId,'General');
|
15 |
+
}
|
16 |
+
catch(Exception $e)
|
17 |
+
{
|
18 |
+
$attributeGroupId=$installer->getDefaultAttributeGroupId('catalog/product',$attributeSetId);
|
19 |
+
}
|
20 |
+
|
21 |
+
if(is_array($attributeGroupId)){
|
22 |
+
$installer->addAttributeToSet('catalog_product',$attributeSetId,$attributeGroupId['attribute_group_id'],$attributeId['attribute_id']);
|
23 |
+
}
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
|
28 |
+
$installer->endSetup();
|
app/design/adminhtml/default/default/template/wisepricer/mapping.phtml
CHANGED
@@ -117,9 +117,24 @@
|
|
117 |
<td class="input-ele"><?php echo $this->renderPriceAttributesSelect('mapping_form[price]','price','price','required-entry chzn-select')?></td>
|
118 |
<td></td>
|
119 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
<tr>
|
121 |
<td class="label firstcol"><span><?php echo $this->__('Cost')?></span></td>
|
122 |
-
<td class="input-ele"><?php echo $this->renderAttributesSelect('mapping_form[cost]','cost','
|
123 |
<td></td>
|
124 |
</tr>
|
125 |
<tr>
|
117 |
<td class="input-ele"><?php echo $this->renderPriceAttributesSelect('mapping_form[price]','price','price','required-entry chzn-select')?></td>
|
118 |
<td></td>
|
119 |
</tr>
|
120 |
+
<tr>
|
121 |
+
<td class="label firstcol"><span><?php echo $this->__('Special Price')?> <span class="required">*</span></span></td>
|
122 |
+
<td class="input-ele"><?php echo $this->renderPriceAttributesSelect('mapping_form[special_price]','special_price','special_price','required-entry chzn-select')?></td>
|
123 |
+
<td></td>
|
124 |
+
</tr>
|
125 |
+
<tr>
|
126 |
+
<td class="label firstcol"><span><?php echo $this->__('Amazon Price')?></span></td>
|
127 |
+
<td class="input-ele"><?php echo $this->renderPriceAttributesSelect('mapping_form[amazon_price]','amazon_price','amazon_price','chzn-select')?></td>
|
128 |
+
<td></td>
|
129 |
+
</tr>
|
130 |
+
<tr>
|
131 |
+
<td class="label firstcol"><span><?php echo $this->__('Ebay Price')?></span></td>
|
132 |
+
<td class="input-ele"><?php echo $this->renderPriceAttributesSelect('mapping_form[ebay_price]','ebay_price','ebay_price','chzn-select')?></td>
|
133 |
+
<td></td>
|
134 |
+
</tr>
|
135 |
<tr>
|
136 |
<td class="label firstcol"><span><?php echo $this->__('Cost')?></span></td>
|
137 |
+
<td class="input-ele"><?php echo $this->renderAttributesSelect('mapping_form[cost]','cost','cost','chzn-select')?></td>
|
138 |
<td></td>
|
139 |
</tr>
|
140 |
<tr>
|
app/etc/modules/Wisepricer_Syncer.xml
CHANGED
@@ -1,23 +1,9 @@
|
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<config>
|
3 |
-
|
4 |
-
|
5 |
<modules>
|
6 |
-
|
7 |
-
|
8 |
<Wisepricer_Syncer>
|
9 |
-
|
10 |
-
|
11 |
<active>true</active>
|
12 |
-
|
13 |
-
|
14 |
<codePool>local</codePool>
|
15 |
-
|
16 |
-
|
17 |
</Wisepricer_Syncer>
|
18 |
-
|
19 |
-
|
20 |
</modules>
|
21 |
-
|
22 |
-
|
23 |
</config>
|
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<config>
|
|
|
|
|
3 |
<modules>
|
|
|
|
|
4 |
<Wisepricer_Syncer>
|
|
|
|
|
5 |
<active>true</active>
|
|
|
|
|
6 |
<codePool>local</codePool>
|
|
|
|
|
7 |
</Wisepricer_Syncer>
|
|
|
|
|
8 |
</modules>
|
|
|
|
|
9 |
</config>
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Wisepricer_Syncer</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL</license>
|
7 |
<channel>community</channel>
|
@@ -9,10 +9,10 @@
|
|
9 |
<summary>WisePricer- Beat your competition</summary>
|
10 |
<description>WisePricer is a new tool that allows you to Track & monitor successful online retailers and update your store prices in real-time. With WisePricer you’ll never get left behind the competition.</description>
|
11 |
<notes>Set bigger time limit at install</notes>
|
12 |
-
<authors><author><name>Moshe</name><user>
|
13 |
-
<date>
|
14 |
-
<time>
|
15 |
-
<contents><target name="
|
16 |
<compatible/>
|
17 |
-
<dependencies
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Wisepricer_Syncer</name>
|
4 |
+
<version>1.3.0.0</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.opensource.org/licenses/osl-3.0.php">OSL</license>
|
7 |
<channel>community</channel>
|
9 |
<summary>WisePricer- Beat your competition</summary>
|
10 |
<description>WisePricer is a new tool that allows you to Track & monitor successful online retailers and update your store prices in real-time. With WisePricer you’ll never get left behind the competition.</description>
|
11 |
<notes>Set bigger time limit at install</notes>
|
12 |
+
<authors><author><name>Moshe</name><user>moshewp</user><email>moshe@wisepricer.com</email></author></authors>
|
13 |
+
<date>2016-03-01</date>
|
14 |
+
<time>20:28:52</time>
|
15 |
+
<contents><target name="magelocal"><dir name="Wisepricer"><dir name="Syncer"><dir name="Block"><dir name="Adminhtml"><file name="Mapping.php" hash="139db2ef5eca95fa1704d626b80f5c94"/><file name="Register.php" hash="ed2ffde3237ecba2dbdd6002b5077af3"/></dir></dir><dir name="Helper"><file name="Data.php" hash="2998a107bc39f2a0cd321bcbb165b00f"/></dir><dir name="Model"><dir name="Adminhtml"><file name="Attributes.php" hash="cadf0b88a3878ae0ec847b3c116cda43"/></dir><file name="Config.php" hash="d669c3dc977ddf71a58c90fa8df3180c"/><file name="Mapping.php" hash="d924ae8bcf54a3ca1224e8680d847fee"/><dir name="Mysql4"><dir name="Config"><file name="Collection.php" hash="c7c7b6844e3ff8893163c392f4132f30"/></dir><file name="Config.php" hash="61b7eb73489844aa0ee041c216bab2db"/><dir name="Mapping"><file name="Collection.php" hash="c0f15143db582e070cfb83de92c57d09"/></dir><file name="Mapping.php" hash="d97574adda931ce798964c67041f6af5"/></dir><file name="Observer.php" hash="6d7216c55bb46f202a33f61bcad556d6"/><file name="Reprice.php" hash="3c5cfe0758c2bc433b3b46e0ea3ab539"/><dir name="Source"><file name="Boolean.php" hash="dbb3f3187972a1a918eec16345de987a"/></dir></dir><dir name="controllers"><dir name="Adminhtml"><file name="SyncerController.php" hash="9aa11d88f7a97ef8557771321fcbcffe"/></dir><file name="BaseController.php" hash="def65eee1964d7c0667e8cb32375e74c"/><file name="ProductsController.php" hash="7a94388f7d9b2b5a8bde670e6a342276"/><file name="SalesController.php" hash="eb9e9d553da503e43632bd5b1451b9be"/></dir><dir name="etc"><file name="config.xml" hash="cb47d5d294b1e4b449121d162ed71042"/></dir><dir name="lib"><dir name="phpseclib"><dir name="Crypt"><file name="AES.php" hash="dd67dd1dbc7706e6c740e8430054d5e0"/><file name="DES.php" hash="47ac443f1edd2833cdc2f4eb80aa9a71"/><file name="Hash.php" hash="9be22f6426f2176caebb34a6cd2cb579"/><file name="RC4.php" hash="c6ec724c3a5d807d5ea4645518c37d29"/><file name="RSA.php" hash="9bd5734f28d149d183c603643f6dbbb4"/><file name="Random.php" hash="5befc55c3423792c0cd50bc6d4f527b1"/><file name="Rijndael.php" hash="7a92c95c750dd9ec1b8ce92915b4aa35"/><file name="TripleDES.php" hash="07c384b505d52802803313126e9e3836"/></dir><dir name="Math"><file name="BigInteger.php" hash="61aa9373ea606c928187d168159ac3f8"/></dir><dir name="Net"><file name="SFTP.php" hash="029f797c16ddd23b1d65636a72141115"/><file name="SSH1.php" hash="818d83815fe9bb5741594226bbdad975"/><file name="SSH2.php" hash="db5145effae044c7a1f6e7d778b566f5"/></dir><dir name="PHP"><dir name="Compat"><dir name="Function"><file name="array_fill.php" hash="840a674cac272c5588fa59f9421ed9a3"/><file name="bcpowmod.php" hash="4cb8fab0ee419f4b5a626980bbf04938"/><file name="str_split.php" hash="85cb5961afa62dde933190ee851a6d9a"/></dir></dir></dir></dir></dir><dir name="sql"><dir name="syncer_setup"><file name="mysql4-install-1.1.3.8.php" hash="2f1bf4346328ac1026c73173590e0afa"/><file name="mysql4-upgrade-1.1.4.6-1.1.4.7.php" hash="07995f1f86a06a2f8505bb67ce7e375a"/><file name="mysql4-upgrade-1.1.4.7-1.1.4.8.php" hash="83e2e87669f2c4f491167b1a444c58cd"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Wisepricer_Syncer.xml" hash="ab10056fb463e1b72841741d8afb546f"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="syncer.xml" hash="a9d0f0b5af6b7bc28fb3c3b897c1773c"/></dir><dir name="template"><dir name="wisepricer"><file name="mapping.phtml" hash="73de9345b356cc502b2c3fae61a55de3"/></dir></dir></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="wisepricer"><file name="bullet-green.png" hash="78d917a9d9aea11366bada6e0ae53931"/><file name="validation_advice_bg.gif" hash="ffdad80de989e3b04a977be3778c4347"/><file name="wp-alert-icon.png" hash="0dbbadfbbe2329098d03f8351aa2eaf2"/><file name="wp-logo.png" hash="48db98cdfc570336c942271352f31094"/><file name="wp-save-btn.png" hash="6d8e02c7f5e54dcc705e6436f126c66d"/></dir></dir><dir name="wisepricer"><file name="chosen-sprite.png" hash="8e70d120437ffc6a1bf7cebeca292d5c"/><file name="chosen.css" hash="bcd3f3e697219898e26631ccf29d97ba"/><file name="chosen.proto.js" hash="8259b22f4f337ba9ab63506b5ee4a52f"/><file name="myprototype.js" hash="2325b8b147c5dfaa8531c9d8bafd3648"/><file name="prototype17.js" hash="2325b8b147c5dfaa8531c9d8bafd3648"/><file name="wisepricer.css" hash="bd4dc50e10de4b41ae1c0ab18b2045ad"/></dir></dir></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>
|