Version Notes
Optimisation for category
Download this release
Release Info
Developer | nToklo |
Extension | ntoklo_recommendations |
Version | 1.0.7 |
Comparing to | |
See all releases |
Code changes from version 1.0.6 to 1.0.7
- app/code/community/Ntoklo/Recommendations/Block/UniversalVariable.php +1 -1
- app/code/community/Ntoklo/Recommendations/Helper/Data.php +95 -32
- app/code/community/Ntoklo/Recommendations/Model/Service.php +5 -1
- app/code/community/Ntoklo/Recommendations/etc/config.xml +1 -1
- app/code/community/Ntoklo/Recommendations/sql/ntoklo_setup/{mysql4-install-1.0.6.php → mysql4-install-1.0.7.php} +0 -0
- app/design/frontend/base/default/template/ntoklo/recommendations/universal_variable.phtml +1 -1
- app/design/frontend/base/default/template/ntoklo/recommendations/widget/chart_horisontal.phtml +7 -5
- app/design/frontend/base/default/template/ntoklo/recommendations/widget/chart_vertical.phtml +6 -5
- app/locale/en_US/ntoklo_recommendations.csv +0 -16
- js/ntoklo/util.js +1 -44
- package.xml +10 -12
app/code/community/Ntoklo/Recommendations/Block/UniversalVariable.php
CHANGED
@@ -65,7 +65,7 @@ class Ntoklo_Recommendations_Block_UniversalVariable extends Mage_Core_Block_Tem
|
|
65 |
$pageCategory = Mage::helper('ntoklo_recommendations')->getPageCategory();
|
66 |
|
67 |
$universalVariable = new Ntoklo_Recommendations_Model_UniversalVariable(array(
|
68 |
-
'version' => '1.
|
69 |
'magento_version' => Mage::getVersion(),
|
70 |
'ntoklo_version' => Mage::helper('ntoklo_recommendations')->getExtensionVersion(),
|
71 |
'user' => Mage::helper('ntoklo_recommendations')->getUvMapUser()
|
65 |
$pageCategory = Mage::helper('ntoklo_recommendations')->getPageCategory();
|
66 |
|
67 |
$universalVariable = new Ntoklo_Recommendations_Model_UniversalVariable(array(
|
68 |
+
'version' => '1.2',
|
69 |
'magento_version' => Mage::getVersion(),
|
70 |
'ntoklo_version' => Mage::helper('ntoklo_recommendations')->getExtensionVersion(),
|
71 |
'user' => Mage::helper('ntoklo_recommendations')->getUvMapUser()
|
app/code/community/Ntoklo/Recommendations/Helper/Data.php
CHANGED
@@ -69,6 +69,13 @@ class Ntoklo_Recommendations_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
69 |
private $_activationCode;
|
70 |
|
71 |
private $_usesNewWidgets;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
|
73 |
/**
|
74 |
* @return bool
|
@@ -237,19 +244,45 @@ class Ntoklo_Recommendations_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
237 |
} else {
|
238 |
// Regular page category events
|
239 |
$item = new Ntoklo_Recommendations_Model_UniversalVariable(array(
|
240 |
-
|
|
|
241 |
));
|
242 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
// Recommendation click events
|
244 |
-
if ($
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
|
|
250 |
}
|
251 |
-
|
252 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
253 |
|
254 |
return $object;
|
255 |
}
|
@@ -320,14 +353,16 @@ class Ntoklo_Recommendations_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
320 |
* @return Ntoklo_Recommendations_Model_UniversalVariable
|
321 |
*/
|
322 |
public function getUvMapPage() {
|
|
|
|
|
323 |
$pageCategory = $this->getPageCategory();
|
324 |
|
325 |
$object = new Ntoklo_Recommendations_Model_UniversalVariable(array(
|
326 |
-
'
|
327 |
));
|
328 |
|
329 |
if ($pageCategory == self::PAGE_CATEGORY_CATEGORY || $pageCategory == self::PAGE_CATEGORY_PRODUCT) {
|
330 |
-
$object->
|
331 |
}
|
332 |
return $object;
|
333 |
}
|
@@ -362,6 +397,10 @@ class Ntoklo_Recommendations_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
362 |
if ($this->getPageCategory() == self::PAGE_CATEGORY_CATEGORY) {
|
363 |
$query = $this->getCategoryPath();
|
364 |
}
|
|
|
|
|
|
|
|
|
365 |
|
366 |
// Build Items part - search context
|
367 |
// If it's a search result page than get the items from Search engine
|
@@ -369,7 +408,7 @@ class Ntoklo_Recommendations_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
369 |
/** @var $listBlock Mage_Catalog_Block_Product_List */
|
370 |
$listBlock = Mage::app()->getLayout()->getBlockSingleton('catalog/product_list');
|
371 |
foreach ($listBlock->getLoadedProductCollection() as $product) {
|
372 |
-
array_push($items, $this->getUvMapProduct($product));
|
373 |
}
|
374 |
|
375 |
}
|
@@ -388,7 +427,7 @@ class Ntoklo_Recommendations_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
388 |
* Creates the product UV object
|
389 |
* @return Ntoklo_Recommendations_Model_UniversalVariable
|
390 |
*/
|
391 |
-
public function getUvMapProduct($product = false) {
|
392 |
|
393 |
if (!$product) {
|
394 |
$product = Mage::registry('current_product');
|
@@ -417,14 +456,18 @@ class Ntoklo_Recommendations_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
417 |
'stock' => (int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty()
|
418 |
));
|
419 |
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
|
|
|
|
|
|
|
|
428 |
}
|
429 |
|
430 |
return $object;
|
@@ -558,16 +601,14 @@ class Ntoklo_Recommendations_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
558 |
* @return string
|
559 |
*/
|
560 |
public function getCategoryPath() {
|
561 |
-
|
562 |
-
$breadcrumbs = Mage::helper('catalog')->getBreadcrumbPath();
|
563 |
-
|
564 |
-
|
565 |
-
|
566 |
-
foreach ($breadcrumbs as $element) {
|
567 |
-
$label = strtolower(str_replace('>', ' ', $element['label']));
|
568 |
-
$path .= ($path == '') ? $label : ' > '. $label;
|
569 |
}
|
570 |
-
|
|
|
571 |
}
|
572 |
|
573 |
/**
|
@@ -610,4 +651,26 @@ class Ntoklo_Recommendations_Helper_Data extends Mage_Core_Helper_Abstract {
|
|
610 |
public function getExtensionVersion() {
|
611 |
return (string) $modules = Mage::getConfig()->getNode()->modules->Ntoklo_Recommendations->version;
|
612 |
}
|
613 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
private $_activationCode;
|
70 |
|
71 |
private $_usesNewWidgets;
|
72 |
+
|
73 |
+
/**
|
74 |
+
* Contains Tracker_id
|
75 |
+
*/
|
76 |
+
|
77 |
+
private $tracker_id = null;
|
78 |
+
private $widget_type = null;
|
79 |
|
80 |
/**
|
81 |
* @return bool
|
244 |
} else {
|
245 |
// Regular page category events
|
246 |
$item = new Ntoklo_Recommendations_Model_UniversalVariable(array(
|
247 |
+
'category' => self::PAGE_CATEGORY_CONVERSION_FUNNEL,
|
248 |
+
'action' => Mage::helper('ntoklo_recommendations')->getEventType($this->getPageCategory())
|
249 |
));
|
250 |
+
|
251 |
+
array_push($object, $item);
|
252 |
+
|
253 |
+
|
254 |
+
|
255 |
+
|
256 |
+
|
257 |
+
$tracker_id = Mage::helper('ntoklo_recommendations')->getTrackerId();
|
258 |
// Recommendation click events
|
259 |
+
if (!empty($_GET['nt_chrt'])) {
|
260 |
+
array_push($object, new Ntoklo_Recommendations_Model_UniversalVariable(
|
261 |
+
array('category' => 'clickthrough_goals',
|
262 |
+
'action' => 'chart-click',
|
263 |
+
'tracker_id' => $_GET['nt_chrt'] )));
|
264 |
+
|
265 |
+
|
266 |
}
|
267 |
+
|
268 |
+
if (!empty($_GET['nt_rec'])) {
|
269 |
+
array_push($object, new Ntoklo_Recommendations_Model_UniversalVariable(
|
270 |
+
array('category' => 'clickthrough_goals',
|
271 |
+
'action' => 'recommendation-click',
|
272 |
+
'tracker_id' => $_GET['nt_rec'] )));
|
273 |
+
|
274 |
+
|
275 |
+
}
|
276 |
+
|
277 |
+
|
278 |
+
if(!empty($tracker_id)){
|
279 |
+
array_push($object, new Ntoklo_Recommendations_Model_UniversalVariable(
|
280 |
+
array('category' => 'clickthrough_goals',
|
281 |
+
'action' => $this->widget_type . '-impr',
|
282 |
+
'tracker_id' => $tracker_id )));
|
283 |
+
}
|
284 |
+
}
|
285 |
+
|
286 |
|
287 |
return $object;
|
288 |
}
|
353 |
* @return Ntoklo_Recommendations_Model_UniversalVariable
|
354 |
*/
|
355 |
public function getUvMapPage() {
|
356 |
+
$object = array();
|
357 |
+
|
358 |
$pageCategory = $this->getPageCategory();
|
359 |
|
360 |
$object = new Ntoklo_Recommendations_Model_UniversalVariable(array(
|
361 |
+
'type' => $pageCategory
|
362 |
));
|
363 |
|
364 |
if ($pageCategory == self::PAGE_CATEGORY_CATEGORY || $pageCategory == self::PAGE_CATEGORY_PRODUCT) {
|
365 |
+
$object->breadcrumb = $this->getCategoryPath();
|
366 |
}
|
367 |
return $object;
|
368 |
}
|
397 |
if ($this->getPageCategory() == self::PAGE_CATEGORY_CATEGORY) {
|
398 |
$query = $this->getCategoryPath();
|
399 |
}
|
400 |
+
|
401 |
+
|
402 |
+
$pathCategory = $this->getCategoryPath();
|
403 |
+
$last = count($pathCategory) - 1;
|
404 |
|
405 |
// Build Items part - search context
|
406 |
// If it's a search result page than get the items from Search engine
|
408 |
/** @var $listBlock Mage_Catalog_Block_Product_List */
|
409 |
$listBlock = Mage::app()->getLayout()->getBlockSingleton('catalog/product_list');
|
410 |
foreach ($listBlock->getLoadedProductCollection() as $product) {
|
411 |
+
array_push($items, $this->getUvMapProduct($product, $pathCategory[$last]));
|
412 |
}
|
413 |
|
414 |
}
|
427 |
* Creates the product UV object
|
428 |
* @return Ntoklo_Recommendations_Model_UniversalVariable
|
429 |
*/
|
430 |
+
public function getUvMapProduct($product = false, $category = false) {
|
431 |
|
432 |
if (!$product) {
|
433 |
$product = Mage::registry('current_product');
|
456 |
'stock' => (int) Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getQty()
|
457 |
));
|
458 |
|
459 |
+
if($category){
|
460 |
+
$object->setProperties(array('category' => $category ));
|
461 |
+
}else{
|
462 |
+
$categoryNames = array();
|
463 |
+
if ($categories = $product->getCategoryIds()) {
|
464 |
+
foreach ($categories as $categoryId) {
|
465 |
+
array_push($categoryNames, Mage::getModel('catalog/category')->load($categoryId)->getName());
|
466 |
+
}
|
467 |
+
}
|
468 |
+
if (!empty($categoryNames)) {
|
469 |
+
$object->setProperties(array('category' => implode(', ', $categoryNames)));
|
470 |
+
}
|
471 |
}
|
472 |
|
473 |
return $object;
|
601 |
* @return string
|
602 |
*/
|
603 |
public function getCategoryPath() {
|
604 |
+
|
605 |
+
$breadcrumbs = Mage::helper('catalog')->getBreadcrumbPath();
|
606 |
+
|
607 |
+
foreach ($breadcrumbs as $element) {
|
608 |
+
$label[] = $element['label'];
|
|
|
|
|
|
|
609 |
}
|
610 |
+
|
611 |
+
return $label;
|
612 |
}
|
613 |
|
614 |
/**
|
651 |
public function getExtensionVersion() {
|
652 |
return (string) $modules = Mage::getConfig()->getNode()->modules->Ntoklo_Recommendations->version;
|
653 |
}
|
654 |
+
|
655 |
+
public function setTrackerId($tracker_id, $widget_type){
|
656 |
+
$this->tracker_id = $tracker_id;
|
657 |
+
$this->widget_type = $widget_type;
|
658 |
+
|
659 |
+
}
|
660 |
+
|
661 |
+
public function getTrackerId(){
|
662 |
+
return $this->tracker_id;
|
663 |
+
}
|
664 |
+
|
665 |
+
public function getWidgetType(){
|
666 |
+
|
667 |
+
if($this->widget_type == 'recommendation'){
|
668 |
+
return 'nt_rec';
|
669 |
+
}
|
670 |
+
|
671 |
+
if($this->widget_type){
|
672 |
+
return 'nt_chrt';
|
673 |
+
}
|
674 |
+
|
675 |
+
}
|
676 |
+
}
|
app/code/community/Ntoklo/Recommendations/Model/Service.php
CHANGED
@@ -143,7 +143,9 @@ class Ntoklo_Recommendations_Model_Service extends Mage_Core_Model_Abstract {
|
|
143 |
|
144 |
switch ($chart->getData('widget_type')) {
|
145 |
case self::CALL_METHOD_CHART:
|
146 |
-
|
|
|
|
|
147 |
if (array_key_exists('product', $item) && array_key_exists('id', $item['product'])) {
|
148 |
$ids[] = $item['product']['id'];
|
149 |
} else {
|
@@ -152,8 +154,10 @@ class Ntoklo_Recommendations_Model_Service extends Mage_Core_Model_Abstract {
|
|
152 |
}
|
153 |
break;
|
154 |
case self::CALL_METHOD_RECOMMENDATIONS:
|
|
|
155 |
if (array_key_exists('items', $response)) {
|
156 |
foreach ($response['items'] as $item) {
|
|
|
157 |
if (array_key_exists('id', $item)) {
|
158 |
$ids[] = $item['id'];
|
159 |
} else {
|
143 |
|
144 |
switch ($chart->getData('widget_type')) {
|
145 |
case self::CALL_METHOD_CHART:
|
146 |
+
|
147 |
+
foreach ($response['items'] as $item) {
|
148 |
+
Mage::helper('ntoklo_recommendations')->setTrackerId($response['tracker_id'], $chart->getData('widget_type'));
|
149 |
if (array_key_exists('product', $item) && array_key_exists('id', $item['product'])) {
|
150 |
$ids[] = $item['product']['id'];
|
151 |
} else {
|
154 |
}
|
155 |
break;
|
156 |
case self::CALL_METHOD_RECOMMENDATIONS:
|
157 |
+
|
158 |
if (array_key_exists('items', $response)) {
|
159 |
foreach ($response['items'] as $item) {
|
160 |
+
Mage::helper('ntoklo_recommendations')->setTrackerId($response['tracker_id'], $chart->getData('widget_type'));
|
161 |
if (array_key_exists('id', $item)) {
|
162 |
$ids[] = $item['id'];
|
163 |
} else {
|
app/code/community/Ntoklo/Recommendations/etc/config.xml
CHANGED
@@ -20,7 +20,7 @@
|
|
20 |
<config>
|
21 |
<modules>
|
22 |
<Ntoklo_Recommendations>
|
23 |
-
<version>1.0.
|
24 |
</Ntoklo_Recommendations>
|
25 |
</modules>
|
26 |
<global>
|
20 |
<config>
|
21 |
<modules>
|
22 |
<Ntoklo_Recommendations>
|
23 |
+
<version>1.0.7</version>
|
24 |
</Ntoklo_Recommendations>
|
25 |
</modules>
|
26 |
<global>
|
app/code/community/Ntoklo/Recommendations/sql/ntoklo_setup/{mysql4-install-1.0.6.php → mysql4-install-1.0.7.php}
RENAMED
File without changes
|
app/design/frontend/base/default/template/ntoklo/recommendations/universal_variable.phtml
CHANGED
@@ -19,7 +19,7 @@
|
|
19 |
<!-- nToklo Start -->
|
20 |
<script type="text/javascript">
|
21 |
//<![CDATA[
|
22 |
-
var _ntoklo_key = "<?php echo $this->getNtokloApiKey(); ?>";
|
23 |
var _ntoklo_debug = <?php echo $this->isNtokloDebugActive(); ?>;
|
24 |
var _ntoklo_host = "<?php echo $this->getNtokloApiServiceUrl(); ?>";
|
25 |
var _ntoklo_event_rate = "<?php echo Ntoklo_Recommendations_Helper_Data::PAGE_CATEGORY_RATE; ?>";
|
19 |
<!-- nToklo Start -->
|
20 |
<script type="text/javascript">
|
21 |
//<![CDATA[
|
22 |
+
var _ntoklo_key = "<?php echo $this->getNtokloApiKey(); ?>";
|
23 |
var _ntoklo_debug = <?php echo $this->isNtokloDebugActive(); ?>;
|
24 |
var _ntoklo_host = "<?php echo $this->getNtokloApiServiceUrl(); ?>";
|
25 |
var _ntoklo_event_rate = "<?php echo Ntoklo_Recommendations_Helper_Data::PAGE_CATEGORY_RATE; ?>";
|
app/design/frontend/base/default/template/ntoklo/recommendations/widget/chart_horisontal.phtml
CHANGED
@@ -17,13 +17,15 @@
|
|
17 |
*/
|
18 |
?>
|
19 |
|
20 |
-
<?php if (($_products = $this->getItems()) && count($_products)):
|
21 |
-
|
22 |
|
|
|
|
|
23 |
<div class="widget-ntoklo-container clearfix" style="clear:both">
|
24 |
<?php $_columnCount = $this->getColumnCount(); ?>
|
25 |
<div class="nt_wrapper nt_grid nt_orange nt_<?php echo $_columnCount ?>_column">
|
26 |
-
<p class="nt_header"><?php echo $this->getHeader()
|
27 |
<div class="nt_widget clearfix">
|
28 |
<?php $i=0; foreach ($_products as $_product): ?>
|
29 |
<?php if ($i++%$_columnCount==0): ?>
|
@@ -31,11 +33,11 @@
|
|
31 |
<?php endif ?>
|
32 |
<div class="nt_item_wrap" style="width:<?php echo (100 / $_columnCount) ?>%">
|
33 |
<div class="nt_img_wrap">
|
34 |
-
<a href="<?php echo $
|
35 |
</div>
|
36 |
<span class="nt_product_title"><?php echo $this->htmlEscape($_product->getName()) ?></span>
|
37 |
<span class="nt_product_price"><?php echo Mage::helper('core')->currency($_product->getPrice()); ?></span>
|
38 |
-
<a href="<?php echo $
|
39 |
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="10.853px" height="11.229px" viewBox="0 0 10.853 11.229" enable-background="new 0 0 10.853 11.229" xml:space="preserve">
|
40 |
<g>
|
41 |
<path fill="#fff" d="M8.825,6.164l-4.367,4.361c-0.154,0.154-0.375,0.248-0.603,0.248c-0.229,0-0.449-0.094-0.604-0.248l-0.509-0.502C2.589,9.862,2.495,9.64,2.495,9.413c0-0.229,0.094-0.449,0.248-0.604l3.255-3.255L2.743,2.305c-0.154-0.16-0.248-0.382-0.248-0.609s0.094-0.449,0.248-0.603L3.252,0.59C3.406,0.43,3.627,0.336,3.855,0.336c0.228,0,0.448,0.094,0.603,0.254l4.367,4.361c0.154,0.153,0.248,0.375,0.248,0.603S8.979,6.003,8.825,6.164z"/>
|
17 |
*/
|
18 |
?>
|
19 |
|
20 |
+
<?php if (($_products = $this->getItems()) && count($_products)):
|
21 |
+
$getTrackerId = Mage::helper('ntoklo_recommendations')->getWidgetType();
|
22 |
|
23 |
+
?>
|
24 |
+
<!-- nToklo Chart -->
|
25 |
<div class="widget-ntoklo-container clearfix" style="clear:both">
|
26 |
<?php $_columnCount = $this->getColumnCount(); ?>
|
27 |
<div class="nt_wrapper nt_grid nt_orange nt_<?php echo $_columnCount ?>_column">
|
28 |
+
<p class="nt_header"><?php echo $this->getHeader() ?></p>
|
29 |
<div class="nt_widget clearfix">
|
30 |
<?php $i=0; foreach ($_products as $_product): ?>
|
31 |
<?php if ($i++%$_columnCount==0): ?>
|
33 |
<?php endif ?>
|
34 |
<div class="nt_item_wrap" style="width:<?php echo (100 / $_columnCount) ?>%">
|
35 |
<div class="nt_img_wrap">
|
36 |
+
<a href="<?php echo Mage::getUrl($_item->getUrlPath(), array('_query'=>array($getTrackerId => Mage::helper('ntoklo_recommendations')->getTrackerId())))?>" class="ntoklo_conversion"><img src="<?php echo $this->helper('catalog/image')->init($_product, 'thumbnail')->resize(100) ?>" alt="<?php echo $this->htmlEscape($_product->getName()) ?>"></a>
|
37 |
</div>
|
38 |
<span class="nt_product_title"><?php echo $this->htmlEscape($_product->getName()) ?></span>
|
39 |
<span class="nt_product_price"><?php echo Mage::helper('core')->currency($_product->getPrice()); ?></span>
|
40 |
+
<a href="<?php echo Mage::getUrl($_item->getUrlPath(), array('_query'=>array($getTrackerId => Mage::helper('ntoklo_recommendations')->getTrackerId())))?>" class="nt_btn">
|
41 |
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="10.853px" height="11.229px" viewBox="0 0 10.853 11.229" enable-background="new 0 0 10.853 11.229" xml:space="preserve">
|
42 |
<g>
|
43 |
<path fill="#fff" d="M8.825,6.164l-4.367,4.361c-0.154,0.154-0.375,0.248-0.603,0.248c-0.229,0-0.449-0.094-0.604-0.248l-0.509-0.502C2.589,9.862,2.495,9.64,2.495,9.413c0-0.229,0.094-0.449,0.248-0.604l3.255-3.255L2.743,2.305c-0.154-0.16-0.248-0.382-0.248-0.609s0.094-0.449,0.248-0.603L3.252,0.59C3.406,0.43,3.627,0.336,3.855,0.336c0.228,0,0.448,0.094,0.603,0.254l4.367,4.361c0.154,0.153,0.248,0.375,0.248,0.603S8.979,6.003,8.825,6.164z"/>
|
app/design/frontend/base/default/template/ntoklo/recommendations/widget/chart_vertical.phtml
CHANGED
@@ -17,23 +17,24 @@
|
|
17 |
*/
|
18 |
?>
|
19 |
|
20 |
-
<?php if (($_products = $this->getItems()) && count($_products)):
|
|
|
|
|
21 |
<!-- nToklo Chart -->
|
22 |
-
|
23 |
<div class="widget-ntoklo-container clearfix" style="clear:both">
|
24 |
<div class="nt_wrapper nt_column nt_green nt_img_above">
|
25 |
<p class="nt_header"><?php echo $this->getHeader() ?></p>
|
26 |
<ul class="nt_widget">
|
27 |
-
<?php $i=0; foreach ($_products as $_item)
|
28 |
<li>
|
29 |
<div class="nt_item_wrap">
|
30 |
<div class="nt_img_wrap">
|
31 |
-
<a href="<?php echo $_item->
|
32 |
</div>
|
33 |
<div class="nt_info_wrap">
|
34 |
<span class="nt_product_title"><?php echo $this->htmlEscape($_item->getName()) ?></span>
|
35 |
<span class="nt_product_price"><?php echo Mage::helper('core')->currency($_item->getPrice()); ?></span>
|
36 |
-
<a href="<?php echo $_item->
|
37 |
</div>
|
38 |
</div>
|
39 |
</li>
|
17 |
*/
|
18 |
?>
|
19 |
|
20 |
+
<?php if (($_products = $this->getItems()) && count($_products)):
|
21 |
+
$getTrackerId = Mage::helper('ntoklo_recommendations')->getWidgetType();
|
22 |
+
?>
|
23 |
<!-- nToklo Chart -->
|
|
|
24 |
<div class="widget-ntoklo-container clearfix" style="clear:both">
|
25 |
<div class="nt_wrapper nt_column nt_green nt_img_above">
|
26 |
<p class="nt_header"><?php echo $this->getHeader() ?></p>
|
27 |
<ul class="nt_widget">
|
28 |
+
<?php $i=0; foreach ($_products as $_item):?>
|
29 |
<li>
|
30 |
<div class="nt_item_wrap">
|
31 |
<div class="nt_img_wrap">
|
32 |
+
<a href="<?php echo Mage::getUrl($_item->getUrlPath(), array('_query'=>array($getTrackerId => Mage::helper('ntoklo_recommendations')->getTrackerId())))?>" class="ntoklo_conversion"><img src="<?php echo $this->helper('catalog/image')->init($_item, 'thumbnail')->resize(100) ?>" alt="<?php echo $this->htmlEscape($_item->getName()) ?>"></a>
|
33 |
</div>
|
34 |
<div class="nt_info_wrap">
|
35 |
<span class="nt_product_title"><?php echo $this->htmlEscape($_item->getName()) ?></span>
|
36 |
<span class="nt_product_price"><?php echo Mage::helper('core')->currency($_item->getPrice()); ?></span>
|
37 |
+
<a href="<?php echo Mage::getUrl($_item->getUrlPath(), array('_query'=>array($getTrackerId => Mage::helper('ntoklo_recommendations')->getTrackerId())))?>" class="ntoklo_conversion nt_btn"><?php echo $this->__('More details') ?></a>
|
38 |
</div>
|
39 |
</div>
|
40 |
</li>
|
app/locale/en_US/ntoklo_recommendations.csv
DELETED
@@ -1,16 +0,0 @@
|
|
1 |
-
"Ntoklo Recommendations","Ntoklo Recommendations"
|
2 |
-
"Outputs Ntoklo recommendaded products, regardless page context","Outputs Ntoklo recommendaded products, regardless page context"
|
3 |
-
"Widget type","Widget type"
|
4 |
-
"Header","Header"
|
5 |
-
"Widget's header been displayed on the page.","Widget's header been displayed on the page."
|
6 |
-
"Time Window","Time Window"
|
7 |
-
"The time window for which the charts are requested.","The time window for which the charts are requested."
|
8 |
-
"Max products","Max products"
|
9 |
-
"Limits the number of products displayed in the widget.","Limits the number of products displayed in the widget."
|
10 |
-
"Column count","Column count"
|
11 |
-
"The number of columns used when displaying in <strong>Recommendation Grid Template</strong>.","The number of columns used when displaying in <strong>Recommendation Grid Template</strong>."
|
12 |
-
"Cache lifetime","Cache lifetime"
|
13 |
-
"86400 by default, if not set. To refresh instantly, Clear the Blocks HTML Output Cache.","86400 by default, if not set. To refresh instantly, Clear the Blocks HTML Output Cache."
|
14 |
-
"Debug","Debug"
|
15 |
-
"Turn this ON to force logging of API call and set the first 4 products from catalog as API response to test the look and feel of the widget.","Turn this ON to force logging of API call and set the first 4 products from catalog as API response to test the look and feel of the widget."
|
16 |
-
"Frontend Template","Frontend Template"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
js/ntoklo/util.js
CHANGED
@@ -34,24 +34,6 @@ var Ntoklo = Class.create({
|
|
34 |
'type': 'text/javascript',
|
35 |
'async': true,
|
36 |
'id': 'ntoklo_js'};
|
37 |
-
|
38 |
-
// register recommended clickEvent
|
39 |
-
var ntoklo = this;
|
40 |
-
$$('.ntoklo_conversion').each(function(elem){
|
41 |
-
$(elem).observe('click', function(){
|
42 |
-
ntoklo.clickEvent('conversion');
|
43 |
-
});
|
44 |
-
});
|
45 |
-
|
46 |
-
// //register rate clickEvent
|
47 |
-
// if ($('review-form')) {
|
48 |
-
// $('review-form').observe('submit', function(event){
|
49 |
-
// if (!event.stopped) {
|
50 |
-
// event.preventDefault();
|
51 |
-
// ntoklo.clickEvent('review');
|
52 |
-
// }
|
53 |
-
// });
|
54 |
-
// }
|
55 |
},
|
56 |
|
57 |
typeOf: function(value) {
|
@@ -107,34 +89,9 @@ var Ntoklo = Class.create({
|
|
107 |
}
|
108 |
},
|
109 |
|
110 |
-
|
111 |
-
var pagesource = window.universal_variable.page;
|
112 |
-
document.cookie = "ntoklo_conversion=" + JSON.stringify(pagesource)+ "; path="+ Mage.Cookies.path+ "; domain = "+ Mage.Cookies.domain+ "";
|
113 |
-
},
|
114 |
-
|
115 |
loadEvent: function() {
|
116 |
window.universal_variable = this.mergeUv();
|
117 |
this.submitUv();
|
118 |
-
},
|
119 |
-
|
120 |
-
clickEvent: function(event_type) {
|
121 |
-
if (!event_type) {
|
122 |
-
return false;
|
123 |
-
}
|
124 |
-
window.universal_variable = this.mergeUv();
|
125 |
-
switch (event_type) {
|
126 |
-
case 'review':
|
127 |
-
window.universal_variable.events.items = new Array({'type' : _ntoklo_event_rate}, {'type' : _ntoklo_event_review});
|
128 |
-
this.submitUv(this.reviewCallback);
|
129 |
-
break;
|
130 |
-
case 'conversion':
|
131 |
-
this.setConversion();
|
132 |
-
break;
|
133 |
-
}
|
134 |
-
return true;
|
135 |
-
},
|
136 |
-
|
137 |
-
reviewCallback: function() {
|
138 |
-
$('review-form').submit();
|
139 |
}
|
140 |
});
|
34 |
'type': 'text/javascript',
|
35 |
'async': true,
|
36 |
'id': 'ntoklo_js'};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
},
|
38 |
|
39 |
typeOf: function(value) {
|
89 |
}
|
90 |
},
|
91 |
|
92 |
+
|
|
|
|
|
|
|
|
|
93 |
loadEvent: function() {
|
94 |
window.universal_variable = this.mergeUv();
|
95 |
this.submitUv();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
}
|
97 |
});
|
package.xml
CHANGED
@@ -1,23 +1,21 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>ntoklo_recommendations</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
-
<license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
-
<summary>Displays personalised product recommendations and trending product charts through
|
10 |
-
<description>
|
11 |
-

|
12 |
-
1. Seamlessly Integrates with nToklo for retail recommendations API’s.
|
13 |
2. Uses the Open Data Alliance Universal Variable - Generats UniversalVariable JSON object and submits it to nToklo for processing to leverage user behaviour.
|
14 |
3. Utilises native widgets to render personalised product recommendations and trending product charts through nToklo API’s.
|
15 |
4. Integrates with your store CMS to account for product categories</description>
|
16 |
-
<notes>
|
17 |
-
<authors><author><name>
|
18 |
-
<date>2014-
|
19 |
-
<time>
|
20 |
-
<contents><target name="magecommunity"><dir name="Ntoklo"><dir name="Recommendations"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Registration.php" hash="6454d0327fb5881aba96beaed86005ac"/></dir></dir></dir></dir><dir name="Widget"><dir name="Date"><file name="Helper.php" hash="29592c951ce694efb69397141a679226"/></dir><dir name="Type"><file name="Helper.php" hash="7003dba7c2b54e7dd03013de2f41a4e1"/></dir></dir></dir><file name="Chart.php" hash="2f1f29ce21a7eaf2cda2f576225de839"/><file name="UniversalVariable.php" hash="
|
21 |
<compatible/>
|
22 |
-
<dependencies><required><php><min>5.
|
23 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>ntoklo_recommendations</name>
|
4 |
+
<version>1.0.7</version>
|
5 |
<stability>stable</stability>
|
6 |
+
<license>open software license</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
+
<summary>Displays personalised product recommendations and trending product charts through nToklo for retail platform. </summary>
|
10 |
+
<description>1. Seamlessly Integrates with nToklo for retail recommendations API’s.
|
|
|
|
|
11 |
2. Uses the Open Data Alliance Universal Variable - Generats UniversalVariable JSON object and submits it to nToklo for processing to leverage user behaviour.
|
12 |
3. Utilises native widgets to render personalised product recommendations and trending product charts through nToklo API’s.
|
13 |
4. Integrates with your store CMS to account for product categories</description>
|
14 |
+
<notes>Optimisation for category</notes>
|
15 |
+
<authors><author><name>Fu</name><user>ntoklo</user><email>fu.hoang@ntoklo.com</email></author></authors>
|
16 |
+
<date>2014-05-14</date>
|
17 |
+
<time>14:04:26</time>
|
18 |
+
<contents><target name="magecommunity"><dir name="Ntoklo"><dir name="Recommendations"><dir name="Block"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Registration.php" hash="6454d0327fb5881aba96beaed86005ac"/></dir></dir></dir></dir><dir name="Widget"><dir name="Date"><file name="Helper.php" hash="29592c951ce694efb69397141a679226"/></dir><dir name="Type"><file name="Helper.php" hash="7003dba7c2b54e7dd03013de2f41a4e1"/></dir></dir></dir><file name="Chart.php" hash="2f1f29ce21a7eaf2cda2f576225de839"/><file name="UniversalVariable.php" hash="5d152104f7b251062ce9827ad05945cc"/></dir><dir name="Helper"><file name="Data.php" hash="07443c67ce8b49310612bf819f2daab8"/></dir><dir name="Model"><dir name="Cache"><file name="UniversalVariable.php" hash="761f465d4fda0e3d48541fc67af5c4b1"/></dir><file name="Observer.php" hash="9a22bdcae4fc457372692b0488f30833"/><dir name="Resource"><dir name="Mysql4"><file name="Setup.php" hash="c76b856838d10860a74c2ec08d47bc87"/></dir></dir><file name="Service.php" hash="d69b8bc183819898ab8bb38e7ba2de6f"/><file name="UniversalVariable.php" hash="7744caef59b5c3f056f89577c108e0f5"/><dir name="Widget"><file name="Type.php" hash="f399f8084a0c9c270c92e5fccd74e50f"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="aff0945a94da77aab01ef814d14309d5"/><file name="cache.xml" hash="9be6ef2826f8e880e0c2db016787cacf"/><file name="config.xml" hash="b76d6847cb7260274cf127e9e15b0075"/><file name="system.xml" hash="d90aad78d74273219bbeb6bd3b38e477"/><file name="widget.xml" hash="e94eaffd9ce677d742161bca542c069b"/></dir><dir name="sql"><dir name="ntoklo_setup"><file name="mysql4-install-1.0.7.php" hash="96c7c0734c5290210b09dbb96f5cfa34"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Ntoklo_Recommendations.xml" hash="d809f1cc3329034ac5d3ffcc4fe40d4c"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="ntoklo_recommendations.xml" hash="b6649abad9f507fdf0e7b48d11d9a594"/></dir><dir name="template"><dir name="ntoklo"><dir name="recommendations"><file name="universal_variable.phtml" hash="a825bae10ea9f4bd603fa233d2681f93"/><dir name="widget"><file name="chart_horisontal.phtml" hash="efba8941003934aa0b1f19e80919e493"/><file name="chart_review_short.phtml" hash="25a789e2e031e33e6e82fcd8fd73aa23"/><file name="chart_vertical.phtml" hash="b088fc290cee7a5c9ee7656c9b6c7cfd"/></dir></dir></dir></dir></dir></dir></dir></target><target name="mage"><dir name="documentation"><file name="readme.html" hash="76a9aa7ea09fbb80af24ce340f498d13"/><dir name="skin"><dir><dir name="img"><file name="cc.png" hash="83f629e3f2c6e94df256a92a0d826079"/><file name="config.png" hash="a0f8540c37bbaa614a6e6818c52b9b1e"/><file name="disablec1.png" hash="3b7a509db5f2228c1187dd169c8a7c34"/><file name="disablec2.png" hash="ce25b484b08735a1890a4871eefd23ef"/><file name="logo.png" hash="5bbc2b3e56f571eb96923185485c3a27"/><file name="widgets_1.png" hash="61c6c6acc64e9bad49e2546d43032767"/><file name="widgets_2.png" hash="a357562e6cb535458c30f8a6c53bd44d"/><file name="widgets_3.png" hash="cc6ec6b496b03e516c29eb8ed63aa7a9"/><file name="widgets_4.png" hash="1feb96648e38c0e95629bf897baeb26b"/></dir></dir><file name="style.css" hash="f544a9e3edc200affa0a9be9af98e878"/></dir></dir><dir name="js"><dir name="ntoklo"><file name="util.js" hash="9cea20bac53b7f7890613e18fd4c5275"/></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="ntoklo"><file name="global.css" hash="fd2d2b773d3ce16d41488e9051bad8c8"/><file name="widget.css" hash="2d1a9869e0c5e857965d4158535237f2"/></dir></dir><dir name="images"><file name="ntoklo" hash=""/></dir></dir></dir></dir></target></contents>
|
19 |
<compatible/>
|
20 |
+
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
21 |
</package>
|