Version Notes
- Improve redirect to cart on recover
Download this release
Release Info
| Developer | Maxime Pruvost |
| Extension | cartsguru |
| Version | 1.3.4 |
| Comparing to | |
| See all releases | |
Code changes from version 1.3.3 to 1.3.4
- app/code/local/Cartsguru/Block/Pixel.php +48 -48
- app/code/local/Cartsguru/Helper/Data.php +11 -14
- app/code/local/Cartsguru/Helper/Tools.php +5 -3
- app/code/local/Cartsguru/Model/Catalog.php +204 -192
- app/code/local/Cartsguru/Model/Observer.php +11 -8
- app/code/local/Cartsguru/Model/Webservice.php +44 -39
- app/code/local/Cartsguru/controllers/AdminController.php +47 -46
- app/code/local/Cartsguru/controllers/CatalogController.php +24 -24
- app/code/local/Cartsguru/controllers/IndexController.php +4 -3
- app/code/local/Cartsguru/controllers/RecovercartController.php +29 -11
- app/code/local/Cartsguru/controllers/SaveaccountController.php +36 -35
- app/code/local/Cartsguru/etc/config.xml +1 -1
- app/code/local/Cartsguru/sql/cartsguru_setup/install-1.0.0.php +1 -1
- app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.0.0-1.0.1.php +1 -1
- app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.0.1-1.0.2.php +1 -1
- app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.0.2-1.1.0.php +1 -1
- app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.1.0-1.1.1.php +1 -1
- app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.1.1-1.1.2.php +1 -1
- app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.1.2-1.1.3.php +1 -1
- app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.1.3-1.1.4 .php +1 -1
- app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.1.4-1.1.5.php +1 -1
- app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.1.5-1.2.0.php +1 -1
- app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.2.0-1.2.1.php +1 -1
- app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.2.1-1.2.2.php +1 -1
- app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.2.14-1.2.15.php +6 -6
- app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.2.15-1.2.16.php +6 -6
- app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.2.16-1.3.0.php +6 -6
- app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.2.2-1.2.3.php +1 -1
- app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.2.3-1.2.4.php +1 -1
- app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.2.4-1.2.5.php +1 -1
- app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.2.5-1.2.6.php +1 -1
- app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.2.6-1.2.7.php +1 -1
- app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.2.7-1.2.8.php +1 -1
- app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.2.8-1.2.9.php +1 -1
- app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.3.0-1.3.1.php +6 -6
- app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.3.1-1.3.2.php +6 -6
- app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.3.2-1.3.3.php +6 -6
- app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.3.3-1.3.4.php +6 -0
- package.xml +5 -7
app/code/local/Cartsguru/Block/Pixel.php
CHANGED
|
@@ -1,48 +1,48 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Cartsguru_Block_Pixel extends Mage_Core_Block_Template
|
| 4 |
-
{
|
| 5 |
-
/**
|
| 6 |
-
* Check if Facebook is enabled
|
| 7 |
-
*/
|
| 8 |
-
protected function isFacebookEnabled()
|
| 9 |
-
{
|
| 10 |
-
return Mage::helper('cartsguru')->getStoreConfig("feature_facebook");
|
| 11 |
-
}
|
| 12 |
-
|
| 13 |
-
/**
|
| 14 |
-
* Get FB pixel from config
|
| 15 |
-
*/
|
| 16 |
-
protected function getPixel()
|
| 17 |
-
{
|
| 18 |
-
return Mage::helper('cartsguru')->getStoreConfig("facebook_pixel");
|
| 19 |
-
}
|
| 20 |
-
|
| 21 |
-
/**
|
| 22 |
-
* Get CatalogId from config
|
| 23 |
-
*/
|
| 24 |
-
protected function getCatalogId()
|
| 25 |
-
{
|
| 26 |
-
return Mage::helper('cartsguru')->getStoreConfig("facebook_catalogId");
|
| 27 |
-
}
|
| 28 |
-
|
| 29 |
-
/**
|
| 30 |
-
* Get the product added to cart that we saved in session
|
| 31 |
-
*/
|
| 32 |
-
protected function getAddToCartProduct()
|
| 33 |
-
{
|
| 34 |
-
$productData = Mage::getSingleton('core/session')->getCartsGuruAddToCart();
|
| 35 |
-
if ($productData) {
|
| 36 |
-
Mage::getSingleton('core/session')->unsCartsGuruAddToCart();
|
| 37 |
-
return $productData;
|
| 38 |
-
}
|
| 39 |
-
return false;
|
| 40 |
-
}
|
| 41 |
-
/**
|
| 42 |
-
* Get the tracking URL
|
| 43 |
-
*/
|
| 44 |
-
protected function getTrackingURL()
|
| 45 |
-
{
|
| 46 |
-
return $this->getUrl('cartsguru/saveaccount');
|
| 47 |
-
}
|
| 48 |
-
}
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Cartsguru_Block_Pixel extends Mage_Core_Block_Template
|
| 4 |
+
{
|
| 5 |
+
/**
|
| 6 |
+
* Check if Facebook is enabled
|
| 7 |
+
*/
|
| 8 |
+
protected function isFacebookEnabled()
|
| 9 |
+
{
|
| 10 |
+
return Mage::helper('cartsguru')->getStoreConfig("feature_facebook");
|
| 11 |
+
}
|
| 12 |
+
|
| 13 |
+
/**
|
| 14 |
+
* Get FB pixel from config
|
| 15 |
+
*/
|
| 16 |
+
protected function getPixel()
|
| 17 |
+
{
|
| 18 |
+
return Mage::helper('cartsguru')->getStoreConfig("facebook_pixel");
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* Get CatalogId from config
|
| 23 |
+
*/
|
| 24 |
+
protected function getCatalogId()
|
| 25 |
+
{
|
| 26 |
+
return Mage::helper('cartsguru')->getStoreConfig("facebook_catalogId");
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
/**
|
| 30 |
+
* Get the product added to cart that we saved in session
|
| 31 |
+
*/
|
| 32 |
+
protected function getAddToCartProduct()
|
| 33 |
+
{
|
| 34 |
+
$productData = Mage::getSingleton('core/session')->getCartsGuruAddToCart();
|
| 35 |
+
if ($productData) {
|
| 36 |
+
Mage::getSingleton('core/session')->unsCartsGuruAddToCart();
|
| 37 |
+
return $productData;
|
| 38 |
+
}
|
| 39 |
+
return false;
|
| 40 |
+
}
|
| 41 |
+
/**
|
| 42 |
+
* Get the tracking URL
|
| 43 |
+
*/
|
| 44 |
+
protected function getTrackingURL()
|
| 45 |
+
{
|
| 46 |
+
return $this->getUrl('cartsguru/saveaccount');
|
| 47 |
+
}
|
| 48 |
+
}
|
app/code/local/Cartsguru/Helper/Data.php
CHANGED
|
@@ -61,26 +61,22 @@ class Cartsguru_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 61 |
}
|
| 62 |
|
| 63 |
// Get store from admin
|
| 64 |
-
public function getStoreFromAdmin()
|
|
|
|
| 65 |
$store_id = null;
|
| 66 |
-
if (strlen($code = Mage::getSingleton('adminhtml/config_data')->getStore())) // store level
|
| 67 |
-
{
|
| 68 |
$store_id = Mage::getModel('core/store')->load($code)->getId();
|
| 69 |
-
}
|
| 70 |
-
elseif (strlen($code = Mage::getSingleton('adminhtml/config_data')->getWebsite())) // website level
|
| 71 |
-
{
|
| 72 |
$website_id = Mage::getModel('core/website')->load($code)->getId();
|
| 73 |
$store_id = Mage::app()->getWebsite($website_id)->getDefaultStore()->getId();
|
| 74 |
-
}
|
| 75 |
-
elseif (strlen($code = Mage::app()->getRequest()->getParam('website'))) {
|
| 76 |
$website_id = Mage::getModel('core/website')->load($code)->getId();
|
| 77 |
$store_id = Mage::app()->getWebsite($website_id)->getDefaultStore()->getId();
|
| 78 |
}
|
| 79 |
|
| 80 |
-
if ($store_id){
|
| 81 |
return Mage::app()->getStore($store_id);
|
| 82 |
-
}
|
| 83 |
-
else {
|
| 84 |
return Mage::app()->getStore();
|
| 85 |
}
|
| 86 |
}
|
|
@@ -88,15 +84,16 @@ class Cartsguru_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 88 |
// Save config in store
|
| 89 |
public function setStoreConfig($key, $value, $store = null)
|
| 90 |
{
|
| 91 |
-
if (!$store){
|
| 92 |
$store = Mage::app()->getStore();
|
| 93 |
}
|
| 94 |
|
| 95 |
Mage::getConfig()->saveConfig($this->configBasePath . $key, $value, 'stores', $store->getStoreId());
|
| 96 |
}
|
| 97 |
// Get store config
|
| 98 |
-
public function getStoreConfig($key, $store = null)
|
| 99 |
-
|
|
|
|
| 100 |
$store = Mage::app()->getStore();
|
| 101 |
}
|
| 102 |
|
| 61 |
}
|
| 62 |
|
| 63 |
// Get store from admin
|
| 64 |
+
public function getStoreFromAdmin()
|
| 65 |
+
{
|
| 66 |
$store_id = null;
|
| 67 |
+
if (strlen($code = Mage::getSingleton('adminhtml/config_data')->getStore())) { // store level
|
|
|
|
| 68 |
$store_id = Mage::getModel('core/store')->load($code)->getId();
|
| 69 |
+
} elseif (strlen($code = Mage::getSingleton('adminhtml/config_data')->getWebsite())) { // website level
|
|
|
|
|
|
|
| 70 |
$website_id = Mage::getModel('core/website')->load($code)->getId();
|
| 71 |
$store_id = Mage::app()->getWebsite($website_id)->getDefaultStore()->getId();
|
| 72 |
+
} elseif (strlen($code = Mage::app()->getRequest()->getParam('website'))) {
|
|
|
|
| 73 |
$website_id = Mage::getModel('core/website')->load($code)->getId();
|
| 74 |
$store_id = Mage::app()->getWebsite($website_id)->getDefaultStore()->getId();
|
| 75 |
}
|
| 76 |
|
| 77 |
+
if ($store_id) {
|
| 78 |
return Mage::app()->getStore($store_id);
|
| 79 |
+
} else {
|
|
|
|
| 80 |
return Mage::app()->getStore();
|
| 81 |
}
|
| 82 |
}
|
| 84 |
// Save config in store
|
| 85 |
public function setStoreConfig($key, $value, $store = null)
|
| 86 |
{
|
| 87 |
+
if (!$store) {
|
| 88 |
$store = Mage::app()->getStore();
|
| 89 |
}
|
| 90 |
|
| 91 |
Mage::getConfig()->saveConfig($this->configBasePath . $key, $value, 'stores', $store->getStoreId());
|
| 92 |
}
|
| 93 |
// Get store config
|
| 94 |
+
public function getStoreConfig($key, $store = null)
|
| 95 |
+
{
|
| 96 |
+
if (!$store) {
|
| 97 |
$store = Mage::app()->getStore();
|
| 98 |
}
|
| 99 |
|
app/code/local/Cartsguru/Helper/Tools.php
CHANGED
|
@@ -3,14 +3,16 @@
|
|
| 3 |
/**
|
| 4 |
* Class Cartsguru_Helper_Tools
|
| 5 |
*/
|
| 6 |
-
class Cartsguru_Helper_Tools
|
|
|
|
| 7 |
|
| 8 |
/**
|
| 9 |
* This method generate a random uuid v4
|
| 10 |
* @param $customer
|
| 11 |
*/
|
| 12 |
-
public static function generateUUID()
|
| 13 |
-
|
|
|
|
| 14 |
|
| 15 |
// 32 bits for "time_low"
|
| 16 |
mt_rand(0, 0xffff), mt_rand(0, 0xffff),
|
| 3 |
/**
|
| 4 |
* Class Cartsguru_Helper_Tools
|
| 5 |
*/
|
| 6 |
+
class Cartsguru_Helper_Tools
|
| 7 |
+
{
|
| 8 |
|
| 9 |
/**
|
| 10 |
* This method generate a random uuid v4
|
| 11 |
* @param $customer
|
| 12 |
*/
|
| 13 |
+
public static function generateUUID()
|
| 14 |
+
{
|
| 15 |
+
return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
|
| 16 |
|
| 17 |
// 32 bits for "time_low"
|
| 18 |
mt_rand(0, 0xffff), mt_rand(0, 0xffff),
|
app/code/local/Cartsguru/Model/Catalog.php
CHANGED
|
@@ -1,192 +1,204 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
/**
|
| 4 |
-
* This class generates catalog feed for Facebook
|
| 5 |
-
* Class Cartsguru_Model_Catalog
|
| 6 |
-
*/
|
| 7 |
-
class Cartsguru_Model_Catalog
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
*
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
'
|
| 17 |
-
'
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
'
|
| 22 |
-
'
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
'
|
| 28 |
-
'
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
'
|
| 33 |
-
'
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
'
|
| 38 |
-
'
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
'
|
| 43 |
-
'
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
'
|
| 48 |
-
'
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
'
|
| 53 |
-
'
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
'
|
| 72 |
-
'
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
$productCollection
|
| 77 |
-
$productCollection->
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
$value
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
$value = $
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
$value
|
| 129 |
-
break;
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
$value =
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
$product_data['
|
| 148 |
-
}
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
}
|
| 180 |
-
break;
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
$
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
/**
|
| 4 |
+
* This class generates catalog feed for Facebook
|
| 5 |
+
* Class Cartsguru_Model_Catalog
|
| 6 |
+
*/
|
| 7 |
+
class Cartsguru_Model_Catalog
|
| 8 |
+
{
|
| 9 |
+
|
| 10 |
+
/**
|
| 11 |
+
* The fields to be put into the feed.
|
| 12 |
+
* @var array
|
| 13 |
+
*/
|
| 14 |
+
protected $_requiredFields = array(
|
| 15 |
+
array(
|
| 16 |
+
'magento' => 'id',
|
| 17 |
+
'feed' => 'id',
|
| 18 |
+
'type' => 'id',
|
| 19 |
+
),
|
| 20 |
+
array(
|
| 21 |
+
'magento' => 'availability_google',
|
| 22 |
+
'feed' => 'availability',
|
| 23 |
+
'type' => 'computed',
|
| 24 |
+
),
|
| 25 |
+
// condition here
|
| 26 |
+
array(
|
| 27 |
+
'magento' => 'description',
|
| 28 |
+
'feed' => 'description',
|
| 29 |
+
'type' => 'product_attribute',
|
| 30 |
+
),
|
| 31 |
+
array(
|
| 32 |
+
'magento' => 'image_url',
|
| 33 |
+
'feed' => 'image_link',
|
| 34 |
+
'type' => 'computed',
|
| 35 |
+
),
|
| 36 |
+
array(
|
| 37 |
+
'magento' => 'product_link',
|
| 38 |
+
'feed' => 'link',
|
| 39 |
+
'type' => 'computed',
|
| 40 |
+
),
|
| 41 |
+
array(
|
| 42 |
+
'magento' => 'name',
|
| 43 |
+
'feed' => 'title',
|
| 44 |
+
'type' => 'product_attribute',
|
| 45 |
+
),
|
| 46 |
+
array(
|
| 47 |
+
'magento' => 'manufacturer',
|
| 48 |
+
'feed' => 'brand',
|
| 49 |
+
'type' => 'product_attribute',
|
| 50 |
+
),
|
| 51 |
+
array(
|
| 52 |
+
'magento' => 'price',
|
| 53 |
+
'feed' => 'price',
|
| 54 |
+
'type' => 'computed',
|
| 55 |
+
)
|
| 56 |
+
);
|
| 57 |
+
|
| 58 |
+
/*
|
| 59 |
+
* Generate XML product feed
|
| 60 |
+
*/
|
| 61 |
+
public function generateFeed($store, $offset, $limit)
|
| 62 |
+
{
|
| 63 |
+
// setup attribute mapping
|
| 64 |
+
$this->_attributes = array();
|
| 65 |
+
|
| 66 |
+
foreach ($this->_requiredFields as $requiredField) {
|
| 67 |
+
$this->_attributes[$requiredField['feed']] = $requiredField;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
$result = array(
|
| 71 |
+
'url' => $store->getBaseUrl(),
|
| 72 |
+
'store_name' => $store->getFrontendName(),
|
| 73 |
+
'total' => Mage::getModel('catalog/product')->getCollection()->addStoreFilter()->addFieldToFilter('status', '1')->getSize()
|
| 74 |
+
);
|
| 75 |
+
|
| 76 |
+
$productCollection = Mage::getResourceModel('catalog/product_collection');
|
| 77 |
+
$productCollection->addStoreFilter();
|
| 78 |
+
$productCollection->addFieldToFilter('status', '1');
|
| 79 |
+
|
| 80 |
+
$this->_products = array();
|
| 81 |
+
Mage::getSingleton('core/resource_iterator')->walk($productCollection->getSelect()->limit($limit, $offset), array(array($this, 'processProduct')));
|
| 82 |
+
$result['products'] = $this->_products;
|
| 83 |
+
|
| 84 |
+
return $result;
|
| 85 |
+
}
|
| 86 |
+
|
| 87 |
+
/*
|
| 88 |
+
* Process each product in a loop
|
| 89 |
+
*/
|
| 90 |
+
public function processProduct($args)
|
| 91 |
+
{
|
| 92 |
+
$product = Mage::getModel('catalog/product')->load($args['row']['entity_id']);
|
| 93 |
+
// check if configurable product and has issues with attributes
|
| 94 |
+
if ($product->isConfigurable()) {
|
| 95 |
+
$product->getTypeInstance(true)->setStoreFilter($product->getStore(), $product);
|
| 96 |
+
$attributes = $product->getTypeInstance(true)->getConfigurableAttributes($product);
|
| 97 |
+
foreach ($attributes as $attribute) {
|
| 98 |
+
$attribute = $attribute->getProductAttribute();
|
| 99 |
+
if (empty($attribute)) {
|
| 100 |
+
return;
|
| 101 |
+
}
|
| 102 |
+
}
|
| 103 |
+
}
|
| 104 |
+
|
| 105 |
+
$product_data = array();
|
| 106 |
+
$attributes = $this->_attributes;
|
| 107 |
+
// store
|
| 108 |
+
$store = Mage::getModel('core/store')->load($product->getStoreId());
|
| 109 |
+
// Prepare attributes
|
| 110 |
+
foreach ($attributes as $attribute) {
|
| 111 |
+
if ($attribute['type'] == 'id') {
|
| 112 |
+
$value = $product->getId();
|
| 113 |
+
} elseif ($attribute['type'] == 'product_attribute') {
|
| 114 |
+
// if this is a normal product attribute, retrieve it's frontend representation
|
| 115 |
+
if ($product->getData($attribute['magento']) === null) {
|
| 116 |
+
$value = '';
|
| 117 |
+
} else {
|
| 118 |
+
/** @var $attributeObj Mage_Catalog_Model_Resource_Eav_Attribute */
|
| 119 |
+
$attributeObj = $product->getResource()->getAttribute($attribute['magento']);
|
| 120 |
+
$value = $attributeObj->getFrontend()->getValue($product);
|
| 121 |
+
}
|
| 122 |
+
} elseif ($attribute['type'] == 'computed') {
|
| 123 |
+
// if this is a computed attribute, handle it depending on its code
|
| 124 |
+
switch ($attribute['magento']) {
|
| 125 |
+
case 'price':
|
| 126 |
+
$price = Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), true);
|
| 127 |
+
$value = sprintf('%.2f', (float)($store->convertPrice($price, false, false)));
|
| 128 |
+
$value .= ' '.Mage::getStoreConfig('currency/options/default', $product->getStoreId());
|
| 129 |
+
break;
|
| 130 |
+
|
| 131 |
+
case 'product_link':
|
| 132 |
+
$value = $product->getProductUrl();
|
| 133 |
+
break;
|
| 134 |
+
|
| 135 |
+
case 'image_url':
|
| 136 |
+
$value = (string)Mage::helper('catalog/image')->init($product, 'image');
|
| 137 |
+
break;
|
| 138 |
+
|
| 139 |
+
case 'availability_google':
|
| 140 |
+
$value = $product->isSaleable() ? 'in stock' : 'out of stock';
|
| 141 |
+
break;
|
| 142 |
+
|
| 143 |
+
default:
|
| 144 |
+
$value = '';
|
| 145 |
+
}
|
| 146 |
+
}
|
| 147 |
+
$product_data[$attribute['feed']] = $value;
|
| 148 |
+
}
|
| 149 |
+
|
| 150 |
+
$price = floatval($product_data['price']);
|
| 151 |
+
// Price is required
|
| 152 |
+
if (empty($price)) {
|
| 153 |
+
return;
|
| 154 |
+
}
|
| 155 |
+
|
| 156 |
+
// If manufacturer not set use mpn === sku
|
| 157 |
+
if ($product_data['brand'] === '') {
|
| 158 |
+
unset($product_data['brand']);
|
| 159 |
+
$product_data['mpn'] = $product_data['id'];
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
// All products are new
|
| 163 |
+
$product_data['condition'] = 'new';
|
| 164 |
+
|
| 165 |
+
foreach ($product_data as $feedTag => $value) {
|
| 166 |
+
$safeString = null;
|
| 167 |
+
switch ($feedTag) {
|
| 168 |
+
case 'link':
|
| 169 |
+
$safeString = $value;
|
| 170 |
+
break;
|
| 171 |
+
|
| 172 |
+
case 'price':
|
| 173 |
+
$safeString = sprintf('%.2f', $store->convertPrice($value, false, false)).' '.Mage::getStoreConfig('currency/options/default', $store->getStoreId());
|
| 174 |
+
break;
|
| 175 |
+
|
| 176 |
+
case 'sale_price':
|
| 177 |
+
if ($value && $value != '') {
|
| 178 |
+
$safeString = sprintf('%.2f', $store->convertPrice($value, false, false)).' '.Mage::getStoreConfig('currency/options/default', $store->getStoreId());
|
| 179 |
+
}
|
| 180 |
+
break;
|
| 181 |
+
|
| 182 |
+
case 'image_link':
|
| 183 |
+
if ($value == 'no_selection') {
|
| 184 |
+
$safeString = '';
|
| 185 |
+
} else {
|
| 186 |
+
$safeString = $value;
|
| 187 |
+
// Check if the link is a full URL
|
| 188 |
+
if (substr($value, 0, 5) != 'http:' && substr($value, 0, 6) != 'https:') {
|
| 189 |
+
$safeString = $store->getBaseUrl('media') . 'catalog/product' . $value;
|
| 190 |
+
}
|
| 191 |
+
}
|
| 192 |
+
break;
|
| 193 |
+
|
| 194 |
+
default:
|
| 195 |
+
$safeString = $value;
|
| 196 |
+
break;
|
| 197 |
+
}
|
| 198 |
+
if ($safeString !== null) {
|
| 199 |
+
$product_data[$feedTag] = $safeString;
|
| 200 |
+
}
|
| 201 |
+
}
|
| 202 |
+
$this->_products[] = $product_data;
|
| 203 |
+
}
|
| 204 |
+
}
|
app/code/local/Cartsguru/Model/Observer.php
CHANGED
|
@@ -21,13 +21,13 @@ class Cartsguru_Model_Observer
|
|
| 21 |
|
| 22 |
$result = $webservice->checkAddress();
|
| 23 |
|
| 24 |
-
if ($result == false){
|
| 25 |
return $session->addError('Error check connection');
|
| 26 |
}
|
| 27 |
|
| 28 |
$session->addSuccess('Connection checked');
|
| 29 |
|
| 30 |
-
if ($result->isNew){
|
| 31 |
$webservice->sendHistory();
|
| 32 |
}
|
| 33 |
|
|
@@ -58,9 +58,9 @@ class Cartsguru_Model_Observer
|
|
| 58 |
|
| 59 |
Mage::log('Observer: Start handle quoteSaveBefore for ' . $quote->getId(), null, Cartsguru_Model_Observer::LOG_FILE);
|
| 60 |
|
| 61 |
-
if (!$quote->getData('cartsguru_token')){
|
| 62 |
$tools = Mage::helper('cartsguru/tools');
|
| 63 |
-
$quote->setData('cartsguru_token'
|
| 64 |
}
|
| 65 |
|
| 66 |
Mage::log('Observer: End handle quoteSaveBefore for ' . $quote->getId(), null, Cartsguru_Model_Observer::LOG_FILE);
|
|
@@ -85,7 +85,8 @@ class Cartsguru_Model_Observer
|
|
| 85 |
* Handle order updated, and push it to carts guru
|
| 86 |
* @param $observer
|
| 87 |
*/
|
| 88 |
-
public function orderSaveAfter($observer)
|
|
|
|
| 89 |
/* @var Mage_Sales_Model_Order $order */
|
| 90 |
$order = $observer->getOrder();
|
| 91 |
|
|
@@ -97,14 +98,15 @@ class Cartsguru_Model_Observer
|
|
| 97 |
Mage::getModel('cartsguru/webservice')->sendOrder($order);
|
| 98 |
}
|
| 99 |
|
| 100 |
-
|
| 101 |
}
|
| 102 |
|
| 103 |
/**
|
| 104 |
* Saves added product data to fire FB pixel
|
| 105 |
* @param $observer
|
| 106 |
*/
|
| 107 |
-
public function checkoutCartAdd($observer)
|
|
|
|
| 108 |
$helper = Mage::helper('cartsguru');
|
| 109 |
$facebook_enabled = $helper->getStoreConfig("feature_facebook");
|
| 110 |
if ($facebook_enabled) {
|
|
@@ -133,7 +135,8 @@ class Cartsguru_Model_Observer
|
|
| 133 |
* Check if we have source query param ans set the cookie
|
| 134 |
* @param $observer
|
| 135 |
*/
|
| 136 |
-
public function checkSource($observer)
|
|
|
|
| 137 |
$utm_source = Mage::app()->getRequest()->getParam('utm_source');
|
| 138 |
$utm_campaign = Mage::app()->getRequest()->getParam('utm_campaign');
|
| 139 |
if ($utm_source && $utm_campaign) {
|
| 21 |
|
| 22 |
$result = $webservice->checkAddress();
|
| 23 |
|
| 24 |
+
if ($result == false) {
|
| 25 |
return $session->addError('Error check connection');
|
| 26 |
}
|
| 27 |
|
| 28 |
$session->addSuccess('Connection checked');
|
| 29 |
|
| 30 |
+
if ($result->isNew) {
|
| 31 |
$webservice->sendHistory();
|
| 32 |
}
|
| 33 |
|
| 58 |
|
| 59 |
Mage::log('Observer: Start handle quoteSaveBefore for ' . $quote->getId(), null, Cartsguru_Model_Observer::LOG_FILE);
|
| 60 |
|
| 61 |
+
if (!$quote->getData('cartsguru_token')) {
|
| 62 |
$tools = Mage::helper('cartsguru/tools');
|
| 63 |
+
$quote->setData('cartsguru_token', $tools::generateUUID());
|
| 64 |
}
|
| 65 |
|
| 66 |
Mage::log('Observer: End handle quoteSaveBefore for ' . $quote->getId(), null, Cartsguru_Model_Observer::LOG_FILE);
|
| 85 |
* Handle order updated, and push it to carts guru
|
| 86 |
* @param $observer
|
| 87 |
*/
|
| 88 |
+
public function orderSaveAfter($observer)
|
| 89 |
+
{
|
| 90 |
/* @var Mage_Sales_Model_Order $order */
|
| 91 |
$order = $observer->getOrder();
|
| 92 |
|
| 98 |
Mage::getModel('cartsguru/webservice')->sendOrder($order);
|
| 99 |
}
|
| 100 |
|
| 101 |
+
Mage::log('Observer: End handle orderSaveAfter for ' . $order->getIncrementId(), null, Cartsguru_Model_Observer::LOG_FILE);
|
| 102 |
}
|
| 103 |
|
| 104 |
/**
|
| 105 |
* Saves added product data to fire FB pixel
|
| 106 |
* @param $observer
|
| 107 |
*/
|
| 108 |
+
public function checkoutCartAdd($observer)
|
| 109 |
+
{
|
| 110 |
$helper = Mage::helper('cartsguru');
|
| 111 |
$facebook_enabled = $helper->getStoreConfig("feature_facebook");
|
| 112 |
if ($facebook_enabled) {
|
| 135 |
* Check if we have source query param ans set the cookie
|
| 136 |
* @param $observer
|
| 137 |
*/
|
| 138 |
+
public function checkSource($observer)
|
| 139 |
+
{
|
| 140 |
$utm_source = Mage::app()->getRequest()->getParam('utm_source');
|
| 141 |
$utm_campaign = Mage::app()->getRequest()->getParam('utm_campaign');
|
| 142 |
if ($utm_source && $utm_campaign) {
|
app/code/local/Cartsguru/Model/Webservice.php
CHANGED
|
@@ -16,10 +16,11 @@ class Cartsguru_Model_Webservice
|
|
| 16 |
const QUOTES_CACHE_TAG = 'cartsguru_carts';
|
| 17 |
const QUOTES_CACHE_TTL = 1800; // 30min in seconds
|
| 18 |
|
| 19 |
-
const _CARTSGURU_VERSION_ = '1.3.
|
| 20 |
|
| 21 |
-
public function isStoreConfigured($store = null)
|
| 22 |
-
|
|
|
|
| 23 |
$store = Mage::app()->getStore();
|
| 24 |
}
|
| 25 |
$helper = Mage::helper('cartsguru');
|
|
@@ -79,7 +80,8 @@ class Cartsguru_Model_Webservice
|
|
| 79 |
* @param $obj order or quote
|
| 80 |
* @return float
|
| 81 |
*/
|
| 82 |
-
public function getTotalATI($items)
|
|
|
|
| 83 |
$totalATI = (float)0;
|
| 84 |
|
| 85 |
foreach ($items as $item) {
|
|
@@ -89,20 +91,20 @@ class Cartsguru_Model_Webservice
|
|
| 89 |
return $totalATI;
|
| 90 |
}
|
| 91 |
|
| 92 |
-
protected function getProudctImageUrl($product)
|
| 93 |
-
|
|
|
|
| 94 |
return $imageUrl = $this->notEmpty(null);
|
| 95 |
}
|
| 96 |
|
| 97 |
$image = null;
|
| 98 |
|
| 99 |
//Handle 1.9.0 feature
|
| 100 |
-
if (version_compare(Mage::getVersion(), '1.9.0', '>=')){
|
| 101 |
//Check if need resize or not
|
| 102 |
-
if (Mage::getStoreConfig(Mage_Catalog_Helper_Image::XML_NODE_PRODUCT_SMALL_IMAGE_WIDTH) < 120){
|
| 103 |
-
$image = Mage::helper('catalog/image')->init($product, 'image')->resize(120,120);
|
| 104 |
-
}
|
| 105 |
-
else {
|
| 106 |
$image = Mage::helper('catalog/image')->init($product, 'small_image');
|
| 107 |
}
|
| 108 |
} else {
|
|
@@ -113,7 +115,7 @@ class Cartsguru_Model_Webservice
|
|
| 113 |
$image = (string)$image;
|
| 114 |
|
| 115 |
//Work with the normal image if no small image available
|
| 116 |
-
if (empty($image)){
|
| 117 |
$image = Mage::helper('catalog/image')->init($product, 'image');
|
| 118 |
$image = (string)$image;
|
| 119 |
}
|
|
@@ -126,7 +128,8 @@ class Cartsguru_Model_Webservice
|
|
| 126 |
* @param $obj order or quote
|
| 127 |
* @return array
|
| 128 |
*/
|
| 129 |
-
public function getItemsData($obj)
|
|
|
|
| 130 |
$cache = Mage::app()->getCache();
|
| 131 |
$items = array();
|
| 132 |
foreach ($obj->getAllVisibleItems() as $item) {
|
|
@@ -148,8 +151,7 @@ class Cartsguru_Model_Webservice
|
|
| 148 |
|
| 149 |
$tags = array(Cartsguru_Model_Webservice::CACHE_TAG, Cartsguru_Model_Webservice::PRODUCT_CACHE_TAG);
|
| 150 |
$cache->save(json_encode($productData), $cacheId, $tags, Cartsguru_Model_Webservice::PRODUCT_CACHE_TTL);
|
| 151 |
-
}
|
| 152 |
-
else {
|
| 153 |
$productData = json_decode($productData, true);
|
| 154 |
}
|
| 155 |
|
|
@@ -179,7 +181,7 @@ class Cartsguru_Model_Webservice
|
|
| 179 |
{
|
| 180 |
$helper = Mage::helper('cartsguru');
|
| 181 |
//Order must have a status
|
| 182 |
-
if (!$order->getStatus()){
|
| 183 |
return null;
|
| 184 |
}
|
| 185 |
|
|
@@ -234,7 +236,7 @@ class Cartsguru_Model_Webservice
|
|
| 234 |
$store = Mage::app()->getStore($order->getStoreId());
|
| 235 |
|
| 236 |
//Check is well configured
|
| 237 |
-
if (!$this->isStoreConfigured($store)){
|
| 238 |
return;
|
| 239 |
}
|
| 240 |
|
|
@@ -260,8 +262,9 @@ class Cartsguru_Model_Webservice
|
|
| 260 |
* @param $gender
|
| 261 |
* @return string
|
| 262 |
*/
|
| 263 |
-
public function genderMapping($gender)
|
| 264 |
-
|
|
|
|
| 265 |
case 1:
|
| 266 |
return 'mister';
|
| 267 |
case 2:
|
|
@@ -304,10 +307,10 @@ class Cartsguru_Model_Webservice
|
|
| 304 |
}
|
| 305 |
|
| 306 |
if ($address) {
|
| 307 |
-
if (!$phone){
|
| 308 |
$phone = $address->getTelephone();
|
| 309 |
}
|
| 310 |
-
if (!$country){
|
| 311 |
$country = $address->getCountryId();
|
| 312 |
}
|
| 313 |
}
|
|
@@ -315,10 +318,10 @@ class Cartsguru_Model_Webservice
|
|
| 315 |
if ($customer) {
|
| 316 |
$customerAddress = $customer->getDefaultBillingAddress();
|
| 317 |
|
| 318 |
-
if ($customerAddress && !$phone){
|
| 319 |
$phone = $customerAddress->getTelephone();
|
| 320 |
}
|
| 321 |
-
if ($customerAddress && !$country){
|
| 322 |
$country = $customerAddress->getCountryId();
|
| 323 |
}
|
| 324 |
}
|
|
@@ -373,13 +376,13 @@ class Cartsguru_Model_Webservice
|
|
| 373 |
$store = Mage::app()->getStore($quote->getStoreId());
|
| 374 |
|
| 375 |
//Check is well configured
|
| 376 |
-
if (!$this->isStoreConfigured($store)){
|
| 377 |
return;
|
| 378 |
}
|
| 379 |
|
| 380 |
//Get data and continue only if exist
|
| 381 |
$cartData = $this->getAbadonnedCartData($quote, $store);
|
| 382 |
-
if (!$cartData){
|
| 383 |
return;
|
| 384 |
}
|
| 385 |
|
|
@@ -469,7 +472,7 @@ class Cartsguru_Model_Webservice
|
|
| 469 |
public function sendAccount($customer)
|
| 470 |
{
|
| 471 |
//Check is well configured
|
| 472 |
-
if (!$this->isStoreConfigured()){
|
| 473 |
return;
|
| 474 |
}
|
| 475 |
|
|
@@ -495,7 +498,7 @@ class Cartsguru_Model_Webservice
|
|
| 495 |
|
| 496 |
$response = $this->doPostRequest($requestUrl, $fields, $store, true);
|
| 497 |
|
| 498 |
-
if (!$response || $response->getStatus() != 200){
|
| 499 |
return false;
|
| 500 |
}
|
| 501 |
|
|
@@ -514,12 +517,13 @@ class Cartsguru_Model_Webservice
|
|
| 514 |
$store = Mage::app()->getWebsite(true)->getDefaultGroup()->getDefaultStore();
|
| 515 |
|
| 516 |
$lastOrder = $this->sendLastOrders($store);
|
| 517 |
-
if ($lastOrder){
|
| 518 |
$this->sendLastQuotes($store, $lastOrder->getCreatedAt());
|
| 519 |
}
|
| 520 |
}
|
| 521 |
|
| 522 |
-
private function sendLastOrders($store)
|
|
|
|
| 523 |
$orders = array();
|
| 524 |
$last = null;
|
| 525 |
$items = Mage::getModel('sales/order')
|
|
@@ -528,7 +532,7 @@ class Cartsguru_Model_Webservice
|
|
| 528 |
->setPageSize($this->historySize)
|
| 529 |
->addFieldToFilter('store_id', $store->getStoreId());
|
| 530 |
|
| 531 |
-
foreach($items as $item){
|
| 532 |
$order = Mage::getModel("sales/order")->load($item->getId());
|
| 533 |
$last = $order;
|
| 534 |
|
|
@@ -536,20 +540,21 @@ class Cartsguru_Model_Webservice
|
|
| 536 |
$orderData = $this->getOrderData($order, $store);
|
| 537 |
|
| 538 |
//Append only if we get it
|
| 539 |
-
if (!empty($orderData)){
|
| 540 |
$orders[] = $orderData;
|
| 541 |
}
|
| 542 |
}
|
| 543 |
|
| 544 |
//Push orders to api
|
| 545 |
-
if (!empty($orders)){
|
| 546 |
$this->doPostRequest('/import/orders', $orders, $store);
|
| 547 |
}
|
| 548 |
|
| 549 |
return $last;
|
| 550 |
}
|
| 551 |
|
| 552 |
-
private function sendLastQuotes($store, $since)
|
|
|
|
| 553 |
$quotes = array();
|
| 554 |
$last = null;
|
| 555 |
$items = Mage::getModel('sales/quote')
|
|
@@ -558,23 +563,23 @@ class Cartsguru_Model_Webservice
|
|
| 558 |
->addFieldToFilter('store_id', $store->getStoreId())
|
| 559 |
->addFieldToFilter('created_at', array('gt' => $since));
|
| 560 |
|
| 561 |
-
foreach($items as $item){
|
| 562 |
$quote = Mage::getModel("sales/quote")->loadByIdWithoutStore($item->getId());
|
| 563 |
$last = $quote;
|
| 564 |
|
| 565 |
-
if ($quote){
|
| 566 |
//Get quote data
|
| 567 |
$quoteData = $this->getAbadonnedCartData($quote, $store);
|
| 568 |
|
| 569 |
//Append only if we get it
|
| 570 |
-
if ($quoteData){
|
| 571 |
$quotes[] = $quoteData;
|
| 572 |
}
|
| 573 |
}
|
| 574 |
}
|
| 575 |
|
| 576 |
//Push quotes to api
|
| 577 |
-
if (!empty($quotes)){
|
| 578 |
$this->doPostRequest('/import/carts', $quotes, $store);
|
| 579 |
}
|
| 580 |
|
|
@@ -605,9 +610,9 @@ class Cartsguru_Model_Webservice
|
|
| 605 |
$client->setUri($url);
|
| 606 |
$client->setRawData(json_encode($fields), 'application/json');
|
| 607 |
$response = $client->request(Zend_Http_Client::POST);
|
| 608 |
-
} catch (Exception $e) {
|
|
|
|
| 609 |
|
| 610 |
return $response;
|
| 611 |
}
|
| 612 |
-
|
| 613 |
}
|
| 16 |
const QUOTES_CACHE_TAG = 'cartsguru_carts';
|
| 17 |
const QUOTES_CACHE_TTL = 1800; // 30min in seconds
|
| 18 |
|
| 19 |
+
const _CARTSGURU_VERSION_ = '1.3.4';
|
| 20 |
|
| 21 |
+
public function isStoreConfigured($store = null)
|
| 22 |
+
{
|
| 23 |
+
if (!$store) {
|
| 24 |
$store = Mage::app()->getStore();
|
| 25 |
}
|
| 26 |
$helper = Mage::helper('cartsguru');
|
| 80 |
* @param $obj order or quote
|
| 81 |
* @return float
|
| 82 |
*/
|
| 83 |
+
public function getTotalATI($items)
|
| 84 |
+
{
|
| 85 |
$totalATI = (float)0;
|
| 86 |
|
| 87 |
foreach ($items as $item) {
|
| 91 |
return $totalATI;
|
| 92 |
}
|
| 93 |
|
| 94 |
+
protected function getProudctImageUrl($product)
|
| 95 |
+
{
|
| 96 |
+
if ($product->getImage() == 'no_selection' || !$product->getImage()) {
|
| 97 |
return $imageUrl = $this->notEmpty(null);
|
| 98 |
}
|
| 99 |
|
| 100 |
$image = null;
|
| 101 |
|
| 102 |
//Handle 1.9.0 feature
|
| 103 |
+
if (version_compare(Mage::getVersion(), '1.9.0', '>=')) {
|
| 104 |
//Check if need resize or not
|
| 105 |
+
if (Mage::getStoreConfig(Mage_Catalog_Helper_Image::XML_NODE_PRODUCT_SMALL_IMAGE_WIDTH) < 120) {
|
| 106 |
+
$image = Mage::helper('catalog/image')->init($product, 'image')->resize(120, 120);
|
| 107 |
+
} else {
|
|
|
|
| 108 |
$image = Mage::helper('catalog/image')->init($product, 'small_image');
|
| 109 |
}
|
| 110 |
} else {
|
| 115 |
$image = (string)$image;
|
| 116 |
|
| 117 |
//Work with the normal image if no small image available
|
| 118 |
+
if (empty($image)) {
|
| 119 |
$image = Mage::helper('catalog/image')->init($product, 'image');
|
| 120 |
$image = (string)$image;
|
| 121 |
}
|
| 128 |
* @param $obj order or quote
|
| 129 |
* @return array
|
| 130 |
*/
|
| 131 |
+
public function getItemsData($obj)
|
| 132 |
+
{
|
| 133 |
$cache = Mage::app()->getCache();
|
| 134 |
$items = array();
|
| 135 |
foreach ($obj->getAllVisibleItems() as $item) {
|
| 151 |
|
| 152 |
$tags = array(Cartsguru_Model_Webservice::CACHE_TAG, Cartsguru_Model_Webservice::PRODUCT_CACHE_TAG);
|
| 153 |
$cache->save(json_encode($productData), $cacheId, $tags, Cartsguru_Model_Webservice::PRODUCT_CACHE_TTL);
|
| 154 |
+
} else {
|
|
|
|
| 155 |
$productData = json_decode($productData, true);
|
| 156 |
}
|
| 157 |
|
| 181 |
{
|
| 182 |
$helper = Mage::helper('cartsguru');
|
| 183 |
//Order must have a status
|
| 184 |
+
if (!$order->getStatus()) {
|
| 185 |
return null;
|
| 186 |
}
|
| 187 |
|
| 236 |
$store = Mage::app()->getStore($order->getStoreId());
|
| 237 |
|
| 238 |
//Check is well configured
|
| 239 |
+
if (!$this->isStoreConfigured($store)) {
|
| 240 |
return;
|
| 241 |
}
|
| 242 |
|
| 262 |
* @param $gender
|
| 263 |
* @return string
|
| 264 |
*/
|
| 265 |
+
public function genderMapping($gender)
|
| 266 |
+
{
|
| 267 |
+
switch ((int)$gender) {
|
| 268 |
case 1:
|
| 269 |
return 'mister';
|
| 270 |
case 2:
|
| 307 |
}
|
| 308 |
|
| 309 |
if ($address) {
|
| 310 |
+
if (!$phone) {
|
| 311 |
$phone = $address->getTelephone();
|
| 312 |
}
|
| 313 |
+
if (!$country) {
|
| 314 |
$country = $address->getCountryId();
|
| 315 |
}
|
| 316 |
}
|
| 318 |
if ($customer) {
|
| 319 |
$customerAddress = $customer->getDefaultBillingAddress();
|
| 320 |
|
| 321 |
+
if ($customerAddress && !$phone) {
|
| 322 |
$phone = $customerAddress->getTelephone();
|
| 323 |
}
|
| 324 |
+
if ($customerAddress && !$country) {
|
| 325 |
$country = $customerAddress->getCountryId();
|
| 326 |
}
|
| 327 |
}
|
| 376 |
$store = Mage::app()->getStore($quote->getStoreId());
|
| 377 |
|
| 378 |
//Check is well configured
|
| 379 |
+
if (!$this->isStoreConfigured($store)) {
|
| 380 |
return;
|
| 381 |
}
|
| 382 |
|
| 383 |
//Get data and continue only if exist
|
| 384 |
$cartData = $this->getAbadonnedCartData($quote, $store);
|
| 385 |
+
if (!$cartData) {
|
| 386 |
return;
|
| 387 |
}
|
| 388 |
|
| 472 |
public function sendAccount($customer)
|
| 473 |
{
|
| 474 |
//Check is well configured
|
| 475 |
+
if (!$this->isStoreConfigured()) {
|
| 476 |
return;
|
| 477 |
}
|
| 478 |
|
| 498 |
|
| 499 |
$response = $this->doPostRequest($requestUrl, $fields, $store, true);
|
| 500 |
|
| 501 |
+
if (!$response || $response->getStatus() != 200) {
|
| 502 |
return false;
|
| 503 |
}
|
| 504 |
|
| 517 |
$store = Mage::app()->getWebsite(true)->getDefaultGroup()->getDefaultStore();
|
| 518 |
|
| 519 |
$lastOrder = $this->sendLastOrders($store);
|
| 520 |
+
if ($lastOrder) {
|
| 521 |
$this->sendLastQuotes($store, $lastOrder->getCreatedAt());
|
| 522 |
}
|
| 523 |
}
|
| 524 |
|
| 525 |
+
private function sendLastOrders($store)
|
| 526 |
+
{
|
| 527 |
$orders = array();
|
| 528 |
$last = null;
|
| 529 |
$items = Mage::getModel('sales/order')
|
| 532 |
->setPageSize($this->historySize)
|
| 533 |
->addFieldToFilter('store_id', $store->getStoreId());
|
| 534 |
|
| 535 |
+
foreach ($items as $item) {
|
| 536 |
$order = Mage::getModel("sales/order")->load($item->getId());
|
| 537 |
$last = $order;
|
| 538 |
|
| 540 |
$orderData = $this->getOrderData($order, $store);
|
| 541 |
|
| 542 |
//Append only if we get it
|
| 543 |
+
if (!empty($orderData)) {
|
| 544 |
$orders[] = $orderData;
|
| 545 |
}
|
| 546 |
}
|
| 547 |
|
| 548 |
//Push orders to api
|
| 549 |
+
if (!empty($orders)) {
|
| 550 |
$this->doPostRequest('/import/orders', $orders, $store);
|
| 551 |
}
|
| 552 |
|
| 553 |
return $last;
|
| 554 |
}
|
| 555 |
|
| 556 |
+
private function sendLastQuotes($store, $since)
|
| 557 |
+
{
|
| 558 |
$quotes = array();
|
| 559 |
$last = null;
|
| 560 |
$items = Mage::getModel('sales/quote')
|
| 563 |
->addFieldToFilter('store_id', $store->getStoreId())
|
| 564 |
->addFieldToFilter('created_at', array('gt' => $since));
|
| 565 |
|
| 566 |
+
foreach ($items as $item) {
|
| 567 |
$quote = Mage::getModel("sales/quote")->loadByIdWithoutStore($item->getId());
|
| 568 |
$last = $quote;
|
| 569 |
|
| 570 |
+
if ($quote) {
|
| 571 |
//Get quote data
|
| 572 |
$quoteData = $this->getAbadonnedCartData($quote, $store);
|
| 573 |
|
| 574 |
//Append only if we get it
|
| 575 |
+
if ($quoteData) {
|
| 576 |
$quotes[] = $quoteData;
|
| 577 |
}
|
| 578 |
}
|
| 579 |
}
|
| 580 |
|
| 581 |
//Push quotes to api
|
| 582 |
+
if (!empty($quotes)) {
|
| 583 |
$this->doPostRequest('/import/carts', $quotes, $store);
|
| 584 |
}
|
| 585 |
|
| 610 |
$client->setUri($url);
|
| 611 |
$client->setRawData(json_encode($fields), 'application/json');
|
| 612 |
$response = $client->request(Zend_Http_Client::POST);
|
| 613 |
+
} catch (Exception $e) {
|
| 614 |
+
}
|
| 615 |
|
| 616 |
return $response;
|
| 617 |
}
|
|
|
|
| 618 |
}
|
app/code/local/Cartsguru/controllers/AdminController.php
CHANGED
|
@@ -1,46 +1,47 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Cartsguru_AdminController extends Mage_Core_Controller_Front_Action
|
| 4 |
-
|
| 5 |
-
public function indexAction()
|
| 6 |
-
|
| 7 |
-
$
|
| 8 |
-
$
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
$helper->setStoreConfig('
|
| 22 |
-
$helper->setStoreConfig('
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
'
|
| 39 |
-
'
|
| 40 |
-
'
|
| 41 |
-
'
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
}
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Cartsguru_AdminController extends Mage_Core_Controller_Front_Action
|
| 4 |
+
{
|
| 5 |
+
public function indexAction()
|
| 6 |
+
{
|
| 7 |
+
$helper = Mage::helper('cartsguru');
|
| 8 |
+
$params = $this->getRequest()->getParams();
|
| 9 |
+
$auth_key = $helper->getStoreConfig('auth');
|
| 10 |
+
// Stop if no enoguth params
|
| 11 |
+
if (!isset($params['cartsguru_admin_action']) || !isset($params['cartsguru_auth_key']) || $auth_key !== $params['cartsguru_auth_key']) {
|
| 12 |
+
die;
|
| 13 |
+
}
|
| 14 |
+
// Toggle features action
|
| 15 |
+
if ($params['cartsguru_admin_action'] === 'toggleFeatures' && isset($params['cartsguru_admin_data'])) {
|
| 16 |
+
$data = json_decode($params['cartsguru_admin_data'], true);
|
| 17 |
+
if (is_array($data)) {
|
| 18 |
+
// Enable facebook
|
| 19 |
+
if ($data['facebook'] && $data['catalogId'] && $data['pixel']) {
|
| 20 |
+
// Save facebook pixel
|
| 21 |
+
$helper->setStoreConfig('feature_facebook', true);
|
| 22 |
+
$helper->setStoreConfig('facebook_pixel', $data['pixel']);
|
| 23 |
+
$helper->setStoreConfig('facebook_catalogId', $data['catalogId']);
|
| 24 |
+
// return catalogUrl
|
| 25 |
+
header('Content-Type: application/json; charset=utf-8');
|
| 26 |
+
echo json_encode(array(
|
| 27 |
+
'catalogUrl' => Mage::app()->getStore($store)->getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK) . 'cartsguru/catalog'
|
| 28 |
+
));
|
| 29 |
+
} elseif ($data['facebook'] == false) {
|
| 30 |
+
$helper->setStoreConfig('feature_facebook', false);
|
| 31 |
+
}
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
// Get config
|
| 35 |
+
if ($params['cartsguru_admin_action'] === 'displayConfig') {
|
| 36 |
+
header('Content-Type: application/json; charset=utf-8');
|
| 37 |
+
echo json_encode(array(
|
| 38 |
+
'CARTSG_SITE_ID' => $helper->getStoreConfig('siteid'),
|
| 39 |
+
'CARTSG_FEATURE_FB' => $helper->getStoreConfig('feature_facebook'),
|
| 40 |
+
'CARTSG_FB_PIXEL' => $helper->getStoreConfig('facebook_pixel'),
|
| 41 |
+
'CARTSG_FB_CATALOGID' => $helper->getStoreConfig('facebook_catalogId'),
|
| 42 |
+
'PLUGIN_VERSION'=> (string) Mage::getConfig()->getNode()->modules->Cartsguru->version
|
| 43 |
+
));
|
| 44 |
+
}
|
| 45 |
+
die;
|
| 46 |
+
}
|
| 47 |
+
}
|
app/code/local/Cartsguru/controllers/CatalogController.php
CHANGED
|
@@ -1,24 +1,24 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Cartsguru_CatalogController extends Mage_Core_Controller_Front_Action
|
| 4 |
-
|
| 5 |
-
public function indexAction()
|
| 6 |
-
{
|
| 7 |
-
$helper = Mage::helper('cartsguru');
|
| 8 |
-
$params = $this->getRequest()->getParams();
|
| 9 |
-
$auth_key = $helper->getStoreConfig('auth');
|
| 10 |
-
// Stop if not authenticated
|
| 11 |
-
if (!isset($params['cartsguru_auth_key']) || $auth_key !== $params['cartsguru_auth_key']) {
|
| 12 |
-
die;
|
| 13 |
-
}
|
| 14 |
-
// Get input values
|
| 15 |
-
$offset = isset($params['cartsguru_catalog_offset']) ? $params['cartsguru_catalog_offset'] : 0;
|
| 16 |
-
$limit = isset($params['cartsguru_catalog_limit']) ? $params['cartsguru_catalog_limit'] : 50;
|
| 17 |
-
|
| 18 |
-
$store = Mage::app()->getStore();
|
| 19 |
-
$catalog = Mage::getModel('cartsguru/catalog');
|
| 20 |
-
|
| 21 |
-
$this->getResponse()->setHeader('Content-type', 'application/json');
|
| 22 |
-
$this->getResponse()->setBody(json_encode($catalog->generateFeed($store, $offset, $limit)));
|
| 23 |
-
}
|
| 24 |
-
}
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Cartsguru_CatalogController extends Mage_Core_Controller_Front_Action
|
| 4 |
+
{
|
| 5 |
+
public function indexAction()
|
| 6 |
+
{
|
| 7 |
+
$helper = Mage::helper('cartsguru');
|
| 8 |
+
$params = $this->getRequest()->getParams();
|
| 9 |
+
$auth_key = $helper->getStoreConfig('auth');
|
| 10 |
+
// Stop if not authenticated
|
| 11 |
+
if (!isset($params['cartsguru_auth_key']) || $auth_key !== $params['cartsguru_auth_key']) {
|
| 12 |
+
die;
|
| 13 |
+
}
|
| 14 |
+
// Get input values
|
| 15 |
+
$offset = isset($params['cartsguru_catalog_offset']) ? $params['cartsguru_catalog_offset'] : 0;
|
| 16 |
+
$limit = isset($params['cartsguru_catalog_limit']) ? $params['cartsguru_catalog_limit'] : 50;
|
| 17 |
+
|
| 18 |
+
$store = Mage::app()->getStore();
|
| 19 |
+
$catalog = Mage::getModel('cartsguru/catalog');
|
| 20 |
+
|
| 21 |
+
$this->getResponse()->setHeader('Content-type', 'application/json');
|
| 22 |
+
$this->getResponse()->setBody(json_encode($catalog->generateFeed($store, $offset, $limit)));
|
| 23 |
+
}
|
| 24 |
+
}
|
app/code/local/Cartsguru/controllers/IndexController.php
CHANGED
|
@@ -1,8 +1,9 @@
|
|
| 1 |
<?php
|
| 2 |
|
| 3 |
-
class Cartsguru_IndexController extends Mage_Core_Controller_Front_Action
|
| 4 |
-
|
| 5 |
-
public function indexAction()
|
|
|
|
| 6 |
echo 'Visit https://carts.guru';
|
| 7 |
}
|
| 8 |
}
|
| 1 |
<?php
|
| 2 |
|
| 3 |
+
class Cartsguru_IndexController extends Mage_Core_Controller_Front_Action
|
| 4 |
+
{
|
| 5 |
+
public function indexAction()
|
| 6 |
+
{
|
| 7 |
echo 'Visit https://carts.guru';
|
| 8 |
}
|
| 9 |
}
|
app/code/local/Cartsguru/controllers/RecovercartController.php
CHANGED
|
@@ -1,18 +1,37 @@
|
|
| 1 |
<?php
|
| 2 |
|
| 3 |
-
class Cartsguru_RecovercartController extends Mage_Core_Controller_Front_Action
|
| 4 |
-
|
| 5 |
-
private function redirectToCart()
|
|
|
|
| 6 |
$url = Mage::helper('checkout/cart')->getCartUrl();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
$this->getResponse()->setRedirect($url)->sendResponse();
|
| 8 |
}
|
| 9 |
|
| 10 |
-
public function indexAction()
|
|
|
|
| 11 |
// Get request params
|
| 12 |
$params = $this->getRequest()->getParams();
|
| 13 |
|
| 14 |
// Stop if no enoguth params
|
| 15 |
-
if (!isset($params['cart_id']) || !isset($params['cart_token'])){
|
| 16 |
return $this->redirectToCart();
|
| 17 |
}
|
| 18 |
|
|
@@ -20,24 +39,23 @@ class Cartsguru_RecovercartController extends Mage_Core_Controller_Front_Action
|
|
| 20 |
$quote = Mage::getModel('sales/quote')->load($params['cart_id']);
|
| 21 |
|
| 22 |
// Stop if quote does not exist
|
| 23 |
-
if (!$quote->getId()){
|
| 24 |
return $this->redirectToCart();
|
| 25 |
}
|
| 26 |
|
| 27 |
// Check quote token
|
| 28 |
$token = $quote->getData('cartsguru_token');
|
| 29 |
-
if (!$token || $token != $params['cart_token']){
|
| 30 |
return $this->redirectToCart();
|
| 31 |
}
|
| 32 |
|
| 33 |
// Auto log customer if we can
|
| 34 |
-
if ($quote->getCustomerId()){
|
| 35 |
//Gest customer
|
| 36 |
$customer = Mage::getModel('customer/customer')->load($quote->getCustomerId());
|
| 37 |
|
| 38 |
Mage::getSingleton('customer/session')->setCustomerAsLoggedIn($customer);
|
| 39 |
-
}
|
| 40 |
-
else {
|
| 41 |
// Get current cart
|
| 42 |
$cart = Mage::getSingleton('checkout/cart');
|
| 43 |
|
|
@@ -46,7 +64,7 @@ class Cartsguru_RecovercartController extends Mage_Core_Controller_Front_Action
|
|
| 46 |
$found = false;
|
| 47 |
foreach ($quote->getAllItems() as $quoteItem) {
|
| 48 |
if ($quoteItem->compare($item)) {
|
| 49 |
-
|
| 50 |
$found = true;
|
| 51 |
break;
|
| 52 |
}
|
| 1 |
<?php
|
| 2 |
|
| 3 |
+
class Cartsguru_RecovercartController extends Mage_Core_Controller_Front_Action
|
| 4 |
+
{
|
| 5 |
+
private function redirectToCart()
|
| 6 |
+
{
|
| 7 |
$url = Mage::helper('checkout/cart')->getCartUrl();
|
| 8 |
+
|
| 9 |
+
//Keep params except cart_id & cart_token
|
| 10 |
+
$queryParams = array();
|
| 11 |
+
$params = $this->getRequest()->getParams();
|
| 12 |
+
foreach ($params as $key => $value) {
|
| 13 |
+
if ($key === 'cart_token' || $key === 'cart_id') {
|
| 14 |
+
continue;
|
| 15 |
+
}
|
| 16 |
+
$queryParams[] = $key . '=' . $value;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
+
//Concats query
|
| 20 |
+
if (!empty($queryParams)) {
|
| 21 |
+
$url .= strpos($url, '?') !== false ? '&' : '?';
|
| 22 |
+
$url .= implode('&', $queryParams);
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
$this->getResponse()->setRedirect($url)->sendResponse();
|
| 26 |
}
|
| 27 |
|
| 28 |
+
public function indexAction()
|
| 29 |
+
{
|
| 30 |
// Get request params
|
| 31 |
$params = $this->getRequest()->getParams();
|
| 32 |
|
| 33 |
// Stop if no enoguth params
|
| 34 |
+
if (!isset($params['cart_id']) || !isset($params['cart_token'])) {
|
| 35 |
return $this->redirectToCart();
|
| 36 |
}
|
| 37 |
|
| 39 |
$quote = Mage::getModel('sales/quote')->load($params['cart_id']);
|
| 40 |
|
| 41 |
// Stop if quote does not exist
|
| 42 |
+
if (!$quote->getId()) {
|
| 43 |
return $this->redirectToCart();
|
| 44 |
}
|
| 45 |
|
| 46 |
// Check quote token
|
| 47 |
$token = $quote->getData('cartsguru_token');
|
| 48 |
+
if (!$token || $token != $params['cart_token']) {
|
| 49 |
return $this->redirectToCart();
|
| 50 |
}
|
| 51 |
|
| 52 |
// Auto log customer if we can
|
| 53 |
+
if ($quote->getCustomerId()) {
|
| 54 |
//Gest customer
|
| 55 |
$customer = Mage::getModel('customer/customer')->load($quote->getCustomerId());
|
| 56 |
|
| 57 |
Mage::getSingleton('customer/session')->setCustomerAsLoggedIn($customer);
|
| 58 |
+
} else {
|
|
|
|
| 59 |
// Get current cart
|
| 60 |
$cart = Mage::getSingleton('checkout/cart');
|
| 61 |
|
| 64 |
$found = false;
|
| 65 |
foreach ($quote->getAllItems() as $quoteItem) {
|
| 66 |
if ($quoteItem->compare($item)) {
|
| 67 |
+
// $quoteItem->setQty($item->getQty());
|
| 68 |
$found = true;
|
| 69 |
break;
|
| 70 |
}
|
app/code/local/Cartsguru/controllers/SaveaccountController.php
CHANGED
|
@@ -1,35 +1,36 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
|
| 3 |
-
class Cartsguru_SaveaccountController extends Mage_Core_Controller_Front_Action
|
| 4 |
-
|
| 5 |
-
public function indexAction()
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
if
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
$quote
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
$webservice
|
| 34 |
-
|
| 35 |
-
}
|
|
|
| 1 |
+
<?php
|
| 2 |
+
|
| 3 |
+
class Cartsguru_SaveaccountController extends Mage_Core_Controller_Front_Action
|
| 4 |
+
{
|
| 5 |
+
public function indexAction()
|
| 6 |
+
{
|
| 7 |
+
// Get request params
|
| 8 |
+
$params = $this->getRequest()->getParams();
|
| 9 |
+
|
| 10 |
+
// Stop if no email
|
| 11 |
+
if (!isset($params['email'])) {
|
| 12 |
+
return;
|
| 13 |
+
}
|
| 14 |
+
// Post the data
|
| 15 |
+
$quote = Mage::getModel('checkout/cart')->getQuote();
|
| 16 |
+
$quote->setCustomerEmail($params['email']);
|
| 17 |
+
if (isset($params['firstname'])) {
|
| 18 |
+
$quote->setCustomerFirstname($params['firstname']);
|
| 19 |
+
}
|
| 20 |
+
if (isset($params['lastname'])) {
|
| 21 |
+
$quote->setCustomerLastname($params['lastname']);
|
| 22 |
+
}
|
| 23 |
+
$address = $quote->getBillingAddress();
|
| 24 |
+
if ($address) {
|
| 25 |
+
if (isset($params['telephone'])) {
|
| 26 |
+
$address->setTelephone($params['telephone']);
|
| 27 |
+
}
|
| 28 |
+
if (isset($params['country'])) {
|
| 29 |
+
$address->setCountryId($params['country']);
|
| 30 |
+
}
|
| 31 |
+
$quote->setBillingAddress($address);
|
| 32 |
+
}
|
| 33 |
+
$webservice = Mage::getModel('cartsguru/webservice');
|
| 34 |
+
$webservice->sendAbadonnedCart($quote);
|
| 35 |
+
}
|
| 36 |
+
}
|
app/code/local/Cartsguru/etc/config.xml
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
<!-- plugin name -->
|
| 4 |
<modules>
|
| 5 |
<Cartsguru>
|
| 6 |
-
<version>1.3.
|
| 7 |
</Cartsguru>
|
| 8 |
</modules>
|
| 9 |
<global>
|
| 3 |
<!-- plugin name -->
|
| 4 |
<modules>
|
| 5 |
<Cartsguru>
|
| 6 |
+
<version>1.3.4</version>
|
| 7 |
</Cartsguru>
|
| 8 |
</modules>
|
| 9 |
<global>
|
app/code/local/Cartsguru/sql/cartsguru_setup/install-1.0.0.php
CHANGED
|
@@ -3,4 +3,4 @@
|
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
-
$installer->endSetup();
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
+
$installer->endSetup();
|
app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.0.0-1.0.1.php
CHANGED
|
@@ -3,4 +3,4 @@
|
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
-
$installer->endSetup();
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
+
$installer->endSetup();
|
app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.0.1-1.0.2.php
CHANGED
|
@@ -3,4 +3,4 @@
|
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
-
$installer->endSetup();
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
+
$installer->endSetup();
|
app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.0.2-1.1.0.php
CHANGED
|
@@ -3,4 +3,4 @@
|
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
-
$installer->endSetup();
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
+
$installer->endSetup();
|
app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.1.0-1.1.1.php
CHANGED
|
@@ -3,4 +3,4 @@
|
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
-
$installer->endSetup();
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
+
$installer->endSetup();
|
app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.1.1-1.1.2.php
CHANGED
|
@@ -3,4 +3,4 @@
|
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
-
$installer->endSetup();
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
+
$installer->endSetup();
|
app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.1.2-1.1.3.php
CHANGED
|
@@ -3,4 +3,4 @@
|
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
-
$installer->endSetup();
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
+
$installer->endSetup();
|
app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.1.3-1.1.4 .php
CHANGED
|
@@ -3,4 +3,4 @@
|
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
-
$installer->endSetup();
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
+
$installer->endSetup();
|
app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.1.4-1.1.5.php
CHANGED
|
@@ -3,4 +3,4 @@
|
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
-
$installer->endSetup();
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
+
$installer->endSetup();
|
app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.1.5-1.2.0.php
CHANGED
|
@@ -8,4 +8,4 @@ $installer->startSetup();
|
|
| 8 |
$connection = $installer->getConnection();
|
| 9 |
$connection->addColumn($this->getTable('sales/quote'), 'cartsguru_token', 'varchar(255) NOT NULL');
|
| 10 |
|
| 11 |
-
$installer->endSetup();
|
| 8 |
$connection = $installer->getConnection();
|
| 9 |
$connection->addColumn($this->getTable('sales/quote'), 'cartsguru_token', 'varchar(255) NOT NULL');
|
| 10 |
|
| 11 |
+
$installer->endSetup();
|
app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.2.0-1.2.1.php
CHANGED
|
@@ -3,4 +3,4 @@
|
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
-
$installer->endSetup();
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
+
$installer->endSetup();
|
app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.2.1-1.2.2.php
CHANGED
|
@@ -3,4 +3,4 @@
|
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
-
$installer->endSetup();
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
+
$installer->endSetup();
|
app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.2.14-1.2.15.php
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/* @var $installer Mage_Core_Model_Resource_Setup */
|
| 3 |
-
$installer = $this;
|
| 4 |
-
|
| 5 |
-
$installer->startSetup();
|
| 6 |
-
$installer->endSetup();
|
| 1 |
+
<?php
|
| 2 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
| 3 |
+
$installer = $this;
|
| 4 |
+
|
| 5 |
+
$installer->startSetup();
|
| 6 |
+
$installer->endSetup();
|
app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.2.15-1.2.16.php
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/* @var $installer Mage_Core_Model_Resource_Setup */
|
| 3 |
-
$installer = $this;
|
| 4 |
-
|
| 5 |
-
$installer->startSetup();
|
| 6 |
-
$installer->endSetup();
|
| 1 |
+
<?php
|
| 2 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
| 3 |
+
$installer = $this;
|
| 4 |
+
|
| 5 |
+
$installer->startSetup();
|
| 6 |
+
$installer->endSetup();
|
app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.2.16-1.3.0.php
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/* @var $installer Mage_Core_Model_Resource_Setup */
|
| 3 |
-
$installer = $this;
|
| 4 |
-
|
| 5 |
-
$installer->startSetup();
|
| 6 |
-
$installer->endSetup();
|
| 1 |
+
<?php
|
| 2 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
| 3 |
+
$installer = $this;
|
| 4 |
+
|
| 5 |
+
$installer->startSetup();
|
| 6 |
+
$installer->endSetup();
|
app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.2.2-1.2.3.php
CHANGED
|
@@ -3,4 +3,4 @@
|
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
-
$installer->endSetup();
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
+
$installer->endSetup();
|
app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.2.3-1.2.4.php
CHANGED
|
@@ -3,4 +3,4 @@
|
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
-
$installer->endSetup();
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
+
$installer->endSetup();
|
app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.2.4-1.2.5.php
CHANGED
|
@@ -3,4 +3,4 @@
|
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
-
$installer->endSetup();
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
+
$installer->endSetup();
|
app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.2.5-1.2.6.php
CHANGED
|
@@ -3,4 +3,4 @@
|
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
-
$installer->endSetup();
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
+
$installer->endSetup();
|
app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.2.6-1.2.7.php
CHANGED
|
@@ -3,4 +3,4 @@
|
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
-
$installer->endSetup();
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
+
$installer->endSetup();
|
app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.2.7-1.2.8.php
CHANGED
|
@@ -3,4 +3,4 @@
|
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
-
$installer->endSetup();
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
+
$installer->endSetup();
|
app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.2.8-1.2.9.php
CHANGED
|
@@ -3,4 +3,4 @@
|
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
-
$installer->endSetup();
|
| 3 |
$installer = $this;
|
| 4 |
|
| 5 |
$installer->startSetup();
|
| 6 |
+
$installer->endSetup();
|
app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.3.0-1.3.1.php
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/* @var $installer Mage_Core_Model_Resource_Setup */
|
| 3 |
-
$installer = $this;
|
| 4 |
-
|
| 5 |
-
$installer->startSetup();
|
| 6 |
-
$installer->endSetup();
|
| 1 |
+
<?php
|
| 2 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
| 3 |
+
$installer = $this;
|
| 4 |
+
|
| 5 |
+
$installer->startSetup();
|
| 6 |
+
$installer->endSetup();
|
app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.3.1-1.3.2.php
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/* @var $installer Mage_Core_Model_Resource_Setup */
|
| 3 |
-
$installer = $this;
|
| 4 |
-
|
| 5 |
-
$installer->startSetup();
|
| 6 |
-
$installer->endSetup();
|
| 1 |
+
<?php
|
| 2 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
| 3 |
+
$installer = $this;
|
| 4 |
+
|
| 5 |
+
$installer->startSetup();
|
| 6 |
+
$installer->endSetup();
|
app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.3.2-1.3.3.php
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
-
<?php
|
| 2 |
-
/* @var $installer Mage_Core_Model_Resource_Setup */
|
| 3 |
-
$installer = $this;
|
| 4 |
-
|
| 5 |
-
$installer->startSetup();
|
| 6 |
-
$installer->endSetup();
|
| 1 |
+
<?php
|
| 2 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
| 3 |
+
$installer = $this;
|
| 4 |
+
|
| 5 |
+
$installer->startSetup();
|
| 6 |
+
$installer->endSetup();
|
app/code/local/Cartsguru/sql/cartsguru_setup/upgrade-1.3.3-1.3.4.php
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/* @var $installer Mage_Core_Model_Resource_Setup */
|
| 3 |
+
$installer = $this;
|
| 4 |
+
|
| 5 |
+
$installer->startSetup();
|
| 6 |
+
$installer->endSetup();
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>cartsguru</name>
|
| 4 |
-
<version>1.3.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/gpl-license.php">GPL</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -16,13 +16,11 @@ Effortlessly reduce the number of abandoned shopping carts by automating telepho
|
|
| 16 |

|
| 17 |
- SMS Callback & Push SMS
|
| 18 |
Send to your prospective customers having abandoned a cart, an SMS suggesting a free call back from your customer relations service, a straightforward SMS reminder or an SMS offering a personalized discount</description>
|
| 19 |
-
<notes>-
|
| 20 |
-
- Fix multistore issues
|
| 21 |
-
- Correct customer group when not logged in</notes>
|
| 22 |
<authors><author><name>Maxime Pruvost</name><user>cgmaximepruvost</user><email>maxime@carts.guru</email></author></authors>
|
| 23 |
-
<date>2017-
|
| 24 |
-
<time>
|
| 25 |
-
<contents><target name="magelocal"><dir name="Cartsguru"><dir name="Block"><file name="Pixel.php" hash="
|
| 26 |
<compatible/>
|
| 27 |
<dependencies><required><php><min>5.3.0</min><max>7.1.0</max></php></required></dependencies>
|
| 28 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>cartsguru</name>
|
| 4 |
+
<version>1.3.4</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://opensource.org/licenses/gpl-license.php">GPL</license>
|
| 7 |
<channel>community</channel>
|
| 16 |

|
| 17 |
- SMS Callback & Push SMS
|
| 18 |
Send to your prospective customers having abandoned a cart, an SMS suggesting a free call back from your customer relations service, a straightforward SMS reminder or an SMS offering a personalized discount</description>
|
| 19 |
+
<notes>- Improve redirect to cart on recover</notes>
|
|
|
|
|
|
|
| 20 |
<authors><author><name>Maxime Pruvost</name><user>cgmaximepruvost</user><email>maxime@carts.guru</email></author></authors>
|
| 21 |
+
<date>2017-04-28</date>
|
| 22 |
+
<time>09:33:27</time>
|
| 23 |
+
<contents><target name="magelocal"><dir name="Cartsguru"><dir name="Block"><file name="Pixel.php" hash="8ea68eb970f1ed7f91060980e74422ee"/></dir><dir name="Helper"><file name="Data.php" hash="373fe1f83d1cfa5b18a3b2f36bd1d10b"/><file name="Tools.php" hash="27ebd500bc026f43fab3088242e68eb8"/></dir><dir name="Model"><file name="Catalog.php" hash="c20f73f2d595e6047d0649cc26b4c152"/><file name="Observer.php" hash="24b02ee36824d72c3b4d48a98053bfe0"/><file name="Webservice.php" hash="69b6cd6620faa792b26d07073f4a7fd3"/></dir><dir name="controllers"><file name="AdminController.php" hash="be9ac89db2a881bcfcc16b8a459cbcea"/><file name="CatalogController.php" hash="2d051f18a991124ea6334782e339b89c"/><file name="IndexController.php" hash="98cdc6eeca4d9162d4f447b5c3523f1e"/><file name="RecovercartController.php" hash="b247e0a3b828d6e1af39a0d8e213e2bf"/><file name="SaveaccountController.php" hash="a4afe20c0d1fbe33589da80f54dc3748"/></dir><dir name="etc"><file name="config.xml" hash="73b7b4d3f74bed77583fbdb9d45226ef"/><file name="system.xml" hash="cb0fbf86d2be47dbd719739ee79c4cba"/></dir><dir name="sql"><dir name="cartsguru_setup"><file name="install-1.0.0.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.0.0-1.0.1.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.0.1-1.0.2.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.0.2-1.1.0.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.1.0-1.1.1.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.1.1-1.1.2.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.1.2-1.1.3.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.1.3-1.1.4 .php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.1.4-1.1.5.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.1.5-1.2.0.php" hash="45dbf71b12ca70bd4d994296ba0624d6"/><file name="upgrade-1.2.0-1.2.1.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.2.1-1.2.2.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.2.10-1.2.11.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.2.11-1.2.12.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.2.12-1.2.13.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.2.13-1.2.14.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.2.14-1.2.15.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.2.15-1.2.16.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.2.16-1.3.0.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.2.2-1.2.3.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.2.3-1.2.4.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.2.4-1.2.5.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.2.5-1.2.6.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.2.6-1.2.7.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.2.7-1.2.8.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.2.8-1.2.9.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.2.9-1.2.10.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.3.0-1.3.1.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.3.1-1.3.2.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.3.2-1.3.3.php" hash="84cb92331d31afda4f06aca50dbd597e"/><file name="upgrade-1.3.3-1.3.4.php" hash="84cb92331d31afda4f06aca50dbd597e"/></dir></dir></dir></target><target name="magelocale"><dir name="fr_FR"><file name="CartsGuru.csv" hash="b6d51893c33ddef1d53372d3a23b036c"/></dir><dir name="en_US"><file name="CartsGuru.csv" hash="921cb4133db47471456759443bb269f5"/></dir></target><target name="mageetc"><dir name="modules"><file name="Cartsguru.xml" hash="32bfa7d63b1a5b6b8f7977bf31af4e28"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="cartsguru.xml" hash="a886b0c3b06fdc08d1602c3f1fa0eff0"/></dir><dir name="template"><dir name="cartsguru"><dir name="checkout"><file name="purchase.phtml" hash="1035c7fed71153aa4c9f5e2d765deb7a"/></dir><file name="pixel.phtml" hash="58cbe4af75828b12325251cb4cf1d594"/><dir name="product"><file name="view.phtml" hash="9ab2487a583615c61e85a96ee0795ad3"/></dir></dir></dir></dir></dir></dir></target><target name="mageweb"><dir name="js"><dir name="cartsguru"><file name="checkout.js" hash="f80f26b465eac6f702e87e05687c4bdd"/></dir></dir></target></contents>
|
| 24 |
<compatible/>
|
| 25 |
<dependencies><required><php><min>5.3.0</min><max>7.1.0</max></php></required></dependencies>
|
| 26 |
</package>
|
