Version Notes
Improvements in user tracking
Download this release
Release Info
Developer | Pleisty |
Extension | Pleisty |
Version | 2.1.1 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 2.1.1
- app/code/community/F5/Pleisty/controllers/IndexController.php +688 -0
- app/code/community/F5/Pleisty/etc/config.xml +34 -27
- app/code/community/F5/Pleisty/etc/system.xml +130 -112
- app/design/adminhtml/default/default/layout/pleisty.xml +0 -16
- app/design/adminhtml/default/default/template/pleisty/pleisty.phtml +0 -93
- app/design/frontend/base/default/template/pleisty/pleisty.phtml +173 -187
- app/etc/modules/F5_Pleisty.xml +1 -2
- package.xml +10 -9
app/code/community/F5/Pleisty/controllers/IndexController.php
ADDED
@@ -0,0 +1,688 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* @author Pleisty <tech@pleisty.com>
|
5 |
+
*/
|
6 |
+
|
7 |
+
class F5_Pleisty_IndexController extends Mage_Core_Controller_Front_Action
|
8 |
+
{
|
9 |
+
|
10 |
+
private $cat_tree_clean = [];
|
11 |
+
private $pack_mode = "json";
|
12 |
+
|
13 |
+
private function get_param($param_name, $default_value = null) {
|
14 |
+
$params = $this->getRequest()->getParams();
|
15 |
+
if (isset($params[$param_name])) return $params[$param_name];
|
16 |
+
return $default_value;
|
17 |
+
}
|
18 |
+
|
19 |
+
private function dump($type,$value) {
|
20 |
+
if ($this->pack_mode == "json") {
|
21 |
+
echo json_encode([$type,$value]) . "\n";return;
|
22 |
+
echo json_encode([$type,$value], JSON_PRETTY_PRINT) . "\n";
|
23 |
+
}
|
24 |
+
if ($this->pack_mode == "serialize") {
|
25 |
+
echo serialize([$type,$value]) . "\n";
|
26 |
+
}
|
27 |
+
}
|
28 |
+
|
29 |
+
private function get_extension_config($only_key = null) {
|
30 |
+
if ($only_key != null) return Mage::getStoreConfig('tab1/general/' . $only_key);
|
31 |
+
$keys = array(
|
32 |
+
"site_hash_varible",
|
33 |
+
"base_tracking",
|
34 |
+
"customer_tracking",
|
35 |
+
"product",
|
36 |
+
"product_listing",
|
37 |
+
"shopping_cart",
|
38 |
+
"wishlist_tracking",
|
39 |
+
"checkout_process_tracking",
|
40 |
+
"checkout_finalized",
|
41 |
+
"other_content",
|
42 |
+
);
|
43 |
+
$values = array();
|
44 |
+
foreach ($keys as $key) {
|
45 |
+
$values[$key] = Mage::getStoreConfig('tab1/general/' . $key);
|
46 |
+
}
|
47 |
+
return $values;
|
48 |
+
}
|
49 |
+
|
50 |
+
private function check_req_key() {
|
51 |
+
if (!$this->get_param("rq_key")) {
|
52 |
+
$this->dump("auth_err", "empty rq_key");
|
53 |
+
return;
|
54 |
+
}
|
55 |
+
//return true;
|
56 |
+
$url_base = "http://magento1x-api.pleisty.com/api/magento1x/feed_auth";
|
57 |
+
$url = $url_base
|
58 |
+
. "?rq_key=" . urlencode($this->get_param("rq_key"))
|
59 |
+
. "&rq_sig=" . urlencode($this->get_param("rq_sig"))
|
60 |
+
. "&rq_ts=" . urlencode($this->get_param("rq_ts"))
|
61 |
+
. "&site_hash=" . urlencode($this->get_extension_config('site_hash_varible'))
|
62 |
+
;
|
63 |
+
$this->dump("check_request_at", $url);
|
64 |
+
$response = trim(file_get_contents($url));
|
65 |
+
$this->dump("check_request_rsp", $response);
|
66 |
+
return $response == $this->get_param("rq_key");
|
67 |
+
}
|
68 |
+
|
69 |
+
public function indexAction() {
|
70 |
+
$ts = microtime(1);
|
71 |
+
header('Content-Type: text/plain');
|
72 |
+
$this->pack_mode = $this->get_param("pack_mode","json");
|
73 |
+
if (!$this->check_req_key()) {
|
74 |
+
$this->dump("auth_err", "Failed to check request");
|
75 |
+
return;
|
76 |
+
}
|
77 |
+
|
78 |
+
$this->dump("req_params", $this->getRequest()->getParams());
|
79 |
+
|
80 |
+
$this->dump("magento_version", Mage::getVersion());
|
81 |
+
$this->dump("php_version", phpversion());
|
82 |
+
$this->dump("default_curr", Mage::app()->getStore()->getCurrentCurrencyCode());
|
83 |
+
$this->dump("tz", Mage::getStoreConfig('general/locale/timezone'));
|
84 |
+
$this->dump("ext_name", $this->get_extension_name());
|
85 |
+
$this->dump("ext_ver", $this->get_extension_version());
|
86 |
+
$this->dump("ext_config", $this->get_extension_config());
|
87 |
+
$this->dump("ts_start", $ts);
|
88 |
+
$this->dump("mageto_base_url", Mage::getBaseUrl());
|
89 |
+
$this->dump("mageto_current_store_id", Mage::app()->getStore()->getStoreId());
|
90 |
+
$this->dump("mageto_current_store", Mage::app()->getStore()->getData());
|
91 |
+
$this->dump("mageto_current_store_url", Mage::app()->getStore()->getHomeUrl());
|
92 |
+
$magento_stores = Mage::app()->getStores();
|
93 |
+
foreach ($magento_stores as $magento_store) {
|
94 |
+
$magento_store_arr = $magento_store->getData();
|
95 |
+
$magento_store_arr['url'] = $magento_store->getHomeUrl();
|
96 |
+
$this->dump("mageto_store[]", $magento_store_arr);
|
97 |
+
}
|
98 |
+
|
99 |
+
|
100 |
+
$baseCurrencyCode = Mage::app()->getBaseCurrencyCode();
|
101 |
+
$allowedCurrencies = Mage::getModel('directory/currency')->getConfigAllowCurrencies();
|
102 |
+
$currencyRates = Mage::getModel('directory/currency')->getCurrencyRates($baseCurrencyCode, array_values($allowedCurrencies));
|
103 |
+
$this->dump("mageto_base_currency", $baseCurrencyCode);
|
104 |
+
$this->dump("mageto_allowed_currencies", $allowedCurrencies);
|
105 |
+
$this->dump("mageto_currency_rates", $currencyRates);
|
106 |
+
|
107 |
+
|
108 |
+
$actions = $this->get_param("actions",[]);
|
109 |
+
$this->dump("actions", $actions);
|
110 |
+
if (in_array("products", $actions)) $this->export_product_catalog();
|
111 |
+
if (in_array("users", $actions)) $this->export_user_catalog();
|
112 |
+
if (in_array("orders", $actions)) $this->export_order_catalog();
|
113 |
+
if (in_array("carts", $actions)) $this->export_cart_catalog();
|
114 |
+
if (in_array("subscribers", $actions)) $this->export_subscriber_catalog();
|
115 |
+
}
|
116 |
+
|
117 |
+
private function get_extension_name() {
|
118 |
+
return str_replace("_IndexController", "", get_class($this));
|
119 |
+
}
|
120 |
+
private function get_extension_version() {
|
121 |
+
$name = $this->get_extension_name();
|
122 |
+
try {
|
123 |
+
return Mage::getConfig()->getNode()->modules->$name;
|
124 |
+
return (string)Mage::getConfig()->getNode()->modules->$name->version;
|
125 |
+
} catch (Exception $e) {
|
126 |
+
return $e->getMessage();
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
private function get_products_collection($first = false) {
|
131 |
+
|
132 |
+
$products = Mage::getModel('catalog/product')->getCollection();
|
133 |
+
|
134 |
+
if ($first) $this->dump("order_by",$this->get_param("order_by","updated_at"));
|
135 |
+
if ($first) $this->dump("order_dir",$this->get_param("order_dir","desc"));
|
136 |
+
$products->setOrder($this->get_param("order_by","updated_at"), $this->get_param("order_dir","desc"));
|
137 |
+
|
138 |
+
$attribute_map_list = json_decode($this->get_param("attribute_map"), true) ?: array("*");
|
139 |
+
if ($first) $this->dump("attribute_map_list",$attribute_map_list);
|
140 |
+
if ($first) $this->dump("product_attributes_ignore",$this->get_param("product_attributes_ignore",['category_ids', 'group_price']));
|
141 |
+
foreach ($attribute_map_list as $attribute_map)
|
142 |
+
$products->addAttributeToSelect($attribute_map);
|
143 |
+
|
144 |
+
|
145 |
+
$filters = json_decode($this->get_param("filters"), true) ?: array();
|
146 |
+
if ($first) $this->dump("filters",$filters);
|
147 |
+
foreach ($filters as $filter) {
|
148 |
+
call_user_func_array(array($products,'addFieldToFilter'), $filter);
|
149 |
+
}
|
150 |
+
|
151 |
+
|
152 |
+
if ($first) $this->dump("page_size",$this->get_param("page_size",10));
|
153 |
+
$products->setPageSize($this->get_param("page_size",10));
|
154 |
+
|
155 |
+
return $products;
|
156 |
+
}
|
157 |
+
|
158 |
+
private function export_product_catalog() {
|
159 |
+
|
160 |
+
|
161 |
+
$ts = microtime(1);
|
162 |
+
|
163 |
+
|
164 |
+
$cat_tree = $this->get_categories_tree();
|
165 |
+
$this->cat_tree_clean = [];
|
166 |
+
foreach ([
|
167 |
+
"name",
|
168 |
+
"url_path",
|
169 |
+
] as $p)
|
170 |
+
foreach ($cat_tree as $cat_id => $cat_path)
|
171 |
+
$this->cat_tree_clean[$p][$cat_id] = array_map(
|
172 |
+
function($e) use ($p) { return isset($e[$p]) ? $e[$p] : ""; },
|
173 |
+
$cat_path);
|
174 |
+
$this->dump("cat_tree",$this->cat_tree_clean);
|
175 |
+
|
176 |
+
|
177 |
+
$products = $this->get_products_collection(true);
|
178 |
+
|
179 |
+
$this->dump("page_start",$this->get_param("page_start",1));
|
180 |
+
$currentPage = $this->get_param("page_start",1);
|
181 |
+
|
182 |
+
$pages = $products->getLastPageNumber();
|
183 |
+
$last_page = $pages;
|
184 |
+
$this->dump("page_last",$pages);
|
185 |
+
$this->dump("page_max",$this->get_param("page_max",$pages));
|
186 |
+
$pages = $this->get_param("page_max",$pages);
|
187 |
+
$this->dump("products_count",$products->getSize());
|
188 |
+
|
189 |
+
$k = 0;
|
190 |
+
do {
|
191 |
+
$this->dump("at_page",[$currentPage,$pages,$last_page]);
|
192 |
+
$products->setCurPage($currentPage);
|
193 |
+
foreach ($products as $product) {
|
194 |
+
$this->dump("product_k",$k);
|
195 |
+
try {
|
196 |
+
$this->dump("product[]",$this->map_product($product));
|
197 |
+
} catch (Exception $e) {
|
198 |
+
$this->dump("product_err[]", [$product->getId(), $e->getMessage(), $e->getTraceAsString()]);
|
199 |
+
}
|
200 |
+
$k++;
|
201 |
+
}
|
202 |
+
$currentPage++;
|
203 |
+
$products->clear();
|
204 |
+
//$products = $this->get_products_collection();
|
205 |
+
} while ($currentPage <= $pages);
|
206 |
+
|
207 |
+
$this->dump("products_done",$k);
|
208 |
+
$this->dump("products_took",(microtime(1) - $ts));
|
209 |
+
$this->dump("products_mem",memory_get_usage());
|
210 |
+
$this->dump("products_mmem",memory_get_peak_usage());
|
211 |
+
}
|
212 |
+
|
213 |
+
private function map_product($product) {
|
214 |
+
$product = $product;
|
215 |
+
|
216 |
+
if ($this->get_param("send_core")) {
|
217 |
+
$p['core'] = $product->getData();
|
218 |
+
}
|
219 |
+
|
220 |
+
$p['item_id'] = $product->getId();
|
221 |
+
$p['item_created_at'] = Mage::getModel("core/date")->timestamp($product->getCreatedAt());
|
222 |
+
$p['item_updated_at'] = Mage::getModel("core/date")->timestamp($product->getUpdatedAt());
|
223 |
+
$p['item_sku'] = $product->getSku();
|
224 |
+
$p['store_id'] = $product->getStoreId();
|
225 |
+
$p['store_ids'] = $product->getStoreIds();
|
226 |
+
$p['item_oldprice'] = (float)$product->getPrice();
|
227 |
+
$p['item_price'] = (float)$product->getFinalPrice();
|
228 |
+
if ((float)$p['item_price']) {
|
229 |
+
$p['item_discount_procent'] = (float)number_format(100*($p['item_oldprice'] - $p['item_price']) / $p['item_price'],2,".","");
|
230 |
+
$p['item_discount_value'] = (float)($p['item_oldprice'] - $p['item_price']);
|
231 |
+
}
|
232 |
+
//$p['_item_price_curr_html'] = Mage::helper('core')->currency($product->getPrice());
|
233 |
+
$p['item_curr'] = Mage::app()->getStore($product->getStoreId())->getCurrentCurrencyCode();
|
234 |
+
$p['item_curr_symbol'] = Mage::app()->getLocale()->currency($p['item_curr'])->getSymbol();
|
235 |
+
$p['item_curr_name'] = Mage::app()->getLocale()->currency($p['item_curr'])->getName();
|
236 |
+
//$p['_item_curr'] = Mage::helper('core')->currency($product->getFinalPrice(),true,false);
|
237 |
+
$p['item_url'] = $product->getProductUrl();
|
238 |
+
$p['item_stock'] = $product->stock_item->getIsInStock();
|
239 |
+
$p['item_title'] = $product->getName();
|
240 |
+
$p['item_description'] = $product->getDescription();
|
241 |
+
$p['item_short_description'] = $product->getShortDescription();
|
242 |
+
unset($p['stock_item']);
|
243 |
+
//$p['_stock_qty'] = $product->stock_item->getQty();
|
244 |
+
|
245 |
+
try {
|
246 |
+
$p['item_img_thumbnail'] = (string)Mage::helper('catalog/image')->init($product, 'thumbnail');
|
247 |
+
$p['item_img'] = (string)Mage::helper('catalog/image')->init($product, 'small_image');
|
248 |
+
$p['item_img_big'] = (string)Mage::helper('catalog/image')->init($product, 'image'); //->resize(135,135);
|
249 |
+
$gallery_images = Mage::getModel('catalog/product')->load($product->getId())->getMediaGalleryImages();
|
250 |
+
foreach($gallery_images as $g_image) {
|
251 |
+
$p['item_img_all'][] = $g_image['url'];
|
252 |
+
}
|
253 |
+
} catch (Exception $e) {
|
254 |
+
$p['_item_img_err'] = [$e->getMessage(), $e->getTraceAsString()];
|
255 |
+
}
|
256 |
+
|
257 |
+
|
258 |
+
|
259 |
+
|
260 |
+
$p['cat_list_id'] = $product->getCategoryIds();
|
261 |
+
foreach ($this->cat_tree_clean as $cat_type => $cat_type_paths)
|
262 |
+
foreach ($p['cat_list_id'] as $cat_id) {
|
263 |
+
$p['cat_list_' . $cat_type][] = $cat_type_paths[$cat_id];
|
264 |
+
}
|
265 |
+
|
266 |
+
|
267 |
+
$attributes_ignore = $this->get_param("product_attributes_ignore",['category_ids', 'group_price']);
|
268 |
+
if (!in_array("*", $attributes_ignore)) {
|
269 |
+
$attrs = $product->getAttributes();
|
270 |
+
foreach ($attrs as $a => $ao) {
|
271 |
+
try {
|
272 |
+
if (in_array($a,$attributes_ignore)) continue;
|
273 |
+
|
274 |
+
if ($product->getData($a) !== null){
|
275 |
+
$p["attr"][$a] = $product->getAttributeText($a);
|
276 |
+
} else {
|
277 |
+
$p['_attrs_empty'][] = $a;
|
278 |
+
}
|
279 |
+
} catch (Exception $e) {
|
280 |
+
$p['_attrs_err'][$a] = [$e->getMessage(), $e->getTraceAsString()];
|
281 |
+
}
|
282 |
+
}
|
283 |
+
}
|
284 |
+
|
285 |
+
return $p;
|
286 |
+
}
|
287 |
+
|
288 |
+
private function get_categories_tree($path = null){
|
289 |
+
$return = [];
|
290 |
+
|
291 |
+
if (!count($path)) {
|
292 |
+
$parentId = Mage::app()->getStore()->getRootCategoryId();
|
293 |
+
$parent = Mage::getModel('catalog/category')->load($parentId)->getData();
|
294 |
+
$path = [$parent];
|
295 |
+
$return[$parentId] = $path;
|
296 |
+
}
|
297 |
+
$last = end($path);
|
298 |
+
|
299 |
+
$sub_cats = Mage::getModel('catalog/category')->getCollection()
|
300 |
+
//->addAttributeToSelect('*')
|
301 |
+
->addAttributeToSelect('entity_id')
|
302 |
+
->addAttributeToSelect('parent_id')
|
303 |
+
->addAttributeToSelect('path')
|
304 |
+
->addAttributeToSelect('position')
|
305 |
+
->addAttributeToSelect('level')
|
306 |
+
->addAttributeToSelect('name')
|
307 |
+
->addAttributeToSelect('url_path')
|
308 |
+
->addAttributeToFilter('is_active','1')
|
309 |
+
//->addAttributeToFilter('include_in_menu','1')
|
310 |
+
->addAttributeToFilter('parent_id',array('eq' => $last['entity_id']))
|
311 |
+
;
|
312 |
+
|
313 |
+
|
314 |
+
foreach ($sub_cats as $c=>$co) {
|
315 |
+
$cd = $co->getData();
|
316 |
+
$this_path = array_merge($path,[$cd]);
|
317 |
+
$return[$cd['entity_id']] = $this_path;
|
318 |
+
$return = $return + self::get_categories_tree($this_path);
|
319 |
+
}
|
320 |
+
return $return;
|
321 |
+
}
|
322 |
+
|
323 |
+
|
324 |
+
private function get_users_collection($first = false) {
|
325 |
+
$users = Mage::getModel('customer/customer')->getCollection();
|
326 |
+
|
327 |
+
if ($first) $this->dump("order_by",$this->get_param("order_by","updated_at"));
|
328 |
+
if ($first) $this->dump("order_dir",$this->get_param("order_dir","desc"));
|
329 |
+
$users->setOrder($this->get_param("order_by","updated_at"), $this->get_param("order_dir","desc"));
|
330 |
+
|
331 |
+
$attribute_map_list = json_decode($this->get_param("attribute_map"), true) ?: array("*");
|
332 |
+
if ($first) $this->dump("attribute_map_list",$attribute_map_list);
|
333 |
+
foreach ($attribute_map_list as $attribute_map)
|
334 |
+
$users->addAttributeToSelect($attribute_map);
|
335 |
+
|
336 |
+
|
337 |
+
$filters = json_decode($this->get_param("filters"), true) ?: array();
|
338 |
+
if ($first) $this->dump("filters",$filters);
|
339 |
+
foreach ($filters as $filter) {
|
340 |
+
call_user_func_array(array($users,'addFieldToFilter'), $filter);
|
341 |
+
}
|
342 |
+
|
343 |
+
|
344 |
+
if ($first) $this->dump("page_size",$this->get_param("page_size",10));
|
345 |
+
$users->setPageSize($this->get_param("page_size",10));
|
346 |
+
|
347 |
+
return $users;
|
348 |
+
}
|
349 |
+
|
350 |
+
private function export_user_catalog() {
|
351 |
+
$ts = microtime(1);
|
352 |
+
$users = $this->get_users_collection(true);
|
353 |
+
|
354 |
+
$this->dump("page_start",$this->get_param("page_start",1));
|
355 |
+
$currentPage = $this->get_param("page_start",1);
|
356 |
+
$pages = $users->getLastPageNumber();
|
357 |
+
$last_page = $pages;
|
358 |
+
$this->dump("page_last",$pages);
|
359 |
+
$this->dump("page_max",$this->get_param("page_max",$pages));
|
360 |
+
$pages = $this->get_param("page_max",$pages);
|
361 |
+
$this->dump("users_count",$users->getSize());
|
362 |
+
|
363 |
+
$k = 0;
|
364 |
+
do {
|
365 |
+
$this->dump("at_page",[$currentPage,$pages,$last_page]);
|
366 |
+
$users->setCurPage($currentPage);
|
367 |
+
|
368 |
+
foreach ($users as $user) {
|
369 |
+
$this->dump("user_k",$k);
|
370 |
+
try {
|
371 |
+
$this->dump("user[]",$this->map_user($user));
|
372 |
+
} catch (Exception $e) {
|
373 |
+
$this->dump("user_err[]", [$user->getId(), $e->getMessage(), $e->getTraceAsString()]);
|
374 |
+
}
|
375 |
+
|
376 |
+
$k++;
|
377 |
+
}
|
378 |
+
|
379 |
+
$currentPage++;
|
380 |
+
$users->clear();
|
381 |
+
} while ($currentPage <= $pages);
|
382 |
+
|
383 |
+
$this->dump("users_done",$k);
|
384 |
+
$this->dump("users_took",(microtime(1) - $ts));
|
385 |
+
$this->dump("users_mem",memory_get_usage());
|
386 |
+
$this->dump("users_mmem",memory_get_peak_usage());
|
387 |
+
|
388 |
+
|
389 |
+
return;
|
390 |
+
}
|
391 |
+
|
392 |
+
private function map_user($user) {
|
393 |
+
$u = [];
|
394 |
+
|
395 |
+
$u['customer_id'] = $user->getData('email');
|
396 |
+
$u['email'] = $user->getData('email');
|
397 |
+
$u['is_active'] = $user->getData('is_active');
|
398 |
+
$u['first_name'] = $user->getData('firstname');
|
399 |
+
$u['last_name'] = $user->getData('lastname');
|
400 |
+
$u['magento_customer_id'] = $user->getData('entity_id');
|
401 |
+
$u['created_at'] = Mage::getModel("core/date")->timestamp($user->getCreatedAt());
|
402 |
+
$u['updated_at'] = Mage::getModel("core/date")->timestamp($user->getUpdatedAt());
|
403 |
+
|
404 |
+
if ($this->get_param("send_core")) {
|
405 |
+
$u['core'] = $user->getData();
|
406 |
+
unset($u['core']['password_hash']);
|
407 |
+
}
|
408 |
+
|
409 |
+
return $u;
|
410 |
+
}
|
411 |
+
|
412 |
+
private function get_orders_collection($first = false) {
|
413 |
+
$users = Mage::getModel('sales/order')->getCollection();
|
414 |
+
|
415 |
+
if ($first) $this->dump("order_by",$this->get_param("order_by","updated_at"));
|
416 |
+
if ($first) $this->dump("order_dir",$this->get_param("order_dir","desc"));
|
417 |
+
$users->setOrder($this->get_param("order_by","updated_at"), $this->get_param("order_dir","desc"));
|
418 |
+
|
419 |
+
$attribute_map_list = json_decode($this->get_param("attribute_map"), true) ?: array("*");
|
420 |
+
if ($first) $this->dump("attribute_map_list",$attribute_map_list);
|
421 |
+
if ($first) $this->dump("order_attributes_ignore",$this->get_param("order_attributes_ignore",[]));
|
422 |
+
foreach ($attribute_map_list as $attribute_map)
|
423 |
+
$users->addAttributeToSelect($attribute_map);
|
424 |
+
|
425 |
+
|
426 |
+
$filters = json_decode($this->get_param("filters"), true) ?: array();
|
427 |
+
if ($first) $this->dump("filters",$filters);
|
428 |
+
foreach ($filters as $filter) {
|
429 |
+
call_user_func_array(array($users,'addFieldToFilter'), $filter);
|
430 |
+
}
|
431 |
+
|
432 |
+
|
433 |
+
if ($first) $this->dump("page_size",$this->get_param("page_size",10));
|
434 |
+
$users->setPageSize($this->get_param("page_size",10));
|
435 |
+
|
436 |
+
return $users;
|
437 |
+
}
|
438 |
+
|
439 |
+
private function export_order_catalog() {
|
440 |
+
$ts = microtime(1);
|
441 |
+
$collection = $this->get_orders_collection(true);
|
442 |
+
|
443 |
+
$this->dump("page_start",$this->get_param("page_start",1));
|
444 |
+
$currentPage = $this->get_param("page_start",1);
|
445 |
+
$pages = $collection->getLastPageNumber();
|
446 |
+
$last_page = $pages;
|
447 |
+
$this->dump("page_last",$pages);
|
448 |
+
$this->dump("page_max",$this->get_param("page_max",$pages));
|
449 |
+
$pages = $this->get_param("page_max",$pages);
|
450 |
+
$this->dump("orders_count",$collection->getSize());
|
451 |
+
|
452 |
+
$k = 0;
|
453 |
+
do {
|
454 |
+
$this->dump("at_page",[$currentPage,$pages,$last_page]);
|
455 |
+
$collection->setCurPage($currentPage);
|
456 |
+
|
457 |
+
foreach ($collection as $entiy) {
|
458 |
+
$this->dump("order_k",$k);
|
459 |
+
try {
|
460 |
+
$this->dump("order[]",$this->map_order($entiy));
|
461 |
+
} catch (Exception $e) {
|
462 |
+
$this->dump("order_err[]", [$entiy->getId(), $e->getMessage(), $e->getTraceAsString()]);
|
463 |
+
}
|
464 |
+
|
465 |
+
$k++;
|
466 |
+
}
|
467 |
+
|
468 |
+
$currentPage++;
|
469 |
+
$collection->clear();
|
470 |
+
|
471 |
+
//$collection = $this->get_products_collection();
|
472 |
+
} while ($currentPage <= $pages);
|
473 |
+
|
474 |
+
$this->dump("orders_done",$k);
|
475 |
+
$this->dump("orders_took",(microtime(1) - $ts));
|
476 |
+
$this->dump("orders_mem",memory_get_usage());
|
477 |
+
$this->dump("orders_mmem",memory_get_peak_usage());
|
478 |
+
|
479 |
+
|
480 |
+
return;
|
481 |
+
}
|
482 |
+
|
483 |
+
private function map_order($entity) {
|
484 |
+
$e = [];
|
485 |
+
$e['transaction_id'] = $entity->getId();
|
486 |
+
$e['curr'] = $entity->getData("order_currency_code");
|
487 |
+
$e['total'] = (float)$entity->getData("subtotal");
|
488 |
+
$e['grand_total'] = (float)$entity->getData("grand_total");
|
489 |
+
$e['email'] = $entity->getData("customer_email");
|
490 |
+
$e['customer_id'] = $entity->getData("customer_email");
|
491 |
+
$e['magento_customer_id'] = $entity->getData("customer_id");
|
492 |
+
$e['customer']['customer_email'] = $entity->getData("customer_email");
|
493 |
+
$e['customer']['first_name'] = $entity->getData("customer_firstname");
|
494 |
+
$e['customer']['last_name'] = $entity->getData("customer_lastname");
|
495 |
+
$e['customer']['middle_name'] = $entity->getData("customer_middlename");
|
496 |
+
$e['customer']['is_guest'] = $entity->getData("customer_is_guest");
|
497 |
+
|
498 |
+
|
499 |
+
$cart_products = $entity->getAllItems();
|
500 |
+
foreach ($cart_products as $cart_product) {
|
501 |
+
$product = Mage::getModel('catalog/product')->load($cart_product->getProductId());
|
502 |
+
$product_entry = [];
|
503 |
+
$product_entry['url'] = $product->getProductUrl();
|
504 |
+
$product_entry['item_id'] = $cart_product->getProductId();
|
505 |
+
$product_entry['qty'] = (float)$cart_product->getData('qty_ordered');
|
506 |
+
$product_entry['price'] = (float)$cart_product->getPrice();
|
507 |
+
if ($this->get_param("send_core")) $product_entry['core'] = $cart_product->getData();
|
508 |
+
$e['items'][] = $product_entry;
|
509 |
+
}
|
510 |
+
if ($this->get_param("send_core")) $e['core'] = $entity->getData();
|
511 |
+
return $e;
|
512 |
+
}
|
513 |
+
|
514 |
+
|
515 |
+
private function get_carts_collection($first = false) {
|
516 |
+
$collection = Mage::getModel('sales/quote')->getCollection();
|
517 |
+
|
518 |
+
if ($first) $this->dump("order_by",$this->get_param("order_by","updated_at"));
|
519 |
+
if ($first) $this->dump("order_dir",$this->get_param("order_dir","desc"));
|
520 |
+
$collection->setOrder($this->get_param("order_by","updated_at"), $this->get_param("order_dir","desc"));
|
521 |
+
|
522 |
+
|
523 |
+
$filters = json_decode($this->get_param("filters"), true) ?: array();
|
524 |
+
if ($first) $this->dump("filters",$filters);
|
525 |
+
foreach ($filters as $filter) {
|
526 |
+
call_user_func_array(array($collection,'addFieldToFilter'), $filter);
|
527 |
+
}
|
528 |
+
|
529 |
+
|
530 |
+
if ($first) $this->dump("page_size",$this->get_param("page_size",10));
|
531 |
+
$collection->setPageSize($this->get_param("page_size",10));
|
532 |
+
|
533 |
+
return $collection;
|
534 |
+
}
|
535 |
+
|
536 |
+
private function export_cart_catalog() {
|
537 |
+
$ts = microtime(1);
|
538 |
+
$collection = $this->get_carts_collection(true);
|
539 |
+
|
540 |
+
$this->dump("page_start",$this->get_param("page_start",1));
|
541 |
+
$currentPage = $this->get_param("page_start",1);
|
542 |
+
$pages = $collection->getLastPageNumber();
|
543 |
+
$last_page = $pages;
|
544 |
+
$this->dump("page_last",$pages);
|
545 |
+
$this->dump("page_max",$this->get_param("page_max",$pages));
|
546 |
+
$pages = $this->get_param("page_max",$pages);
|
547 |
+
$this->dump("cart_count",$collection->getSize());
|
548 |
+
|
549 |
+
$k = 0;
|
550 |
+
do {
|
551 |
+
$this->dump("at_page",[$currentPage,$pages,$last_page]);
|
552 |
+
$collection->setCurPage($currentPage);
|
553 |
+
|
554 |
+
foreach ($collection as $entiy) {
|
555 |
+
$this->dump("cart_k",$k);
|
556 |
+
try {
|
557 |
+
$this->dump("cart[]",$this->map_cart($entiy));
|
558 |
+
} catch (Exception $e) {
|
559 |
+
$this->dump("cart_err[]", [$entiy->getId(), $e->getMessage(), $e->getTraceAsString()]);
|
560 |
+
}
|
561 |
+
|
562 |
+
$k++;
|
563 |
+
}
|
564 |
+
|
565 |
+
$currentPage++;
|
566 |
+
$collection->clear();
|
567 |
+
|
568 |
+
//$collection = $this->get_products_collection();
|
569 |
+
} while ($currentPage <= $pages);
|
570 |
+
|
571 |
+
$this->dump("orders_done",$k);
|
572 |
+
$this->dump("orders_took",(microtime(1) - $ts));
|
573 |
+
$this->dump("orders_mem",memory_get_usage());
|
574 |
+
$this->dump("orders_mmem",memory_get_peak_usage());
|
575 |
+
|
576 |
+
|
577 |
+
return;
|
578 |
+
}
|
579 |
+
|
580 |
+
private function map_cart($entity) {
|
581 |
+
$e = [];
|
582 |
+
$e['cart_id'] = $entity->getId();
|
583 |
+
$e['curr'] = $entity->getData("quote_currency_code");
|
584 |
+
$e['total'] = (float)$entity->getData("subtotal");
|
585 |
+
$e['grand_total'] = (float)$entity->getData("grand_total");
|
586 |
+
$e['email'] = $entity->getData("customer_email");
|
587 |
+
$e['customer_id'] = $entity->getData("customer_email");
|
588 |
+
$e['magento_customer_id'] = $entity->getData("customer_id");
|
589 |
+
|
590 |
+
foreach ($entity->getAllItems() as $cart_product) {
|
591 |
+
$product = Mage::getModel('catalog/product')->load($cart_product->getProductId());
|
592 |
+
$product_entry = [];
|
593 |
+
$product_entry['url'] = $product->getProductUrl();
|
594 |
+
$product_entry['item_id'] = $cart_product->getProductId();
|
595 |
+
$product_entry['qty'] = (float)$cart_product->getQty();
|
596 |
+
$product_entry['price'] = (float)$cart_product->getPrice();
|
597 |
+
if ($this->get_param("send_core")) $product_entry['core'] = $cart_product->getData();
|
598 |
+
$e['items'][] = $product_entry;
|
599 |
+
}
|
600 |
+
if ($this->get_param("send_core")) $e['core'] = $entity->getData();
|
601 |
+
return $e;
|
602 |
+
}
|
603 |
+
|
604 |
+
|
605 |
+
private function get_subscribers_collection($first = false) {
|
606 |
+
$users = Mage::getModel('newsletter/subscriber')->getCollection();
|
607 |
+
|
608 |
+
|
609 |
+
if ($first) $this->dump("order_by",$this->get_param("order_by","subscriber_id"));
|
610 |
+
if ($first) $this->dump("order_dir",$this->get_param("order_dir","desc"));
|
611 |
+
$users->setOrder($this->get_param("order_by","subscriber_id"), $this->get_param("order_dir","desc"));
|
612 |
+
|
613 |
+
//$attribute_map_list = json_decode($this->get_param("attribute_map"), true) ?: array("*");
|
614 |
+
//if ($first) $this->dump("attribute_map_list",$attribute_map_list);
|
615 |
+
//if ($first) $this->dump("subscriber_attributes_ignore",$this->get_param("subscriber_attributes_ignore",[]));
|
616 |
+
//foreach ($attribute_map_list as $attribute_map)
|
617 |
+
// $users->addAttributeToSelect($attribute_map);
|
618 |
+
|
619 |
+
|
620 |
+
$filters = json_decode($this->get_param("filters"), true) ?: array();
|
621 |
+
if ($first) $this->dump("filters",$filters);
|
622 |
+
foreach ($filters as $filter) {
|
623 |
+
call_user_func_array(array($users,'addFieldToFilter'), $filter);
|
624 |
+
}
|
625 |
+
|
626 |
+
|
627 |
+
if ($first) $this->dump("page_size",$this->get_param("page_size",10));
|
628 |
+
$users->setPageSize($this->get_param("page_size",10));
|
629 |
+
|
630 |
+
return $users;
|
631 |
+
}
|
632 |
+
|
633 |
+
private function export_subscriber_catalog() {
|
634 |
+
$ts = microtime(1);
|
635 |
+
$collection = $this->get_subscribers_collection(true);
|
636 |
+
|
637 |
+
$this->dump("page_start",$this->get_param("page_start",1));
|
638 |
+
$currentPage = $this->get_param("page_start",1);
|
639 |
+
$pages = $collection->getLastPageNumber();
|
640 |
+
$last_page = $pages;
|
641 |
+
$this->dump("page_last",$pages);
|
642 |
+
$this->dump("page_max",$this->get_param("page_max",$pages));
|
643 |
+
$pages = $this->get_param("page_max",$pages);
|
644 |
+
$this->dump("subscribers_count",$collection->getSize());
|
645 |
+
|
646 |
+
$k = 0;
|
647 |
+
do {
|
648 |
+
$this->dump("at_page",[$currentPage,$pages,$last_page]);
|
649 |
+
$collection->setCurPage($currentPage);
|
650 |
+
|
651 |
+
foreach ($collection as $entiy) {
|
652 |
+
$this->dump("subscriber_k",$k);
|
653 |
+
try {
|
654 |
+
$this->dump("subscriber[]",$this->map_subscriber($entiy));
|
655 |
+
} catch (Exception $e) {
|
656 |
+
$this->dump("subscriber_err[]", [$entiy->getId(), $e->getMessage(), $e->getTraceAsString()]);
|
657 |
+
}
|
658 |
+
|
659 |
+
$k++;
|
660 |
+
}
|
661 |
+
|
662 |
+
$currentPage++;
|
663 |
+
$collection->clear();
|
664 |
+
|
665 |
+
//$collection = $this->get_products_collection();
|
666 |
+
} while ($currentPage <= $pages);
|
667 |
+
|
668 |
+
$this->dump("subscribers_done",$k);
|
669 |
+
$this->dump("subscribers_took",(microtime(1) - $ts));
|
670 |
+
$this->dump("subscribers_mem",memory_get_usage());
|
671 |
+
$this->dump("subscribers_mmem",memory_get_peak_usage());
|
672 |
+
|
673 |
+
|
674 |
+
return;
|
675 |
+
}
|
676 |
+
|
677 |
+
private function map_subscriber($entity) {
|
678 |
+
$e = [];
|
679 |
+
//$e['_core'] = $entity->getData();
|
680 |
+
$e['customer_id'] = $entity->getData("subscriber_email");
|
681 |
+
$e['email'] = $entity->getData("subscriber_email");
|
682 |
+
$e['subscriber_status'] = $entity->getData("subscriber_status");
|
683 |
+
$e['magento_customer_id'] = $entity->getData("customer_id");
|
684 |
+
|
685 |
+
if ($this->get_param("send_core")) $e['core'] = $entity->getData();
|
686 |
+
return $e;
|
687 |
+
}
|
688 |
+
}
|
app/code/community/F5/Pleisty/etc/config.xml
CHANGED
@@ -1,28 +1,35 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
-
<modules>
|
4 |
-
<F5_Pleisty>
|
5 |
-
<version>
|
6 |
-
</F5_Pleisty>
|
7 |
-
</modules>
|
8 |
-
|
9 |
-
<
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
<
|
19 |
-
|
20 |
-
<
|
21 |
-
<
|
22 |
-
<
|
23 |
-
<
|
24 |
-
</
|
25 |
-
</
|
26 |
-
</
|
27 |
-
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<config>
|
3 |
+
<modules>
|
4 |
+
<F5_Pleisty>
|
5 |
+
<version>2.1.1</version>
|
6 |
+
</F5_Pleisty>
|
7 |
+
</modules>
|
8 |
+
<adminhtml>
|
9 |
+
<layout>
|
10 |
+
<updates>
|
11 |
+
<pleisty>
|
12 |
+
<file>pleisty.xml</file>
|
13 |
+
</pleisty>
|
14 |
+
</updates>
|
15 |
+
</layout>
|
16 |
+
</adminhtml>
|
17 |
+
<frontend>
|
18 |
+
<routers>
|
19 |
+
<pleisty>
|
20 |
+
<use>standard</use>
|
21 |
+
<args>
|
22 |
+
<module>F5_Pleisty</module>
|
23 |
+
<frontName>_pleisty_feeds</frontName>
|
24 |
+
</args>
|
25 |
+
</pleisty>
|
26 |
+
</routers>
|
27 |
+
<layout>
|
28 |
+
<updates>
|
29 |
+
<pleisty>
|
30 |
+
<file>pleisty.xml</file>
|
31 |
+
</pleisty>
|
32 |
+
</updates>
|
33 |
+
</layout>
|
34 |
+
</frontend>
|
35 |
+
</config>
|
app/code/community/F5/Pleisty/etc/system.xml
CHANGED
@@ -1,86 +1,92 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
<config>
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
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 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
84 |
<label>Checkout Process Tracking</label>
|
85 |
<frontend_type>select</frontend_type>
|
86 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
@@ -89,17 +95,16 @@
|
|
89 |
<show_in_website>1</show_in_website>
|
90 |
<show_in_store>1</show_in_store>
|
91 |
</checkout_process_tracking > -->
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
<!--
|
103 |
<pseudo_checkout translate="label">
|
104 |
<label>Pseudo Checkout </label>
|
105 |
<frontend_type>select</frontend_type>
|
@@ -109,23 +114,36 @@
|
|
109 |
<show_in_website>1</show_in_website>
|
110 |
<show_in_store>1</show_in_store>
|
111 |
</pseudo_checkout> -->
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
</config>
|
1 |
+
<?xml version="1.0" encoding="UTF-8"?>
|
2 |
<config>
|
3 |
+
<tabs>
|
4 |
+
<tracker>
|
5 |
+
<label>Pleisty Configuration</label>
|
6 |
+
</tracker>
|
7 |
+
</tabs>
|
8 |
+
<sections>
|
9 |
+
<tab1 translate="label">
|
10 |
+
<label>Tracker setup</label>
|
11 |
+
<tab>tracker</tab>
|
12 |
+
<frontend_type>text</frontend_type>
|
13 |
+
<sort_order>0</sort_order>
|
14 |
+
<show_in_default>1</show_in_default>
|
15 |
+
<show_in_website>1</show_in_website>
|
16 |
+
<show_in_store>1</show_in_store>
|
17 |
+
<groups>
|
18 |
+
<general translate="label">
|
19 |
+
<label>General</label>
|
20 |
+
<frontend_type>text</frontend_type>
|
21 |
+
<sort_order>1</sort_order>
|
22 |
+
<show_in_default>1</show_in_default>
|
23 |
+
<show_in_website>1</show_in_website>
|
24 |
+
<show_in_store>1</show_in_store>
|
25 |
+
<fields>
|
26 |
+
<site_hash_varible translate="label">
|
27 |
+
<label>Site Hash</label>
|
28 |
+
<comment>Enter your Site Hash here</comment>
|
29 |
+
<frontend_type>text</frontend_type>
|
30 |
+
<sort_order>100</sort_order>
|
31 |
+
<show_in_default>1</show_in_default>
|
32 |
+
<show_in_website>1</show_in_website>
|
33 |
+
<show_in_store>1</show_in_store>
|
34 |
+
</site_hash_varible>
|
35 |
+
<base_tracking translate="label">
|
36 |
+
<label>Base Tracking</label>
|
37 |
+
<frontend_type>select</frontend_type>
|
38 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
39 |
+
<sort_order>200</sort_order>
|
40 |
+
<show_in_default>1</show_in_default>
|
41 |
+
<show_in_website>1</show_in_website>
|
42 |
+
<show_in_store>1</show_in_store>
|
43 |
+
</base_tracking>
|
44 |
+
<customer_tracking translate="label">
|
45 |
+
<label>Customer Tracking</label>
|
46 |
+
<frontend_type>select</frontend_type>
|
47 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
48 |
+
<sort_order>300</sort_order>
|
49 |
+
<show_in_default>1</show_in_default>
|
50 |
+
<show_in_website>1</show_in_website>
|
51 |
+
<show_in_store>1</show_in_store>
|
52 |
+
</customer_tracking>
|
53 |
+
<product translate="label">
|
54 |
+
<label>Product Tracking</label>
|
55 |
+
<frontend_type>select</frontend_type>
|
56 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
57 |
+
<sort_order>400</sort_order>
|
58 |
+
<show_in_default>1</show_in_default>
|
59 |
+
<show_in_website>1</show_in_website>
|
60 |
+
<show_in_store>1</show_in_store>
|
61 |
+
</product>
|
62 |
+
<product_listing translate="label">
|
63 |
+
<label>Product Listing</label>
|
64 |
+
<frontend_type>select</frontend_type>
|
65 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
66 |
+
<sort_order>500</sort_order>
|
67 |
+
<show_in_default>1</show_in_default>
|
68 |
+
<show_in_website>1</show_in_website>
|
69 |
+
<show_in_store>1</show_in_store>
|
70 |
+
</product_listing>
|
71 |
+
<shopping_cart translate="label">
|
72 |
+
<label>Shopping Cart</label>
|
73 |
+
<frontend_type>select</frontend_type>
|
74 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
75 |
+
<sort_order>600</sort_order>
|
76 |
+
<show_in_default>1</show_in_default>
|
77 |
+
<show_in_website>1</show_in_website>
|
78 |
+
<show_in_store>1</show_in_store>
|
79 |
+
</shopping_cart>
|
80 |
+
<wishlist_tracking translate="label">
|
81 |
+
<label>Wishlist Tracking</label>
|
82 |
+
<frontend_type>select</frontend_type>
|
83 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
84 |
+
<sort_order>700</sort_order>
|
85 |
+
<show_in_default>1</show_in_default>
|
86 |
+
<show_in_website>1</show_in_website>
|
87 |
+
<show_in_store>1</show_in_store>
|
88 |
+
</wishlist_tracking>
|
89 |
+
<!-- <checkout_process_tracking translate="label">
|
90 |
<label>Checkout Process Tracking</label>
|
91 |
<frontend_type>select</frontend_type>
|
92 |
<source_model>adminhtml/system_config_source_yesno</source_model>
|
95 |
<show_in_website>1</show_in_website>
|
96 |
<show_in_store>1</show_in_store>
|
97 |
</checkout_process_tracking > -->
|
98 |
+
<checkout_finalized translate="label">
|
99 |
+
<label>Checkout Finalized Tracking</label>
|
100 |
+
<frontend_type>select</frontend_type>
|
101 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
102 |
+
<sort_order>800</sort_order>
|
103 |
+
<show_in_default>1</show_in_default>
|
104 |
+
<show_in_website>1</show_in_website>
|
105 |
+
<show_in_store>1</show_in_store>
|
106 |
+
</checkout_finalized>
|
107 |
+
<!--
|
|
|
108 |
<pseudo_checkout translate="label">
|
109 |
<label>Pseudo Checkout </label>
|
110 |
<frontend_type>select</frontend_type>
|
114 |
<show_in_website>1</show_in_website>
|
115 |
<show_in_store>1</show_in_store>
|
116 |
</pseudo_checkout> -->
|
117 |
+
<other_content translate="label">
|
118 |
+
<label>Other Content</label>
|
119 |
+
<frontend_type>select</frontend_type>
|
120 |
+
<source_model>adminhtml/system_config_source_yesno</source_model>
|
121 |
+
<sort_order>900</sort_order>
|
122 |
+
<show_in_default>1</show_in_default>
|
123 |
+
<show_in_website>1</show_in_website>
|
124 |
+
<show_in_store>1</show_in_store>
|
125 |
+
</other_content>
|
126 |
+
<note1 translate="label">
|
127 |
+
<label>For additional Pleisty configuration options and reporting please use the Pleisty dashboard at:</label>
|
128 |
+
<comment>https://app.pleisty.com</comment>
|
129 |
+
<frontend_type>label</frontend_type>
|
130 |
+
<sort_order>1000</sort_order>
|
131 |
+
<show_in_default>1</show_in_default>
|
132 |
+
<show_in_website>1</show_in_website>
|
133 |
+
<show_in_store>1</show_in_store>
|
134 |
+
</note1>
|
135 |
+
<note2 translate="label">
|
136 |
+
<label>For additional support get in touch with the client service team at:</label>
|
137 |
+
<comment>support@pleisty.com</comment>
|
138 |
+
<frontend_type>label</frontend_type>
|
139 |
+
<sort_order>1100</sort_order>
|
140 |
+
<show_in_default>1</show_in_default>
|
141 |
+
<show_in_website>1</show_in_website>
|
142 |
+
<show_in_store>1</show_in_store>
|
143 |
+
</note2>
|
144 |
+
</fields>
|
145 |
+
</general>
|
146 |
+
</groups>
|
147 |
+
</tab1>
|
148 |
+
</sections>
|
149 |
</config>
|
app/design/adminhtml/default/default/layout/pleisty.xml
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
<?xml version="1.0"?>
|
2 |
-
<layout version="0.1.0">
|
3 |
-
|
4 |
-
<default>
|
5 |
-
|
6 |
-
<reference name="before_body_end">
|
7 |
-
<!-- ... another sub block ... -->
|
8 |
-
<block type="page/html" name="pleisty_javascript" template="pleisty/pleisty.phtml" />
|
9 |
-
</reference>
|
10 |
-
|
11 |
-
</default>
|
12 |
-
|
13 |
-
</layout>
|
14 |
-
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/adminhtml/default/default/template/pleisty/pleisty.phtml
DELETED
@@ -1,93 +0,0 @@
|
|
1 |
-
<style type="text/css">
|
2 |
-
|
3 |
-
#row_tab1_general_shop_id
|
4 |
-
.scope-label{
|
5 |
-
display:none;
|
6 |
-
}
|
7 |
-
#row_tab1_general_customer_tracking
|
8 |
-
.scope-label{
|
9 |
-
display:none;
|
10 |
-
}
|
11 |
-
#row_tab1_general_product_listing
|
12 |
-
.scope-label{
|
13 |
-
display:none;
|
14 |
-
}
|
15 |
-
#row_tab1_general_shopping_cart
|
16 |
-
.scope-label{
|
17 |
-
display:none;
|
18 |
-
}
|
19 |
-
#row_tab1_general_wishlist_tracking
|
20 |
-
.scope-label{
|
21 |
-
display:none;
|
22 |
-
}
|
23 |
-
#row_tab1_general_checkout_process_tracking
|
24 |
-
.scope-label{
|
25 |
-
display:none;
|
26 |
-
}
|
27 |
-
#row_tab1_general_checkout_finalized
|
28 |
-
.scope-label{
|
29 |
-
display:none;
|
30 |
-
}
|
31 |
-
#row_tab1_general_product
|
32 |
-
.scope-label{
|
33 |
-
display:none;
|
34 |
-
}
|
35 |
-
#row_tab1_general_other_content
|
36 |
-
.scope-label{
|
37 |
-
display:none;
|
38 |
-
}
|
39 |
-
|
40 |
-
</style>
|
41 |
-
|
42 |
-
<?php
|
43 |
-
$shop_id = Mage::getStoreConfig('tab1/general/shop_id');
|
44 |
-
$customer_tracking = Mage::getStoreConfig('tab1/general/customer_tracking');
|
45 |
-
$product = Mage::getStoreConfig('tab1/general/product');
|
46 |
-
$product_listing = Mage::getStoreConfig('tab1/general/product_listing');
|
47 |
-
$shopping_cart = Mage::getStoreConfig('tab1/general/shopping_cart');
|
48 |
-
$wishlist_tracking = Mage::getStoreConfig('tab1/general/wishlist_tracking');
|
49 |
-
$checkout_process_tracking = Mage::getStoreConfig('tab1/general/checkout_process_tracking');
|
50 |
-
$checkout_finalized = Mage::getStoreConfig('tab1/general/checkout_finalized');
|
51 |
-
$other_content = Mage::getStoreConfig('tab1/general/other_content');
|
52 |
-
if($shop_id==''&& $customer_tracking==''&& $product=='' && $product_listing==''&& $shopping_cart==''&& $wishlist_tracking==''&& $checkout_finalized=='' && $other_content==''){
|
53 |
-
|
54 |
-
$config = array(
|
55 |
-
array(
|
56 |
-
'path' => 'tab1/general/customer_tracking',
|
57 |
-
'value' => '1',
|
58 |
-
),
|
59 |
-
array(
|
60 |
-
'path' => 'tab1/general/product',
|
61 |
-
'value' => '1',
|
62 |
-
),
|
63 |
-
array(
|
64 |
-
'path' => 'tab1/general/product_listing',
|
65 |
-
'value' => '1',
|
66 |
-
),
|
67 |
-
array(
|
68 |
-
'path' => 'tab1/general/shopping_cart',
|
69 |
-
'value' => '1',
|
70 |
-
),
|
71 |
-
array(
|
72 |
-
'path' => 'tab1/general/wishlist_tracking',
|
73 |
-
'value' => '1',
|
74 |
-
),
|
75 |
-
array(
|
76 |
-
'path' => 'tab1/general/checkout_finalized',
|
77 |
-
'value' => '1',
|
78 |
-
),
|
79 |
-
array(
|
80 |
-
'path' => 'tab1/general/other_content',
|
81 |
-
'value' => '1',
|
82 |
-
),
|
83 |
-
);
|
84 |
-
|
85 |
-
foreach ($config as $item) {
|
86 |
-
$setup = new Mage_Core_Model_Config();
|
87 |
-
$setup->saveConfig($item['path'], $item['value'], 'default', 0);
|
88 |
-
}
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/design/frontend/base/default/template/pleisty/pleisty.phtml
CHANGED
@@ -1,5 +1,10 @@
|
|
1 |
-
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
3 |
$customer_tracking = Mage::getStoreConfig('tab1/general/customer_tracking');
|
4 |
$product = Mage::getStoreConfig('tab1/general/product');
|
5 |
$product_listing = Mage::getStoreConfig('tab1/general/product_listing');
|
@@ -9,215 +14,196 @@ $checkout_process_tracking = Mage::getStoreConfig('tab1/general/checkout_process
|
|
9 |
$checkout_finalized = Mage::getStoreConfig('tab1/general/checkout_finalized');
|
10 |
$other_content = Mage::getStoreConfig('tab1/general/other_content');
|
11 |
|
12 |
-
|
13 |
-
$page_type=Mage::app()->getFrontController()->getAction()->getFullActionName();
|
14 |
-
//echo $page_type;
|
15 |
-
switch ($page_type) {
|
16 |
-
case 'catalog_category_view': $pagetype='product_listing';break;
|
17 |
-
case 'cms_page_view': $pagetype='other_content';break;
|
18 |
-
case 'cms_index_index': $pagetype='homepage';break;
|
19 |
-
case 'catalog_product_view': $pagetype='product';break;
|
20 |
-
case 'checkout_cart_index': $pagetype='shopping_cart';break;
|
21 |
-
case 'checkout_onepage_success': $pagetype='checkout_finalized';break;
|
22 |
-
default:$pagetype='';break;
|
23 |
-
}
|
24 |
|
25 |
-
//Base Code Start
|
26 |
-
if($shop_id!='') { ?>
|
27 |
-
<script type="text/javascript">
|
28 |
-
(function() {
|
29 |
-
var site_hash = '<?php echo $shop_id;?>';
|
30 |
-
var domain = "pleisty.com";
|
31 |
-
var ldr = document.createElement('script');
|
32 |
-
ldr.type = 'text/javascript'; ldr.async = true;
|
33 |
-
|
34 |
-
ldr.src = document.location.protocol + '//tr-' +
|
35 |
-
site_hash.substr(2) + '.' + domain + '/tracker/load/' +
|
36 |
-
site_hash + '/tracker.js?_=' + (+new Date);
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
<script>
|
43 |
-
var _pleistyq = _pleistyq || [];
|
44 |
-
_pleistyq.push(['page_type', '<?php echo $pagetype; ?>']);
|
45 |
-
</script>
|
46 |
-
<?php }
|
47 |
-
//Base Code End
|
48 |
-
//Customer Info Tracking Start.
|
49 |
-
?>
|
50 |
-
<?php
|
51 |
-
if(Mage::getSingleton('customer/session')->isLoggedIn() && $customer_tracking=='1') {
|
52 |
-
$customerData = Mage::getSingleton('customer/session')->getCustomer();
|
53 |
-
$customer_id = $customerData->getId();
|
54 |
-
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
55 |
-
$customerData = Mage::getModel('customer/customer')->load($customer->getId())->getData();
|
56 |
-
Mage::log($customerData);
|
57 |
-
|
58 |
-
$customer_id=$customerData['entity_id'];
|
59 |
-
$customer_website_id=$customerData['website_id'];
|
60 |
-
$customer_email=$customerData['email'];
|
61 |
-
$customer_is_active=$customerData['is_active'];
|
62 |
-
$customer_firstname =$customerData['firstname'];
|
63 |
-
$customer_lastname =$customerData['lastname'];
|
64 |
-
$customer_middlename = $customerData['middlename'];
|
65 |
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
_pleistyq.push(['customer_id','<?php echo $customer_id;?>']);
|
70 |
-
_pleistyq.push(['customer_logged', 'true']);
|
71 |
-
var _pleistyq = _pleistyq || [];
|
72 |
-
_pleistyq.push(["custom_event","identify",{
|
73 |
-
"customer_id": "<?php echo $customer_id ;?>",
|
74 |
-
"email": "<?php echo $customer_email ;?>",
|
75 |
-
"first_name": "<?php echo $customer_firstname;?>",
|
76 |
-
"last_name": "<?php echo $customer_lastname ;?>",
|
77 |
-
"name": "<?php echo $customer_firstname.' '.$customer_lastname;?>",
|
78 |
-
"is_active": "<?php echo $customer_is_active;?>",
|
79 |
-
}]);
|
80 |
-
</script>
|
81 |
|
82 |
-
|
|
|
|
|
83 |
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
</script>
|
88 |
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
if($shopping_cart=='1' && $page_type == 'checkout_cart_index') {
|
97 |
-
$items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();
|
98 |
-
if(count($items))
|
99 |
-
{
|
100 |
-
?>
|
101 |
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
foreach($items as $item) {
|
107 |
-
echo "{";
|
108 |
-
$my_product = Mage::getModel('catalog/product')->load($item->getProductId());
|
109 |
-
echo "'url': '".$my_product->getProductUrl()."',";
|
110 |
-
echo "'item_id': '".$item->getProductId()."',";
|
111 |
-
echo "'qty': '".$item->getQty()."',";
|
112 |
-
echo "'price': '".$item->getPrice()."'";
|
113 |
-
echo "},";
|
114 |
-
}
|
115 |
-
?>
|
116 |
-
]]);
|
117 |
-
</script>
|
118 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
<?php } else { ?>
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
if($
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
?>
|
|
|
|
|
|
|
131 |
|
132 |
-
|
133 |
-
var _pleistyq = _pleistyq || [];
|
134 |
_pleistyq.push(['product_id', '<?php echo Mage::registry('current_product')->getId(); ?>']);
|
135 |
-
|
136 |
-
|
137 |
-
<?php }
|
138 |
-
|
139 |
-
//Product Info Tracking End.
|
140 |
-
|
141 |
-
//Category Info Tracking Start.
|
142 |
-
if($page_type == 'catalog_category_view' && $product_listing=='1') {
|
143 |
-
?>
|
144 |
|
145 |
-
|
146 |
-
var _pleistyq = _pleistyq || [];
|
147 |
_pleistyq.push(['cat', '<?php echo Mage::registry('current_category')->getName(); ?>']);
|
148 |
-
|
149 |
-
|
150 |
-
<?php } //Category Info Tracking Start.
|
151 |
-
|
152 |
-
if($page_type == 'wishlist_index_index' && $wishlist_tracking=='1') {
|
153 |
-
?>
|
154 |
-
|
155 |
-
<?php
|
156 |
-
//Wishlist Info Tracking End.
|
157 |
-
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
158 |
-
if($customer->getId()) {
|
159 |
-
$wishlist = Mage::getModel('wishlist/wishlist')->loadByCustomer($customer, true);
|
160 |
-
$wishListItemCollection = $wishlist->getItemCollection();
|
161 |
-
?>
|
162 |
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
|
|
|
|
177 |
}
|
178 |
?>
|
179 |
-
|
180 |
-
|
181 |
-
|
|
|
|
|
|
|
|
|
|
|
182 |
<?php } ?>
|
183 |
-
<?php } //Wishlist Info Tracking End. ?>
|
184 |
|
185 |
<?php
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
?>
|
197 |
-
<script>
|
198 |
|
199 |
-
// Please add this script to your checkout-finalized pages
|
200 |
-
var _pleistyq = _pleistyq || [];
|
201 |
_pleistyq.push(['checkout_finalized',{
|
202 |
-
'transaction_id':
|
203 |
-
'total':
|
204 |
-
'items':
|
205 |
-
|
206 |
-
<?php
|
207 |
-
foreach($allitems as $item) {
|
208 |
-
echo "{";
|
209 |
-
$my_product = Mage::getModel('catalog/product')->load($item->getProductId());
|
210 |
-
echo "'url': '".$my_product->getProductUrl()."',";
|
211 |
-
echo "'item_id': '".$item->getProductId()."',";
|
212 |
-
echo "'qty': '".$item->getQty()."',";
|
213 |
-
echo "'price': '".$item->getPrice()."'";
|
214 |
-
echo "},";
|
215 |
-
}
|
216 |
-
?>
|
217 |
-
]
|
218 |
}]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
</script>
|
220 |
-
|
221 |
-
//Checkout Finalized Info Tracking End.
|
222 |
-
?>
|
223 |
|
1 |
+
<!-- Begin Magento Extension -->
|
2 |
+
<script type="text/javascript">
|
3 |
+
var _pleistyq = _pleistyq || [];
|
4 |
+
<?php
|
5 |
+
|
6 |
+
$site_hash_varible = Mage::getStoreConfig('tab1/general/site_hash_varible');
|
7 |
+
$base_tracking = Mage::getStoreConfig('tab1/general/base_tracking');
|
8 |
$customer_tracking = Mage::getStoreConfig('tab1/general/customer_tracking');
|
9 |
$product = Mage::getStoreConfig('tab1/general/product');
|
10 |
$product_listing = Mage::getStoreConfig('tab1/general/product_listing');
|
14 |
$checkout_finalized = Mage::getStoreConfig('tab1/general/checkout_finalized');
|
15 |
$other_content = Mage::getStoreConfig('tab1/general/other_content');
|
16 |
|
17 |
+
$page_type = Mage::app()->getFrontController()->getAction()->getFullActionName();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
+
switch ($page_type) {
|
21 |
+
case 'catalog_category_view':
|
22 |
+
$pagetype = 'product_listing';
|
23 |
+
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
|
25 |
+
case 'cms_page_view':
|
26 |
+
$pagetype = 'other_content';
|
27 |
+
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
|
29 |
+
case 'cms_index_index':
|
30 |
+
$pagetype = 'homepage';
|
31 |
+
break;
|
32 |
|
33 |
+
case 'catalog_product_view':
|
34 |
+
$pagetype = 'product';
|
35 |
+
break;
|
|
|
36 |
|
37 |
+
case 'checkout_cart_index':
|
38 |
+
$pagetype = 'shopping_cart';
|
39 |
+
break;
|
40 |
|
41 |
+
case 'checkout_onepage_success':
|
42 |
+
$pagetype = 'checkout_finalized';
|
43 |
+
break;
|
|
|
|
|
|
|
|
|
|
|
44 |
|
45 |
+
default:
|
46 |
+
$pagetype = '';
|
47 |
+
break;
|
48 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
+
if (Mage::getSingleton('customer/session')->isLoggedIn() && $customer_tracking == '1') {
|
51 |
+
$customerData = Mage::getSingleton('customer/session')->getCustomer();
|
52 |
+
$customer_id = $customerData->getId();
|
53 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
54 |
+
$customerData = Mage::getModel('customer/customer')->load($customer->getId())->getData();
|
55 |
+
|
56 |
+
// Mage::log($customerData);
|
57 |
+
|
58 |
+
$customer_id = $customerData['entity_id'];
|
59 |
+
$customer_website_id = $customerData['website_id'];
|
60 |
+
$customer_email = $customerData['email'];
|
61 |
+
$customer_is_active = $customerData['is_active'];
|
62 |
+
$customer_firstname = $customerData['firstname'];
|
63 |
+
$customer_lastname = $customerData['lastname'];
|
64 |
+
$customer_middlename = @$customerData['middlename'];
|
65 |
+
?>
|
66 |
+
_pleistyq.push(['customer_id',<?php echo json_encode($customer_email); ?>]);
|
67 |
+
_pleistyq.push(['customer_logged', 'true']);
|
68 |
+
|
69 |
+
_pleistyq.push(["custom_event","identify",<?php echo json_encode(array(
|
70 |
+
"customer_id" => $customer_email,
|
71 |
+
"magento_id" => $customer_id,
|
72 |
+
"email" => $customer_email,
|
73 |
+
"first_name" => $customer_firstname,
|
74 |
+
"last_name" => $customer_lastname,
|
75 |
+
"is_active" => $customer_is_active,
|
76 |
+
)); ?>]);
|
77 |
<?php } else { ?>
|
78 |
+
_pleistyq.push(['customer_logged', 'false']);
|
79 |
+
<?php } // Customer Info Tracking End. ?>
|
80 |
+
|
81 |
+
<?php // Cart Info Tracking Start.
|
82 |
+
|
83 |
+
//if ($shopping_cart == '1' && $page_type == 'checkout_cart_index') {
|
84 |
+
if ($shopping_cart == '1') {
|
85 |
+
$items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems();
|
86 |
+
$cart = array();
|
87 |
+
if (count($items)) foreach($items as $item) {
|
88 |
+
$my_product = Mage::getModel('catalog/product')->load($item->getProductId());
|
89 |
+
|
90 |
+
$cart[] = array(
|
91 |
+
"url" => $my_product->getProductUrl(),
|
92 |
+
"item_id" => $item->getProductId(),
|
93 |
+
"qty" => $item->getQty(),
|
94 |
+
"price" => $item->getPrice(),
|
95 |
+
);
|
96 |
+
}
|
97 |
+
|
98 |
?>
|
99 |
+
_pleistyq.push(['cart', <?php echo json_encode($cart);?>]);
|
100 |
+
_pleistyq.push(['custom_event', 'magento_cart_id', <?php echo json_encode(Mage::getSingleton('checkout/session')->getQuote()->getId());?>]);
|
101 |
+
<?php } ?>
|
102 |
|
103 |
+
<?php if ($page_type == 'catalog_product_view' && $product == '1') { ?>
|
|
|
104 |
_pleistyq.push(['product_id', '<?php echo Mage::registry('current_product')->getId(); ?>']);
|
105 |
+
<?php } ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
106 |
|
107 |
+
<?php if ($page_type == 'catalog_category_view' && $product_listing == '1') { ?>
|
|
|
108 |
_pleistyq.push(['cat', '<?php echo Mage::registry('current_category')->getName(); ?>']);
|
109 |
+
_pleistyq.push(['cat_url', '<?php echo Mage::registry('current_category')->getUrl(); ?>']);
|
110 |
+
<?php } ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
|
112 |
+
<?php if ($page_type == 'wishlist_index_index' && $wishlist_tracking == '1') { ?>
|
113 |
+
|
114 |
+
<?php
|
115 |
+
$customer = Mage::getSingleton('customer/session')->getCustomer();
|
116 |
+
if ($customer->getId()) {
|
117 |
+
$wishlist = Mage::getModel('wishlist/wishlist')->loadByCustomer($customer, true);
|
118 |
+
$wishListItemCollection = $wishlist->getItemCollection();
|
119 |
+
$wishlist_items = array();
|
120 |
+
foreach($wishListItemCollection as $item) {
|
121 |
+
$my_product = Mage::getModel('catalog/product')->load($item->getProductId());
|
122 |
+
$wishlist_items[] = array(
|
123 |
+
"url" => $my_product->getProductUrl(),
|
124 |
+
"item_id" => $item->getProductId(),
|
125 |
+
"qty" => $item->getQty(),
|
126 |
+
"price" => $item->getPrice(),
|
127 |
+
);
|
128 |
}
|
129 |
?>
|
130 |
+
<?php if (count($wishlist_items)) { ?>
|
131 |
+
_pleistyq.push(['wishlist',{
|
132 |
+
'wishlist_id': 'wishlist',
|
133 |
+
'items': <?php echo json_encode($wishlist_items);?>
|
134 |
+
}]);
|
135 |
+
<?php } ?>
|
136 |
+
<?php } ?>
|
137 |
+
|
138 |
<?php } ?>
|
|
|
139 |
|
140 |
<?php
|
141 |
+
|
142 |
+
if ($page_type == 'checkout_onepage_success' && $checkout_finalized == '1') {
|
143 |
+
$_customerId = Mage::getSingleton('customer/session')->getCustomerId();
|
144 |
+
$lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
|
145 |
+
$order = Mage::getSingleton('sales/order');
|
146 |
+
$order->load($lastOrderId);
|
147 |
+
$_totalData = $order->getData();
|
148 |
+
//$_order = $this->getOrder();
|
149 |
+
$allitems = $order->getAllItems();
|
150 |
+
$allitems_clean = array();
|
151 |
+
foreach ($allitems as $item) {
|
152 |
+
$my_product = Mage::getModel('catalog/product')->load($item->getProductId());
|
153 |
+
$allitems_clean[] = array(
|
154 |
+
"url" => $my_product->getProductUrl(),
|
155 |
+
"item_id" => $item->getProductId(),
|
156 |
+
"qty" => $item->getQty(),
|
157 |
+
"price" => $item->getPrice(),
|
158 |
+
);
|
159 |
+
}
|
160 |
?>
|
|
|
161 |
|
|
|
|
|
162 |
_pleistyq.push(['checkout_finalized',{
|
163 |
+
'transaction_id': <?php echo json_encode($order->getIncrementId()); ?>,
|
164 |
+
'total': <?php echo json_encode($_totalData['subtotal']); ?>,
|
165 |
+
'items': <?php echo json_encode($allitems_clean); ?>,
|
166 |
+
'curr': <?php echo json_encode($order->getOrderCurrencyCode()); ?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
167 |
}]);
|
168 |
+
|
169 |
+
_pleistyq.push(['customer_id','<?php echo $_totalData['customer_email']; ?>']);
|
170 |
+
|
171 |
+
_pleistyq.push(["custom_event","identify",<?php echo json_encode(array(
|
172 |
+
"customer_id" => $_totalData['customer_email'],
|
173 |
+
"email" => $_totalData['customer_email'],
|
174 |
+
"first_name" => $_totalData['customer_firstname'],
|
175 |
+
"last_name" => $_totalData['customer_lastname'],
|
176 |
+
"is_guest" => $_totalData['customer_is_guest'],
|
177 |
+
));?>]);
|
178 |
+
|
179 |
+
<?php } ?>
|
180 |
+
|
181 |
+
_pleistyq.push(['page_type', <?php echo json_encode($pagetype); ?>]);
|
182 |
+
|
183 |
+
_pleistyq.push(['custom_event', 'magento_current_store_id', <?php echo json_encode(Mage::app()->getStore()->getStoreId() ? : 'na'); ?>]);
|
184 |
+
_pleistyq.push(['custom_event', 'magento_current_store_code', <?php echo json_encode(Mage::app()->getStore()->getCode() ? : 'na'); ?>]);
|
185 |
+
_pleistyq.push(['custom_event', 'magento_current_store_website_id', <?php echo json_encode(Mage::app()->getStore()->getWebsiteId() ? : 'na'); ?>]);
|
186 |
+
_pleistyq.push(['custom_event', 'magento_current_store_group_id', <?php echo json_encode(Mage::app()->getStore()->getGroupId() ? : 'na'); ?>]);
|
187 |
+
_pleistyq.push(['custom_event', 'magento_current_store_name', <?php echo json_encode(Mage::app()->getStore()->getName() ? : 'na'); ?>]);
|
188 |
+
_pleistyq.push(['custom_event', 'magento_current_curr_code', <?php echo json_encode(Mage::app()->getStore()->getCurrentCurrencyCode() ? : 'na'); ?>]);
|
189 |
+
_pleistyq.push(['custom_event', 'magento_current_locale_code', <?php echo json_encode(Mage::app()->getLocale()->getLocaleCode() ? : 'na'); ?>]);
|
190 |
+
|
191 |
+
<?php if ($site_hash_varible != '' && $base_tracking == '1') { ?>
|
192 |
+
(function() {
|
193 |
+
var site_hash = '<?php echo $site_hash_varible; ?>';
|
194 |
+
var domain = "pleisty.com";
|
195 |
+
var ldr = document.createElement('script');
|
196 |
+
ldr.type = 'text/javascript'; ldr.async = true;
|
197 |
+
|
198 |
+
ldr.src = document.location.protocol + '//tr-' +
|
199 |
+
site_hash.substr(2) + '.' + domain + '/tracker/load/' +
|
200 |
+
site_hash + '/tracker.js?_=' + (+new Date);
|
201 |
+
|
202 |
+
var s = document.getElementsByTagName('script')[0];
|
203 |
+
s.parentNode.insertBefore(ldr, s);
|
204 |
+
})();
|
205 |
+
<?php } ?>
|
206 |
+
|
207 |
</script>
|
208 |
+
<!-- End Magento Extension -->
|
|
|
|
|
209 |
|
app/etc/modules/F5_Pleisty.xml
CHANGED
@@ -2,9 +2,8 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<F5_Pleisty>
|
5 |
-
<!-- This activates the module, flip to false to deactivate -->
|
6 |
<active>true</active>
|
7 |
-
<codePool>community</codePool
|
8 |
</F5_Pleisty>
|
9 |
</modules>
|
10 |
</config>
|
2 |
<config>
|
3 |
<modules>
|
4 |
<F5_Pleisty>
|
|
|
5 |
<active>true</active>
|
6 |
+
<codePool>community</codePool>
|
7 |
</F5_Pleisty>
|
8 |
</modules>
|
9 |
</config>
|
package.xml
CHANGED
@@ -1,18 +1,19 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Pleisty</name>
|
4 |
-
<version>1.
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>
|
10 |
-
<description>
|
11 |
-
|
12 |
-
<
|
13 |
-
<
|
14 |
-
<
|
15 |
-
<
|
|
|
16 |
<compatible/>
|
17 |
-
<dependencies><required><php><min>5.0.0</min><max>7.
|
18 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Pleisty</name>
|
4 |
+
<version>2.1.1</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>Turn more visitors into customers</summary>
|
10 |
+
<description>Pleisty's advanced algorithm setup also takes into account business rules to support retail 
|
11 |
+
requirements for sale items,new product introductions,margin goals,pricing rules,promotions or cross-selling.</description>
|
12 |
+
<notes>Improvements in user tracking</notes>
|
13 |
+
<authors><author><name>Pleisty</name><user>pleisty</user><email>support@pleisty.com</email></author></authors>
|
14 |
+
<date>2017-05-19</date>
|
15 |
+
<time>10:30:41</time>
|
16 |
+
<contents><target name="magecommunity"><dir name="F5"><dir name="Pleisty"><dir name="controllers"><file name="IndexController.php" hash="288827ef4b92adc19a9de8ee07a31ea4"/></dir><dir name="etc"><file name="adminhtml.xml" hash="752d8ed736a2a0eb3cc9a7e3f3029f0e"/><file name="config.xml" hash="9f8d6c365224e6846a3534073ceca9ba"/><file name="system.xml" hash="a97d5364f2cd62633b319dacfdeba18b"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="F5_Pleisty.xml" hash="b5c7d5be915c0f018c287c35f5755c1f"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="pleisty.xml" hash="21ef71a2ed057a59802db10628439afd"/></dir><dir name="template"><dir name="pleisty"><file name="pleisty.phtml" hash="9bd9a05b929643654935326d92dbf3b5"/></dir></dir></dir></dir></dir></target></contents>
|
17 |
<compatible/>
|
18 |
+
<dependencies><required><php><min>5.0.0</min><max>7.1.2</max></php></required></dependencies>
|
19 |
</package>
|