Version Notes
Added personalized display options for currencies
Download this release
Release Info
Developer | BrainSINS |
Extension | Brainsins_Recommender |
Version | 1.5.9 |
Comparing to | |
See all releases |
Code changes from version 1.5.8 to 1.5.9
- app/code/community/Brainsins/Recsins/Block/.DS_Store +0 -0
- app/code/community/Brainsins/Recsins/Block/Adminhtml/.DS_Store +0 -0
- app/code/community/Brainsins/Recsins/Block/Adminhtml/Recsins/.DS_Store +0 -0
- app/code/community/Brainsins/Recsins/Block/Adminhtml/Recsins/Edit/Form.php +76 -1
- app/code/community/Brainsins/Recsins/Block/Recsins.php +103 -57
- app/code/community/Brainsins/Recsins/Model/Api/ficheros.zip +0 -0
- app/code/community/Brainsins/Recsins/Model/Api/ficheros/Api.php +0 -263
- app/code/community/Brainsins/Recsins/Model/Api/ficheros/ProductsApi.php +0 -261
- app/code/community/Brainsins/Recsins/controllers/Adminhtml/RecsinsController.php +23 -5
- app/code/community/Brainsins/Recsins/etc/config.xml +1 -1
- app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.5.8-1.5.9.php +47 -0
- package.xml +5 -6
app/code/community/Brainsins/Recsins/Block/.DS_Store
ADDED
Binary file
|
app/code/community/Brainsins/Recsins/Block/Adminhtml/.DS_Store
ADDED
Binary file
|
app/code/community/Brainsins/Recsins/Block/Adminhtml/Recsins/.DS_Store
ADDED
Binary file
|
app/code/community/Brainsins/Recsins/Block/Adminhtml/Recsins/Edit/Form.php
CHANGED
@@ -419,6 +419,71 @@ class Brainsins_Recsins_Block_Adminhtml_Recsins_Edit_Form extends Mage_Adminhtml
|
|
419 |
//$outOfStockCheckbox->setIsChecked(true);
|
420 |
}
|
421 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
422 |
$imagesLabel = new Varien_Data_Form_Element_Label(array('value' => $helper->__("Select Image url type"), 'bold' => 'true'));
|
423 |
|
424 |
$radioNotResize = new Varien_Data_Form_Element_Radio();
|
@@ -569,11 +634,21 @@ class Brainsins_Recsins_Block_Adminhtml_Recsins_Edit_Form extends Mage_Adminhtml
|
|
569 |
$useAjaxRequests->setIsChecked(false);
|
570 |
}
|
571 |
$useAjaxRequestsLabel = new Varien_Data_Form_Element_Label(array('value' => $helper->__("Use ajax for recommendation requests"), 'bold' => 'true'));
|
572 |
-
|
573 |
|
574 |
//$advancedFieldSet->addElement($advancedRadios);
|
575 |
$advancedFieldSet->addElement($includeOutOfStockLabel);
|
576 |
$advancedFieldSet->addElement($outOfStockCheckbox);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
577 |
$advancedFieldSet->addElement($imagesLabel);
|
578 |
$advancedFieldSet->addElement($imageRadios);
|
579 |
$advancedFieldSet->addElement($widthText);
|
419 |
//$outOfStockCheckbox->setIsChecked(true);
|
420 |
}
|
421 |
|
422 |
+
|
423 |
+
// currency symbols, positions and delimiters
|
424 |
+
|
425 |
+
$currencies = Mage::app()->getStore()->getAvailableCurrencyCodes(true);
|
426 |
+
$stores = Mage::app()->getStore()->getCollection();
|
427 |
+
|
428 |
+
$currencyOptions = array();
|
429 |
+
|
430 |
+
$currenciesLabel = new Varien_Data_Form_Element_Label(array('value' => $helper->__("Currency Display Options"), 'bold' => 'true'));
|
431 |
+
|
432 |
+
foreach($currencies as $currency) {
|
433 |
+
$currencyHeader = new Varien_Data_Form_Element_Label(array('value' => $helper->__($currency), 'bold' => 'false'));
|
434 |
+
$currencySymbolText = new Varien_Data_Form_Element_Text(array('name' => $currency.'_symb_text', "label" => $helper->__('Currency Symbol')));
|
435 |
+
|
436 |
+
$radioLeft = new Varien_Data_Form_Element_Radio();
|
437 |
+
$radioLeft->setLabel($helper->__("Left"));
|
438 |
+
$radioLeft->setValue("curr_symb_left");
|
439 |
+
$radioLeft->setAdditional_text("");
|
440 |
+
|
441 |
+
$radioRight = new Varien_Data_Form_Element_Radio();
|
442 |
+
$radioRight->setLabel($helper->__("Right"));
|
443 |
+
$radioRight->setValue("curr_symb_right");
|
444 |
+
$radioRight->setAdditional_text("");
|
445 |
+
|
446 |
+
$currSymbPosOptions = array();
|
447 |
+
$currSymbPosOptions[] = $radioLeft;
|
448 |
+
$currSymbPosOptions[] = $radioRight;
|
449 |
+
$currSymbPos = new BS_Radios(array('name' => $currency.'_symb_pos_options', 'separator' => '<br>'));
|
450 |
+
$currSymbPos->setId($currency . "_symb_pos_options");
|
451 |
+
$currSymbPos->setValues($currSymbPosOptions);
|
452 |
+
|
453 |
+
$currencyDelimiter = new Varien_Data_Form_Element_Text(array('name' => $currency .'_delim', "label" => $helper->__("Currency Delimiter")));
|
454 |
+
|
455 |
+
$currencyOptions[$currency] = array();
|
456 |
+
$currencyOptions[$currency]['header'] = $currencyHeader;
|
457 |
+
$currencyOptions[$currency]['symbol'] = $currencySymbolText;
|
458 |
+
$currencyOptions[$currency]['position'] = $currSymbPos;
|
459 |
+
$currencyOptions[$currency]['delimiter'] = $currencyDelimiter;
|
460 |
+
|
461 |
+
//selected option
|
462 |
+
|
463 |
+
$selectedSymbol = Mage::getStoreConfig("brainsins/BS_". $currency . "_SYMBOL");
|
464 |
+
if (!isset($selectedSymbol) || !$selectedSymbol) {
|
465 |
+
$selectedSymbol = Mage::app()->getLocale()->currency($currency)->getSymbol();
|
466 |
+
}
|
467 |
+
$currencySymbolText->setValue($selectedSymbol);
|
468 |
+
|
469 |
+
$selectedPosition = Mage::getStoreConfig("brainsins/BS_". $currency . "_POSITION");
|
470 |
+
if ((!isset($selectedPosition) || !$selectedPosition) || !($selectedPosition == "curr_symb_right" || $selectedPosition == "curr_symb_left")) {
|
471 |
+
$selectedPosition = "curr_symb_right";
|
472 |
+
}
|
473 |
+
$currSymbPos->setValue(array($selectedPosition));
|
474 |
+
|
475 |
+
$selectedDelimiter = Mage::getStoreConfig("brainsins/BS_". $currency . "_DELIMITER");
|
476 |
+
if (!isset($selectedDelimiter) || !$selectedDelimiter) {
|
477 |
+
$selectedDelimiter = ",";
|
478 |
+
}
|
479 |
+
$currencyDelimiter->setValue($selectedDelimiter);
|
480 |
+
}
|
481 |
+
|
482 |
+
|
483 |
+
|
484 |
+
|
485 |
+
//
|
486 |
+
|
487 |
$imagesLabel = new Varien_Data_Form_Element_Label(array('value' => $helper->__("Select Image url type"), 'bold' => 'true'));
|
488 |
|
489 |
$radioNotResize = new Varien_Data_Form_Element_Radio();
|
634 |
$useAjaxRequests->setIsChecked(false);
|
635 |
}
|
636 |
$useAjaxRequestsLabel = new Varien_Data_Form_Element_Label(array('value' => $helper->__("Use ajax for recommendation requests"), 'bold' => 'true'));
|
637 |
+
|
638 |
|
639 |
//$advancedFieldSet->addElement($advancedRadios);
|
640 |
$advancedFieldSet->addElement($includeOutOfStockLabel);
|
641 |
$advancedFieldSet->addElement($outOfStockCheckbox);
|
642 |
+
|
643 |
+
$advancedFieldSet->addElement($currenciesLabel);
|
644 |
+
foreach($currencyOptions as $currency => $options) {
|
645 |
+
$advancedFieldSet->addElement($options['header']);
|
646 |
+
$advancedFieldSet->addElement($options['symbol']);
|
647 |
+
$advancedFieldSet->addElement($options['position']);
|
648 |
+
$advancedFieldSet->addElement($options['delimiter']);
|
649 |
+
}
|
650 |
+
|
651 |
+
|
652 |
$advancedFieldSet->addElement($imagesLabel);
|
653 |
$advancedFieldSet->addElement($imageRadios);
|
654 |
$advancedFieldSet->addElement($widthText);
|
app/code/community/Brainsins/Recsins/Block/Recsins.php
CHANGED
@@ -251,7 +251,7 @@ class Brainsins_Recsins_Block_Recsins extends Mage_Core_Block_Abstract {
|
|
251 |
//track page url
|
252 |
$product = Mage::registry('current_product');
|
253 |
if (isset($product) && $product) {
|
254 |
-
|
255 |
|
256 |
$pid = $product->getId();
|
257 |
$name = $product->getName();
|
@@ -406,7 +406,7 @@ class Brainsins_Recsins_Block_Recsins extends Mage_Core_Block_Abstract {
|
|
406 |
|
407 |
if (isset($key) && $key != null && isset($recommenderId)) {
|
408 |
|
409 |
-
$paintCallback = "null";
|
410 |
if ($placeKey == 'brainsins/BS_HOME_RECOMMENDER') {
|
411 |
$paintCallback = "bsPaintHomeRecommendations";
|
412 |
} elseif ($placeKey == 'brainsins/BS_PRODUCT_RECOMMENDER') {
|
@@ -418,44 +418,67 @@ class Brainsins_Recsins_Block_Recsins extends Mage_Core_Block_Abstract {
|
|
418 |
} elseif ($placeKey == 'brainsins/BS_CATEGORY_RECOMMENDER') {
|
419 |
$paintCallback = "bsPaintCategoryRecommendations";
|
420 |
}
|
421 |
-
|
422 |
$script .= '<script type="text/javascript">' . PHP_EOL;
|
423 |
$script .= 'var bsHost = (("https:" == document.location.protocol) ? "https://" : "http://");' . PHP_EOL;
|
424 |
$script .= 'document.write(unescape("%3Cscript src=\'" + bsHost + "' . $recUrl . '/bsrecwidget.js\' type=\'text/javascript\'%3E%3C/script%3E"));' . PHP_EOL;
|
425 |
$script .= "</script>" . PHP_EOL;
|
426 |
-
|
427 |
$script .= '<script type="text/javascript">' . PHP_EOL;
|
428 |
$script .= 'var BrainSINSRecommender = BrainSINS.getRecommender(BrainSINSTracker);' . PHP_EOL;
|
429 |
$script .= 'BrainSINSRecommender.loadCSS(' . $recommenderId . ");" . PHP_EOL;
|
430 |
-
|
431 |
$useHighDetail = Mage::getStoreConfig('brainsins/BS_USE_HIGH_DETAIL');
|
432 |
if (isset($useHighDetail) && $useHighDetail == "1") {
|
433 |
$script .= 'BrainSINSRecommender.setDetailsLevel("high");' . PHP_EOL;
|
434 |
}
|
435 |
-
|
436 |
-
|
437 |
-
$currencyJs = "";
|
438 |
$currencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
439 |
$langCode = Mage::app()->getStore()->getCode() . $currencyCode;
|
440 |
-
|
441 |
if ($currencySymbol == "$") {
|
442 |
$script .= "BrainSINSRecommender.setCurrencySymbol( BrainSINS.RecommenderConstants.dollar );" . PHP_EOL;
|
443 |
-
$script .= "BrainSINSRecommender.setCurrencySymbolPosition( BrainSINS.RecommenderConstants.leftPosition );" . PHP_EOL;
|
444 |
-
$script .= "BrainSINSRecommender.setCurrencyDelimiter( '.' );" . PHP_EOL;
|
445 |
} else if ($currencySymbol == "£") {
|
446 |
$script .= "BrainSINSRecommender.setCurrencySymbol( BrainSINS.RecommenderConstants.pound );" . PHP_EOL;
|
447 |
-
$script .= "BrainSINSRecommender.setCurrencySymbolPosition( BrainSINS.RecommenderConstants.leftPosition );" . PHP_EOL;
|
448 |
-
$script .= "BrainSINSRecommender.setCurrencyDelimiter( '.' );" . PHP_EOL;
|
449 |
} else if ($currencySymbol == "€") {
|
450 |
//default behaviour
|
451 |
} else {
|
452 |
$script .= "BrainSINSRecommender.setCurrencySymbol('$currencySymbol');" . PHP_EOL;
|
453 |
-
$script .= "BrainSINSRecommender.setCurrencySymbolPosition( BrainSINS.RecommenderConstants.leftPosition );" . PHP_EOL;
|
454 |
-
$script .= "BrainSINSRecommender.setCurrencyDelimiter( '.' );" . PHP_EOL;
|
455 |
}
|
456 |
-
|
457 |
-
$script .= "</script>" . PHP_EOL;
|
458 |
|
|
|
|
|
459 |
$script .= '<script type="text/javascript">' . PHP_EOL;
|
460 |
|
461 |
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
@@ -467,35 +490,35 @@ class Brainsins_Recsins_Block_Recsins extends Mage_Core_Block_Abstract {
|
|
467 |
} else {
|
468 |
$callUrl .= "/recsins/index/getRecommendations";
|
469 |
}
|
470 |
-
|
471 |
-
|
472 |
$script .= 'new Ajax.Request("' . $callUrl;
|
473 |
-
|
474 |
$script .= '/recId/' . $recommenderId;
|
475 |
$script .= '/userId/' . $userId;
|
476 |
-
|
477 |
if ($placeKey == 'brainsins/BS_CATEGORY_RECOMMENDER') {
|
478 |
$script .= '/categories/' . $productId;
|
479 |
$script .= '/filter/all';
|
480 |
} elseif ($placeKey == 'brainsins/BS_PRODUCT_RECOMMENDER') {
|
481 |
$script .= '/prodId/' . $productId;
|
482 |
}
|
483 |
-
|
484 |
$script .= '/lang/' . $langCode;
|
485 |
$script .= '/divName/' . $divId;
|
486 |
-
|
487 |
$script .= '",{';
|
488 |
$script .= 'method : "get",' . PHP_EOL;
|
489 |
-
$script .= 'onSuccess : function(transport) {' . PHP_EOL;
|
490 |
$script .= 'if (typeof ' . $paintCallback . ' == "function") {';
|
491 |
$script .= $paintCallback . "(transport.responseJSON);";
|
492 |
$script .= "} else {";
|
493 |
$script .= "BrainSINSRecommender.paintRecommendations(transport.responseJSON);";
|
494 |
$script .="}";
|
495 |
-
|
496 |
$script .= '}' . PHP_EOL;
|
497 |
$script .= '});' . PHP_EOL;
|
498 |
-
|
499 |
$script .= "</script>" . PHP_EOL;
|
500 |
}
|
501 |
|
@@ -532,28 +555,51 @@ class Brainsins_Recsins_Block_Recsins extends Mage_Core_Block_Abstract {
|
|
532 |
if (isset($key) && $key != null && isset($recommenderId)) {
|
533 |
|
534 |
$paintCallback = "null";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
535 |
|
536 |
-
$
|
|
|
|
|
|
|
|
|
537 |
$currencyJs = "";
|
538 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
539 |
$langCode = Mage::app()->getStore()->getCode() . $currencyCode;
|
540 |
|
541 |
if ($currencySymbol == "$") {
|
542 |
$currencyJs .= "BrainSINSRecommender.setCurrencySymbol( BrainSINS.RecommenderConstants.dollar );" . PHP_EOL;
|
543 |
-
|
544 |
-
$currencyJs .= "BrainSINSRecommender.setCurrencyDelimiter( '.' );" . PHP_EOL;
|
545 |
-
} else if ($currencySymbol == "�") {
|
546 |
$currencyJs .= "BrainSINSRecommender.setCurrencySymbol( BrainSINS.RecommenderConstants.pound );" . PHP_EOL;
|
547 |
-
|
548 |
-
$currencyJs .= "BrainSINSRecommender.setCurrencyDelimiter( '.' );" . PHP_EOL;
|
549 |
-
} else if ($currencySymbol == "�") {
|
550 |
//default behaviour
|
551 |
} else {
|
552 |
$currencyJs .= "BrainSINSRecommender.setCurrencySymbol('$currencySymbol');" . PHP_EOL;
|
553 |
-
|
554 |
-
$currencyJs .= "BrainSINSRecommender.setCurrencyDelimiter( '.' );" . PHP_EOL;
|
555 |
-
}
|
556 |
-
|
557 |
|
558 |
if ($placeKey == 'brainsins/BS_HOME_RECOMMENDER') {
|
559 |
$paintCallback = "typeof bsPaintHomeRecommendations == 'undefined' ? null : bsPaintHomeRecommendations";
|
@@ -576,37 +622,37 @@ class Brainsins_Recsins_Block_Recsins extends Mage_Core_Block_Abstract {
|
|
576 |
$script .= 'var bsHost = (("https:" == document.location.protocol) ? "https://" : "http://");' . PHP_EOL;
|
577 |
$script .= 'document.write(unescape("%3Cscript src=\'" + bsHost + "' . $recUrl . '/bsrecwidget.js\' type=\'text/javascript\'%3E%3C/script%3E"));' . PHP_EOL;
|
578 |
$script .= "</script>" . PHP_EOL;
|
579 |
-
|
580 |
$useHighDetailScript = "";
|
581 |
-
|
582 |
$useHighDetail = Mage::getStoreConfig('brainsins/BS_USE_HIGH_DETAIL');
|
583 |
if (isset($useHighDetail) && $useHighDetail == "1") {
|
584 |
$useHighDetailScript = 'BrainSINSRecommender.setDetailsLevel("high");' . PHP_EOL;
|
585 |
}
|
586 |
-
|
587 |
$script .= '
|
588 |
-
<script type="text/javascript">
|
589 |
-
|
590 |
-
|
591 |
-
|
592 |
-
|
593 |
-
|
594 |
-
|
595 |
-
|
596 |
-
|
597 |
-
</script>
|
598 |
-
';
|
599 |
}
|
600 |
|
601 |
/*$script .= "<script type='text/javascript'>";
|
602 |
$script .= "var BrainSINSRecommender = BrainSINS.getRecommender( BrainSINSTracker );";
|
603 |
$script .= "BrainSINSRecommender.loadCSS(2);";
|
604 |
$script .= 'new Ajax.Request("/mage170/recsins/index/getRecommendations", {';
|
605 |
-
|
606 |
-
|
607 |
-
|
608 |
-
|
609 |
-
|
610 |
|
611 |
$script .="</script>";*/
|
612 |
|
251 |
//track page url
|
252 |
$product = Mage::registry('current_product');
|
253 |
if (isset($product) && $product) {
|
254 |
+
|
255 |
|
256 |
$pid = $product->getId();
|
257 |
$name = $product->getName();
|
406 |
|
407 |
if (isset($key) && $key != null && isset($recommenderId)) {
|
408 |
|
409 |
+
$paintCallback = "null";
|
410 |
if ($placeKey == 'brainsins/BS_HOME_RECOMMENDER') {
|
411 |
$paintCallback = "bsPaintHomeRecommendations";
|
412 |
} elseif ($placeKey == 'brainsins/BS_PRODUCT_RECOMMENDER') {
|
418 |
} elseif ($placeKey == 'brainsins/BS_CATEGORY_RECOMMENDER') {
|
419 |
$paintCallback = "bsPaintCategoryRecommendations";
|
420 |
}
|
421 |
+
|
422 |
$script .= '<script type="text/javascript">' . PHP_EOL;
|
423 |
$script .= 'var bsHost = (("https:" == document.location.protocol) ? "https://" : "http://");' . PHP_EOL;
|
424 |
$script .= 'document.write(unescape("%3Cscript src=\'" + bsHost + "' . $recUrl . '/bsrecwidget.js\' type=\'text/javascript\'%3E%3C/script%3E"));' . PHP_EOL;
|
425 |
$script .= "</script>" . PHP_EOL;
|
426 |
+
|
427 |
$script .= '<script type="text/javascript">' . PHP_EOL;
|
428 |
$script .= 'var BrainSINSRecommender = BrainSINS.getRecommender(BrainSINSTracker);' . PHP_EOL;
|
429 |
$script .= 'BrainSINSRecommender.loadCSS(' . $recommenderId . ");" . PHP_EOL;
|
430 |
+
|
431 |
$useHighDetail = Mage::getStoreConfig('brainsins/BS_USE_HIGH_DETAIL');
|
432 |
if (isset($useHighDetail) && $useHighDetail == "1") {
|
433 |
$script .= 'BrainSINSRecommender.setDetailsLevel("high");' . PHP_EOL;
|
434 |
}
|
435 |
+
|
436 |
+
|
|
|
437 |
$currencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();
|
438 |
+
|
439 |
+
$selectedSymbol = Mage::getStoreConfig("brainsins/BS_". $currencyCode . "_SYMBOL");
|
440 |
+
$selectedPosition = Mage::getStoreConfig("brainsins/BS_". $currencyCode . "_POSITION");
|
441 |
+
$selectedDelimiter = Mage::getStoreConfig("brainsins/BS_". $currencyCode . "_DELIMITER");
|
442 |
+
|
443 |
+
if (isset($selectedSymbol) && $selectedSymbol) {
|
444 |
+
$currencySymbol = $selectedSymbol;
|
445 |
+
} else {
|
446 |
+
$currencySymbol = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
|
447 |
+
}
|
448 |
+
|
449 |
+
$currencyPosition = "curr_symb_right";
|
450 |
+
if (isset($selectedPosition) && ($selectedPosition == "curr_symb_left" || $selectedPosition == "curr_symb_right")) {
|
451 |
+
$currencyPosition = $selectedPosition;
|
452 |
+
}
|
453 |
+
|
454 |
+
$currencyDelimiter = ",";
|
455 |
+
if (isset($selectedDelimiter) && $selectedDelimiter) {
|
456 |
+
$currencyDelimiter = $selectedDelimiter;
|
457 |
+
}
|
458 |
+
|
459 |
+
if ($currencyPosition == "curr_symb_left") {
|
460 |
+
$script .= "BrainSINSRecommender.setCurrencySymbolPosition( BrainSINS.RecommenderConstants.leftPosition );" . PHP_EOL;
|
461 |
+
} else {
|
462 |
+
$script .= "BrainSINSRecommender.setCurrencySymbolPosition( BrainSINS.RecommenderConstants.rightPosition );" . PHP_EOL;
|
463 |
+
}
|
464 |
+
$script .= "BrainSINSRecommender.setCurrencyDelimiter( '$currencyDelimiter' );" . PHP_EOL;
|
465 |
+
|
466 |
+
|
467 |
+
$currencyJs = "";
|
468 |
$langCode = Mage::app()->getStore()->getCode() . $currencyCode;
|
469 |
+
|
470 |
if ($currencySymbol == "$") {
|
471 |
$script .= "BrainSINSRecommender.setCurrencySymbol( BrainSINS.RecommenderConstants.dollar );" . PHP_EOL;
|
|
|
|
|
472 |
} else if ($currencySymbol == "£") {
|
473 |
$script .= "BrainSINSRecommender.setCurrencySymbol( BrainSINS.RecommenderConstants.pound );" . PHP_EOL;
|
|
|
|
|
474 |
} else if ($currencySymbol == "€") {
|
475 |
//default behaviour
|
476 |
} else {
|
477 |
$script .= "BrainSINSRecommender.setCurrencySymbol('$currencySymbol');" . PHP_EOL;
|
|
|
|
|
478 |
}
|
|
|
|
|
479 |
|
480 |
+
$script .= "</script>" . PHP_EOL;
|
481 |
+
|
482 |
$script .= '<script type="text/javascript">' . PHP_EOL;
|
483 |
|
484 |
$baseUrl = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);
|
490 |
} else {
|
491 |
$callUrl .= "/recsins/index/getRecommendations";
|
492 |
}
|
493 |
+
|
494 |
+
|
495 |
$script .= 'new Ajax.Request("' . $callUrl;
|
496 |
+
|
497 |
$script .= '/recId/' . $recommenderId;
|
498 |
$script .= '/userId/' . $userId;
|
499 |
+
|
500 |
if ($placeKey == 'brainsins/BS_CATEGORY_RECOMMENDER') {
|
501 |
$script .= '/categories/' . $productId;
|
502 |
$script .= '/filter/all';
|
503 |
} elseif ($placeKey == 'brainsins/BS_PRODUCT_RECOMMENDER') {
|
504 |
$script .= '/prodId/' . $productId;
|
505 |
}
|
506 |
+
|
507 |
$script .= '/lang/' . $langCode;
|
508 |
$script .= '/divName/' . $divId;
|
509 |
+
|
510 |
$script .= '",{';
|
511 |
$script .= 'method : "get",' . PHP_EOL;
|
512 |
+
$script .= 'onSuccess : function(transport) {' . PHP_EOL;
|
513 |
$script .= 'if (typeof ' . $paintCallback . ' == "function") {';
|
514 |
$script .= $paintCallback . "(transport.responseJSON);";
|
515 |
$script .= "} else {";
|
516 |
$script .= "BrainSINSRecommender.paintRecommendations(transport.responseJSON);";
|
517 |
$script .="}";
|
518 |
+
|
519 |
$script .= '}' . PHP_EOL;
|
520 |
$script .= '});' . PHP_EOL;
|
521 |
+
|
522 |
$script .= "</script>" . PHP_EOL;
|
523 |
}
|
524 |
|
555 |
if (isset($key) && $key != null && isset($recommenderId)) {
|
556 |
|
557 |
$paintCallback = "null";
|
558 |
+
|
559 |
+
$currencyCode = Mage::app()->getStore()->getCurrentCurrencyCode();
|
560 |
+
|
561 |
+
$selectedSymbol = Mage::getStoreConfig("brainsins/BS_". $currencyCode . "_SYMBOL");
|
562 |
+
$selectedPosition = Mage::getStoreConfig("brainsins/BS_". $currencyCode . "_POSITION");
|
563 |
+
$selectedDelimiter = Mage::getStoreConfig("brainsins/BS_". $currencyCode . "_DELIMITER");
|
564 |
+
if (isset($selectedSymbol) && $selectedSymbol) {
|
565 |
+
$currencySymbol = $selectedSymbol;
|
566 |
+
} else {
|
567 |
+
$currencySymbol = Mage::app()->getLocale()->currency(Mage::app()->getStore()->getCurrentCurrencyCode())->getSymbol();
|
568 |
+
}
|
569 |
+
|
570 |
+
$currencyPosition = "curr_symb_right";
|
571 |
+
if (isset($selectedPosition) && ($selectedPosition == "curr_symb_left" || $selectedPosition == "curr_symb_right")) {
|
572 |
+
$currencyPosition = $selectedPosition;
|
573 |
+
}
|
574 |
|
575 |
+
$currencyDelimiter = ",";
|
576 |
+
if (isset($selectedDelimiter) && $selectedDelimiter) {
|
577 |
+
$currencyDelimiter = $selectedDelimiter;
|
578 |
+
}
|
579 |
+
|
580 |
$currencyJs = "";
|
581 |
+
|
582 |
+
|
583 |
+
|
584 |
+
if ($currencyPosition == "curr_symb_left") {
|
585 |
+
$currencyJs .= "BrainSINSRecommender.setCurrencySymbolPosition( BrainSINS.RecommenderConstants.leftPosition );" . PHP_EOL;
|
586 |
+
} else {
|
587 |
+
$currencyJs .= "BrainSINSRecommender.setCurrencySymbolPosition( BrainSINS.RecommenderConstants.rightPosition );" . PHP_EOL;
|
588 |
+
}
|
589 |
+
$currencyJs .= "BrainSINSRecommender.setCurrencyDelimiter( '$currencyDelimiter' );" . PHP_EOL;
|
590 |
+
|
591 |
+
|
592 |
$langCode = Mage::app()->getStore()->getCode() . $currencyCode;
|
593 |
|
594 |
if ($currencySymbol == "$") {
|
595 |
$currencyJs .= "BrainSINSRecommender.setCurrencySymbol( BrainSINS.RecommenderConstants.dollar );" . PHP_EOL;
|
596 |
+
} else if ($currencySymbol == "£") {
|
|
|
|
|
597 |
$currencyJs .= "BrainSINSRecommender.setCurrencySymbol( BrainSINS.RecommenderConstants.pound );" . PHP_EOL;
|
598 |
+
} else if ($currencySymbol == "€") {
|
|
|
|
|
599 |
//default behaviour
|
600 |
} else {
|
601 |
$currencyJs .= "BrainSINSRecommender.setCurrencySymbol('$currencySymbol');" . PHP_EOL;
|
602 |
+
}
|
|
|
|
|
|
|
603 |
|
604 |
if ($placeKey == 'brainsins/BS_HOME_RECOMMENDER') {
|
605 |
$paintCallback = "typeof bsPaintHomeRecommendations == 'undefined' ? null : bsPaintHomeRecommendations";
|
622 |
$script .= 'var bsHost = (("https:" == document.location.protocol) ? "https://" : "http://");' . PHP_EOL;
|
623 |
$script .= 'document.write(unescape("%3Cscript src=\'" + bsHost + "' . $recUrl . '/bsrecwidget.js\' type=\'text/javascript\'%3E%3C/script%3E"));' . PHP_EOL;
|
624 |
$script .= "</script>" . PHP_EOL;
|
625 |
+
|
626 |
$useHighDetailScript = "";
|
627 |
+
|
628 |
$useHighDetail = Mage::getStoreConfig('brainsins/BS_USE_HIGH_DETAIL');
|
629 |
if (isset($useHighDetail) && $useHighDetail == "1") {
|
630 |
$useHighDetailScript = 'BrainSINSRecommender.setDetailsLevel("high");' . PHP_EOL;
|
631 |
}
|
632 |
+
|
633 |
$script .= '
|
634 |
+
<script type="text/javascript">
|
635 |
+
try{
|
636 |
+
BrainSINSTracker.setCustomAttribute("currencySymbol", "' . $currencySymbol . '");
|
637 |
+
var BrainSINSRecommender = BrainSINS.getRecommender( BrainSINSTracker );
|
638 |
+
' . $filter . '
|
639 |
+
' . $currencyJs . '
|
640 |
+
' . $useHighDetailScript .'
|
641 |
+
BrainSINSRecommender.loadWidget("' . $recommenderId . '",' . $prodId . ',"' . $langCode . '","' . $divId . '",' . $userId . ',' . $paintCallback . ');
|
642 |
+
}catch(err) { }
|
643 |
+
</script>
|
644 |
+
';
|
645 |
}
|
646 |
|
647 |
/*$script .= "<script type='text/javascript'>";
|
648 |
$script .= "var BrainSINSRecommender = BrainSINS.getRecommender( BrainSINSTracker );";
|
649 |
$script .= "BrainSINSRecommender.loadCSS(2);";
|
650 |
$script .= 'new Ajax.Request("/mage170/recsins/index/getRecommendations", {';
|
651 |
+
$script .= 'method : "get",';
|
652 |
+
$script .= 'onSuccess : function(transport) {';
|
653 |
+
$script .= 'document.getElementById("home_recommendations").innerHTML = transport.responseText';
|
654 |
+
$script .= '}';
|
655 |
+
$script .= '})';
|
656 |
|
657 |
$script .="</script>";*/
|
658 |
|
app/code/community/Brainsins/Recsins/Model/Api/ficheros.zip
DELETED
Binary file
|
app/code/community/Brainsins/Recsins/Model/Api/ficheros/Api.php
DELETED
@@ -1,263 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
|
27 |
-
class Brainsins_Recsins_Model_Api_Api extends Mage_Api_Model_Resource_Abstract {
|
28 |
-
|
29 |
-
public function test($param) {
|
30 |
-
return array("text" => "hey, i was invoked and i return something! like " . $param);
|
31 |
-
}
|
32 |
-
|
33 |
-
public function storeList() {
|
34 |
-
$stores = Mage::app()->getStore()->getCollection();
|
35 |
-
$result = array();
|
36 |
-
foreach($stores as $store) {
|
37 |
-
$result[$store->getId()] = array("id" => $store->getId(), "code" => $store->getCode());
|
38 |
-
}
|
39 |
-
return $result;
|
40 |
-
}
|
41 |
-
|
42 |
-
public function productInfo($productId, $store = null, $options = array(), $filter = array()) {
|
43 |
-
|
44 |
-
$productsApi = new Brainsins_Recsins_Model_Api_ProductsApi();
|
45 |
-
|
46 |
-
return ($productsApi->bsInfo($productId, $store));
|
47 |
-
}
|
48 |
-
|
49 |
-
public function productCount() {
|
50 |
-
return array(Mage::getModel("catalog/product")->getCollection()
|
51 |
-
->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
|
52 |
-
->count());
|
53 |
-
}
|
54 |
-
|
55 |
-
public function productPage($numPage, $size, $visibility = 2, $options = array(), $filter = array()) {
|
56 |
-
|
57 |
-
$visibility = 2;
|
58 |
-
$visibilityComparator = "ge";
|
59 |
-
|
60 |
-
if (array_key_exists("visibility", $options)) {
|
61 |
-
$visibility = $options["visibility"];
|
62 |
-
}
|
63 |
-
|
64 |
-
if (array_key_exists("visibilityComparator", $options)) {
|
65 |
-
$visibilityComparator = $options["visibilityComparator"];
|
66 |
-
}
|
67 |
-
|
68 |
-
|
69 |
-
$products = Mage::getModel('catalog/product')->getCollection()
|
70 |
-
->addAttributeToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
|
71 |
-
->addAttributeToSelect('id')->
|
72 |
-
addAttributeToSelect('visibility')->
|
73 |
-
addAttributeToSelect('store_ids')->
|
74 |
-
setPage($numPage, $size);
|
75 |
-
|
76 |
-
$result = array();
|
77 |
-
$productsApi = new Brainsins_Recsins_Model_Api_ProductsApi();
|
78 |
-
|
79 |
-
foreach($products as $product) {
|
80 |
-
$id = $product->getId();
|
81 |
-
$prodVisibility = $product->getVisibility();
|
82 |
-
|
83 |
-
if (
|
84 |
-
$visibilityComparator == "eq" && $prodVisibility == $visibility ||
|
85 |
-
$visibilityComparator == "ne" && $prodVisibility != $visibility ||
|
86 |
-
$visibilityComparator == "gt" && $prodVisibility > $visibility ||
|
87 |
-
$visibilityComparator == "ge" && $prodVisibility >= $visibility ||
|
88 |
-
$visibilityComparator == "lt" && $prodVisibility < $visibility ||
|
89 |
-
$visibilityComparator == "le" && $prodVisibility <= $visibility
|
90 |
-
) {
|
91 |
-
$stores = $product->getStoreIds();
|
92 |
-
|
93 |
-
if (isset($stores) && is_array($stores)) {
|
94 |
-
$result[$id] = array();
|
95 |
-
|
96 |
-
foreach($stores as $storeId) {
|
97 |
-
$product->setStoreId($storeId);
|
98 |
-
$prodInfo = $productsApi->bsInfo($id, $storeId, $options, $filter);
|
99 |
-
$result[$id][$storeId] = $prodInfo;
|
100 |
-
}
|
101 |
-
}
|
102 |
-
}
|
103 |
-
}
|
104 |
-
return $result;
|
105 |
-
}
|
106 |
-
|
107 |
-
public function userCount() {
|
108 |
-
return array(Mage::getModel("customer/customer")->getCollection()->count());
|
109 |
-
}
|
110 |
-
|
111 |
-
public function userPage($numPage, $size) {
|
112 |
-
$customers = Mage::getModel("customer/customer")->getCollection()->setPage($numPage, $size);
|
113 |
-
$result = array();
|
114 |
-
|
115 |
-
foreach($customers as $customer) {
|
116 |
-
$customerInfo = array();
|
117 |
-
$customerInfo['id'] = $customer->getId();
|
118 |
-
|
119 |
-
$subscriber = Mage::getModel("newsletter/subscriber");
|
120 |
-
$subscriber->loadByCustomer($customer);
|
121 |
-
|
122 |
-
$email = $customer->getEmail();
|
123 |
-
$subscribed = "0";
|
124 |
-
if ($subscriber->isSubscribed()) {
|
125 |
-
$subscribed = "1";
|
126 |
-
}
|
127 |
-
|
128 |
-
$customerInfo['email'] = $email;
|
129 |
-
$customerInfo['bs_lang_code'] = Mage::app()->getStore($customer->getStoreId())->getCode();
|
130 |
-
$customerInfo['bs_is_subscribed'] = $subscribed;
|
131 |
-
$result[] = $customerInfo;
|
132 |
-
}
|
133 |
-
|
134 |
-
return $result;
|
135 |
-
}
|
136 |
-
|
137 |
-
public function getExtensionOptions() {
|
138 |
-
|
139 |
-
$result = array();
|
140 |
-
|
141 |
-
$version = Mage::getStoreConfig('brainsins/BS_VERSION');
|
142 |
-
|
143 |
-
if (isset($version)) {
|
144 |
-
$result['version'] = $version;
|
145 |
-
} else {
|
146 |
-
$result['version'] = "0";
|
147 |
-
}
|
148 |
-
|
149 |
-
$key = Mage::getStoreConfig('brainsins/BSKEY');
|
150 |
-
|
151 |
-
if (isset($key)) {
|
152 |
-
$result['key'] = $key;
|
153 |
-
} else {
|
154 |
-
$result['key'] = "0";
|
155 |
-
}
|
156 |
-
|
157 |
-
$enabledValue = Mage::getStoreConfig('brainsins/BS_ENABLED');
|
158 |
-
|
159 |
-
if (isset($enabledValue)) {
|
160 |
-
$result['enabled'] = $enabledValue;
|
161 |
-
} else {
|
162 |
-
$result['enabled'] = "0";
|
163 |
-
}
|
164 |
-
|
165 |
-
$homeSelected = Mage::getStoreConfig('brainsins/BS_HOME_RECOMMENDER');
|
166 |
-
|
167 |
-
if (isset($homeSelected)) {
|
168 |
-
$result['home_recommender'] = $homeSelected;
|
169 |
-
} else {
|
170 |
-
$result['home_recommender'] = "0";
|
171 |
-
}
|
172 |
-
|
173 |
-
$categorySelected = Mage::getStoreConfig('brainsins/BS_CATEGORY_RECOMMENDER');
|
174 |
-
|
175 |
-
if (isset($categorySelected)) {
|
176 |
-
$result['category_recommender'] = $categorySelected;
|
177 |
-
} else {
|
178 |
-
$result['category_recommender'] = "0";
|
179 |
-
}
|
180 |
-
|
181 |
-
$productSelected = Mage::getStoreConfig('brainsins/BS_PRODUCT_RECOMMENDER');
|
182 |
-
|
183 |
-
if (isset($productSelected)) {
|
184 |
-
$result['product_recommender'] = $productSelected;
|
185 |
-
} else {
|
186 |
-
$result['product_recommender'] = "0";
|
187 |
-
}
|
188 |
-
|
189 |
-
|
190 |
-
$cartSelected = Mage::getStoreConfig('brainsins/BS_CART_RECOMMENDER');
|
191 |
-
|
192 |
-
if (isset($cartSelected)) {
|
193 |
-
$result['cart_recommender'] = $cartSelected;
|
194 |
-
} else {
|
195 |
-
$result['cart_recommender'] = "0";
|
196 |
-
}
|
197 |
-
|
198 |
-
$checkoutSelected = Mage::getStoreConfig('brainsins/BS_CHECKOUT_RECOMMENDER');
|
199 |
-
|
200 |
-
if (isset($checkoutSelected)) {
|
201 |
-
$result['checkout_recommender'] = $checkoutSelected;
|
202 |
-
} else {
|
203 |
-
$result['checkout_recommender'] = "0";
|
204 |
-
}
|
205 |
-
|
206 |
-
|
207 |
-
$outOfStockSelected = Mage::getStoreConfig('brainsins/BS_SEND_OUT_OF_STOCK_PRODUCTS');
|
208 |
-
|
209 |
-
if (isset($outOfStockSelected)) {
|
210 |
-
$result['upload_out_of_stock'] = $outOfStockSelected;
|
211 |
-
} else {
|
212 |
-
$result['upload_out_of_stock'] = "0";
|
213 |
-
}
|
214 |
-
|
215 |
-
$imageSelectedOption = Mage::getStoreConfig('brainsins/BS_IMAGE_RESIZE');
|
216 |
-
|
217 |
-
if (isset($imageSelectedOption)) {
|
218 |
-
$result['image_option'] = $imageSelectedOption;
|
219 |
-
} else {
|
220 |
-
$result['image_option'] = "image_no_resize";
|
221 |
-
}
|
222 |
-
|
223 |
-
$imageSelectedWidth = Mage::getStoreConfig('brainsins/BS_IMAGE_RESIZE_WIDTH');
|
224 |
-
|
225 |
-
if (isset($imageSelectedWidth)) {
|
226 |
-
$result['image_resize_width'] = $imageSelectedWidth;
|
227 |
-
} else {
|
228 |
-
$result['image_resize_width'] = "0";
|
229 |
-
}
|
230 |
-
|
231 |
-
$imageSelectedHeigth = Mage::getStoreConfig('brainsins/BS_IMAGE_RESIZE_HEIGTH');
|
232 |
-
|
233 |
-
if (isset($imageSelectedHeigth)) {
|
234 |
-
$result['image_resize_heigth'] = $imageSelectedHeigth;
|
235 |
-
} else {
|
236 |
-
$result['image_resize_heigth'] = "0";
|
237 |
-
}
|
238 |
-
|
239 |
-
$specialPriceSelectedOption = Mage::getStoreConfig('brainsins/BS_USE_SPECIAL_PRICE');
|
240 |
-
|
241 |
-
if (isset($specialPriceSelectedOption)) {
|
242 |
-
$result['use_special_price'] = $specialPriceSelectedOption;
|
243 |
-
} else {
|
244 |
-
$result['use_special_price'] = "0";
|
245 |
-
}
|
246 |
-
|
247 |
-
$taxPriceSelectedOption = Mage::getStoreConfig('brainsins/BS_TAX_PRICE');
|
248 |
-
|
249 |
-
if (isset($taxPriceSelectedOption)) {
|
250 |
-
$result['tax_price'] = $taxPriceSelectedOption;
|
251 |
-
} else {
|
252 |
-
$result['tax_price'] = "tax_price_equal";
|
253 |
-
}
|
254 |
-
|
255 |
-
return $result;
|
256 |
-
}
|
257 |
-
|
258 |
-
public function notifyVersion($version) {
|
259 |
-
if (isset ($version)) {
|
260 |
-
Mage::getModel('core/config')->saveConfig('brainsins/BS_LAST_AVAILABLE_VERSION', $version);
|
261 |
-
}
|
262 |
-
}
|
263 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/Model/Api/ficheros/ProductsApi.php
DELETED
@@ -1,261 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/*
|
4 |
-
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
-
* personalized product recommendations into a Magento Store.
|
6 |
-
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
-
*
|
8 |
-
* This file is part of BrainSINS' Magento Extension.
|
9 |
-
*
|
10 |
-
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
-
* and/or modify it under the terms of the GNU General Public License
|
12 |
-
* as published by the Free Software Foundation, either version 3 of the
|
13 |
-
* License, or (at your option) any later version.
|
14 |
-
*
|
15 |
-
* Foobar is distributed in the hope that it will be useful,
|
16 |
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
-
* GNU General Public License for more details.
|
19 |
-
*
|
20 |
-
* You should have received a copy of the GNU General Public License
|
21 |
-
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
-
*
|
23 |
-
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
-
*
|
25 |
-
*/
|
26 |
-
|
27 |
-
class Brainsins_Recsins_Model_Api_ProductsApi extends Mage_Catalog_Model_Product_Api {
|
28 |
-
|
29 |
-
|
30 |
-
protected function _getProduct($productId, $storeId = null, $identifierType = null)
|
31 |
-
{
|
32 |
-
$product = Mage::getModel('catalog/product');
|
33 |
-
|
34 |
-
if (isset($storeId) && $storeId != null) {
|
35 |
-
$product->setStoreId($storeId);
|
36 |
-
}
|
37 |
-
|
38 |
-
$product->load($productId);
|
39 |
-
return $product;
|
40 |
-
}
|
41 |
-
|
42 |
-
protected function _getRealImageUrl($product, $store) {
|
43 |
-
$prodImage = $product->getSmallImage();
|
44 |
-
|
45 |
-
$img = Mage::getModel("catalog/product_image");
|
46 |
-
$img->setDestinationSubdir("small_image");
|
47 |
-
$img->setBaseFile($prodImage);
|
48 |
-
|
49 |
-
$baseDir = Mage::getBaseDir('media');
|
50 |
-
$path = str_replace($baseDir . DS, "", $img->getBaseFile());
|
51 |
-
return $store->getBaseUrl('media') . str_replace(DS, '/', $path) ;
|
52 |
-
}
|
53 |
-
|
54 |
-
private function checkOption($option, $options) {
|
55 |
-
return array_key_exists($option, $options) && $options[$option] == "1";
|
56 |
-
}
|
57 |
-
|
58 |
-
public function info($productId, $storeId = null, $options = array(), $filter = array())
|
59 |
-
{
|
60 |
-
$product = $this->_getProduct($productId, $storeId, $identifierType);
|
61 |
-
$store = Mage::app()->getStore($storeId);
|
62 |
-
|
63 |
-
if (!$product->getId()) {
|
64 |
-
$this->_fault('not_exists');
|
65 |
-
}
|
66 |
-
|
67 |
-
$result = array( // Basic product data
|
68 |
-
'product_id' => $product->getId(),
|
69 |
-
'sku' => $product->getSku(),
|
70 |
-
'set' => $product->getAttributeSetId(),
|
71 |
-
'type' => $product->getTypeId(),
|
72 |
-
'categories' => $product->getCategoryIds(),
|
73 |
-
'websites' => $product->getWebsiteIds()
|
74 |
-
);
|
75 |
-
|
76 |
-
foreach ($product->getTypeInstance(true)->getEditableAttributes($product) as $attribute) {
|
77 |
-
if ($this->_isAllowedAttribute($attribute, $attributes) && !in_array($attribute->getAttributeCode(), $filter)) {
|
78 |
-
$result[$attribute->getAttributeCode()] = $product->getData(
|
79 |
-
$attribute->getAttributeCode());
|
80 |
-
}
|
81 |
-
}
|
82 |
-
|
83 |
-
//option dependent values. Every non-standard value starts with bs_
|
84 |
-
|
85 |
-
if ($this->checkOption("getPricesInStoreCurrency", $options)) {
|
86 |
-
$result["bs_currency_final_price"] = $store->getBaseCurrency()->convert($product->getFinalPrice(), $store->getCurrentCurrencyCode());
|
87 |
-
$result["bs_currency_special_price"] = $store->getBaseCurrency()->convert($product->getSpecialPrice(), $store->getCurrentCurrencyCode());
|
88 |
-
$result["bs_currency_price"] = $store->getBaseCurrency()->convert($product->getPrice(), $store->getCurrentCurrencyCode());
|
89 |
-
|
90 |
-
$price = $store->getBaseCurrency()->convert($product->getPrice(), $store->getCurrentCurrencyCode());
|
91 |
-
$specialPrice = $store->getBaseCurrency()->convert($product->getSpecialPrice(), $store->getCurrentCurrencyCode());
|
92 |
-
|
93 |
-
$plusTaxPrice = Mage::helper("tax")->getPrice($product, $price, true, null, null, null, $store, false);
|
94 |
-
$minusTaxPrice = Mage::helper("tax")->getPrice($product, $price, false, null, null, null, $store, true);
|
95 |
-
$plusTaxSpecialPrice = Mage::helper("tax")->getPrice($product, $specialPrice, true, null, null, null, $store, false);
|
96 |
-
$minusTaxSpecialPrice = Mage::helper("tax")->getPrice($product, $specialPrice, false, null, null, null, $store, true);
|
97 |
-
|
98 |
-
$result['bs_price_currency_plus_tax'] = $plusTaxPrice;
|
99 |
-
$result['bs_price_currency_minus_tax'] = $minusTaxPrice;
|
100 |
-
$result['bs_special_currency_price_plus_tax'] = $plusTaxSpecialPrice;
|
101 |
-
$result['bs_special_currency_price_minus_tax'] = $minusTaxSpecialPrice;
|
102 |
-
}
|
103 |
-
|
104 |
-
if ($this->checkOption("getAllImages", $options)) {
|
105 |
-
//add images and url info (store dependent)
|
106 |
-
$prodCachedImageUrl = (string)Mage::helper('catalog/image')->init($product, "small_image");
|
107 |
-
$prodImageUrl = $this->_getRealImageUrl($product, $store);
|
108 |
-
$imageControllerUrl = $store->getBaseUrl() . "recsins/index/getRecProdImg?id=" . $product->getId();
|
109 |
-
|
110 |
-
$result['bs_cached_image'] = $prodCachedImageUrl;
|
111 |
-
$result['bs_real_image'] = $prodImageUrl;
|
112 |
-
$result['bs_controller_image'] = $imageControllerUrl;
|
113 |
-
}
|
114 |
-
|
115 |
-
if ($this->checkOption("getMinimalPrices", $options)) {
|
116 |
-
$minPrice = 0;
|
117 |
-
|
118 |
-
if ($product->getTypeId() == "bundle") {
|
119 |
-
list($minPrice, $maxPrice) = $product->getPriceModel()->getPrices($product);
|
120 |
-
if (isset($minPrice)) {
|
121 |
-
$plusTaxPrice = Mage::helper("tax")->getPrice($product, $minPrice, true, null, null, null, $store, false);
|
122 |
-
$minusTaxPrice = Mage::helper("tax")->getPrice($product, $minPrice, false, null, null, null, $store, true);
|
123 |
-
$result['bs_min_price'] = $minPrice;
|
124 |
-
$result['bs_min_price_plus_tax'] = $plusTaxPrice;
|
125 |
-
$result['bs_min_price_minus_tax'] = $minusTaxPrice;
|
126 |
-
} else {
|
127 |
-
$result['bs_min_price'] = 0;
|
128 |
-
$result['bs_min_price_plus_tax'] = 0;
|
129 |
-
$result['bs_min_price_minus_tax'] = 0;
|
130 |
-
}
|
131 |
-
}
|
132 |
-
}
|
133 |
-
|
134 |
-
if ($this->checkOption("getUrl", $options)) {
|
135 |
-
$url = $store->getBaseUrl() . $product->getUrlPath();
|
136 |
-
|
137 |
-
$result['bs_product_url'] = $url;//$product->getProductUrl();
|
138 |
-
}
|
139 |
-
|
140 |
-
if ($this->checkOption("getTags", $options)) {
|
141 |
-
$tags = Mage::getModel("tag/tag")->getResourceCollection()
|
142 |
-
->joinRel()
|
143 |
-
->addProductFilter($productId)
|
144 |
-
->addTagGroup()
|
145 |
-
->load();
|
146 |
-
|
147 |
-
$result['tags'] = array();
|
148 |
-
foreach($tags as $tag) {
|
149 |
-
$result['bs_tags'][] = $tag->getName();
|
150 |
-
}
|
151 |
-
}
|
152 |
-
|
153 |
-
if ($this->checkOption("getManufacter", $options)) {
|
154 |
-
$result['bs_manufacter_name'] = $product->getAttributeText('manufacturer');
|
155 |
-
}
|
156 |
-
|
157 |
-
if ($this->checkOption("getTaxedPrices", $options)) {
|
158 |
-
$price = $minPrice == 0 ? $product->getPrice() : $minPrice;
|
159 |
-
$specialPrice = 0;
|
160 |
-
|
161 |
-
$specialPrice = $product->getSpecialPrice();
|
162 |
-
if (!isset($specialPrice) || $specialPrice == null) {
|
163 |
-
$specialPrice = 0;
|
164 |
-
}
|
165 |
-
|
166 |
-
$store = Mage::app()->getStore($storeId);
|
167 |
-
|
168 |
-
$plusTaxPrice = Mage::helper("tax")->getPrice($product, $price, true, null, null, null, $store, false);
|
169 |
-
$minusTaxPrice = Mage::helper("tax")->getPrice($product, $price, false, null, null, null, $store, true);
|
170 |
-
$plusTaxSpecialPrice = Mage::helper("tax")->getPrice($product, $specialPrice, true, null, null, null, $store, false);
|
171 |
-
$minusTaxSpecialPrice = Mage::helper("tax")->getPrice($product, $specialPrice, false, null, null, null, $store, true);
|
172 |
-
|
173 |
-
$result['bs_price_plus_tax'] = $plusTaxPrice;
|
174 |
-
$result['bs_price_minus_tax'] = $minusTaxPrice;
|
175 |
-
$result['bs_special_price_plus_tax'] = $plusTaxSpecialPrice;
|
176 |
-
$result['bs_special_price_minus_tax'] = $minusTaxSpecialPrice;
|
177 |
-
}
|
178 |
-
|
179 |
-
if ($this->checkOption("getChildrenStock", $options)) {
|
180 |
-
if ($product->getTypeId() == "configurable") {
|
181 |
-
//sometimes "salable" attribute is not good enought to determine wether a configurable product
|
182 |
-
//is out of stock. Just iterate through all the sub-products and check their stock status.
|
183 |
-
$inStock = false;
|
184 |
-
$children = $product->getTypeInstance()->getUsedProducts();
|
185 |
-
foreach($children as $child) {
|
186 |
-
$inStock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($child)->getIs_in_stock() == "1";
|
187 |
-
if ($inStock) {
|
188 |
-
break;
|
189 |
-
}
|
190 |
-
}
|
191 |
-
|
192 |
-
$result['bs_configurable_in_stock'] = $inStock ? "1" : "0";
|
193 |
-
} else {
|
194 |
-
//returns a value, but should not be used as product is not configurable
|
195 |
-
$result['bs_configurable_in_stock'] = "0";
|
196 |
-
}
|
197 |
-
}
|
198 |
-
|
199 |
-
if ($this->checkOption("getStock", $options)) {
|
200 |
-
$result['bs_in_stock'] = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product)->getIs_in_stock() !== '0' ? "1" : "0";
|
201 |
-
}
|
202 |
-
|
203 |
-
if ($this->checkOption("getSalable", $options)) {
|
204 |
-
if (method_exists($product, "isAvailable")) {
|
205 |
-
$result['bs_is_salable'] = $product->isAvailable() ? "1" : "0";
|
206 |
-
} else if (method_exists($product, "isSalable")) {
|
207 |
-
$result['bs_is_salable'] = $product->isSalable() ? "1" : "0";
|
208 |
-
}
|
209 |
-
}
|
210 |
-
|
211 |
-
if ($this->checkOption("getVisibility", $options)) {
|
212 |
-
$visibility = $product->getVisibility();
|
213 |
-
$result["bs_visibility"] = $visibility;
|
214 |
-
}
|
215 |
-
|
216 |
-
return $result;
|
217 |
-
}
|
218 |
-
|
219 |
-
public function bsInfo($productId, $storeId, $options = array(), $filter = array()) {
|
220 |
-
|
221 |
-
$result = $this->info($productId, $storeId, $options, $filter);
|
222 |
-
return $result;
|
223 |
-
}
|
224 |
-
|
225 |
-
public function items($filters = null, $store = null)
|
226 |
-
{
|
227 |
-
$collection = Mage::getModel('catalog/product')->getCollection()
|
228 |
-
->addStoreFilter($this->_getStoreId($store))
|
229 |
-
->addAttributeToSelect('name')->addAttributeToSelect('visibility');
|
230 |
-
|
231 |
-
if (is_array($filters)) {
|
232 |
-
try {
|
233 |
-
foreach ($filters as $field => $value) {
|
234 |
-
if (isset($this->_filtersMap[$field])) {
|
235 |
-
$field = $this->_filtersMap[$field];
|
236 |
-
}
|
237 |
-
|
238 |
-
$collection->addFieldToFilter($field, $value);
|
239 |
-
}
|
240 |
-
} catch (Mage_Core_Exception $e) {
|
241 |
-
$this->_fault('filters_invalid', $e->getMessage());
|
242 |
-
}
|
243 |
-
}
|
244 |
-
|
245 |
-
$result = array();
|
246 |
-
|
247 |
-
foreach ($collection as $product) {
|
248 |
-
// $result[] = $product->getData();
|
249 |
-
$result[] = array( // Basic product data
|
250 |
-
'product_id' => $product->getId(),
|
251 |
-
'sku' => $product->getSku(),
|
252 |
-
'name' => $product->getName(),
|
253 |
-
'set' => $product->getAttributeSetId(),
|
254 |
-
'type' => $product->getTypeId(),
|
255 |
-
'category_ids' => $product->getCategoryIds(),
|
256 |
-
'visibility' => $product->getVisibility()
|
257 |
-
);
|
258 |
-
}
|
259 |
-
return $result;
|
260 |
-
}
|
261 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app/code/community/Brainsins/Recsins/controllers/Adminhtml/RecsinsController.php
CHANGED
@@ -202,6 +202,24 @@ class Brainsins_Recsins_Adminhtml_RecsinsController extends Mage_Adminhtml_Contr
|
|
202 |
Mage::getSingleton("core/session", array("name" => "adminhtml"))->setData('brainsins_BS_SEND_OUT_OF_STOCK_PRODUCTS', "0");
|
203 |
}
|
204 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
205 |
if (array_key_exists("bsimageoptions", $data)) {
|
206 |
$resizeImages = $data['bsimageoptions'];
|
207 |
if (isset($resizeImages)) {
|
@@ -263,22 +281,22 @@ class Brainsins_Recsins_Adminhtml_RecsinsController extends Mage_Adminhtml_Contr
|
|
263 |
}
|
264 |
}
|
265 |
}
|
266 |
-
|
267 |
if (array_key_exists("bs_script", $data)) {
|
268 |
$bsScript = $data['bs_script'];
|
269 |
if (isset($bsScript)) {
|
270 |
Mage::getModel('core/config')->saveConfig('brainsins/BS_SCRIPT_URL', $bsScript);
|
271 |
}
|
272 |
}
|
273 |
-
|
274 |
if (array_key_exists("bs_script_https", $data)) {
|
275 |
$bsScriptHttps = $data['bs_script_https'];
|
276 |
if (isset($bsScriptHttps)) {
|
277 |
Mage::getModel('core/config')->saveConfig('brainsins/BS_SCRIPT_THTTPS_URL', $bsScriptHttps);
|
278 |
}
|
279 |
}
|
280 |
-
|
281 |
-
if (array_key_exists("use_high_detail", $data)) {
|
282 |
$useHighDetailValue = $data['use_high_detail'];
|
283 |
if (isset($useHighDetailValue) && $useHighDetailValue == "checked") {
|
284 |
Mage::getModel('core/config')->saveConfig('brainsins/BS_USE_HIGH_DETAIL', "1");
|
@@ -288,7 +306,7 @@ class Brainsins_Recsins_Adminhtml_RecsinsController extends Mage_Adminhtml_Contr
|
|
288 |
} else {
|
289 |
Mage::getModel('core/config')->saveConfig('brainsins/BS_USE_HIGH_DETAIL', "0");
|
290 |
}
|
291 |
-
|
292 |
if (array_key_exists("use_ajax_requests", $data)) {
|
293 |
$useAjaxRequestsValue = $data['use_ajax_requests'];
|
294 |
if (isset($useAjaxRequestsValue) && $useAjaxRequestsValue == "checked") {
|
202 |
Mage::getSingleton("core/session", array("name" => "adminhtml"))->setData('brainsins_BS_SEND_OUT_OF_STOCK_PRODUCTS', "0");
|
203 |
}
|
204 |
|
205 |
+
$currencies = Mage::app()->getStore()->getAvailableCurrencyCodes(true);
|
206 |
+
foreach($currencies as $currency) {
|
207 |
+
if (array_key_exists($currency.'_symb_text', $data)) {
|
208 |
+
Mage::getModel('core/config')->saveConfig("brainsins/BS_". $currency . "_SYMBOL", $data[$currency.'_symb_text']);
|
209 |
+
}
|
210 |
+
|
211 |
+
if (array_key_exists($currency . "_symb_pos_options", $data)) {
|
212 |
+
Mage::getModel('core/config')->saveConfig("brainsins/BS_". $currency . "_POSITION", $data[$currency.'_symb_pos_options']);
|
213 |
+
}
|
214 |
+
|
215 |
+
if (array_key_exists($currency .'_delim', $data)) {
|
216 |
+
Mage::getModel('core/config')->saveConfig("brainsins/BS_". $currency . "_DELIMITER", $data[$currency .'_delim']);
|
217 |
+
|
218 |
+
}
|
219 |
+
|
220 |
+
}
|
221 |
+
|
222 |
+
|
223 |
if (array_key_exists("bsimageoptions", $data)) {
|
224 |
$resizeImages = $data['bsimageoptions'];
|
225 |
if (isset($resizeImages)) {
|
281 |
}
|
282 |
}
|
283 |
}
|
284 |
+
|
285 |
if (array_key_exists("bs_script", $data)) {
|
286 |
$bsScript = $data['bs_script'];
|
287 |
if (isset($bsScript)) {
|
288 |
Mage::getModel('core/config')->saveConfig('brainsins/BS_SCRIPT_URL', $bsScript);
|
289 |
}
|
290 |
}
|
291 |
+
|
292 |
if (array_key_exists("bs_script_https", $data)) {
|
293 |
$bsScriptHttps = $data['bs_script_https'];
|
294 |
if (isset($bsScriptHttps)) {
|
295 |
Mage::getModel('core/config')->saveConfig('brainsins/BS_SCRIPT_THTTPS_URL', $bsScriptHttps);
|
296 |
}
|
297 |
}
|
298 |
+
|
299 |
+
if (array_key_exists("use_high_detail", $data)) {
|
300 |
$useHighDetailValue = $data['use_high_detail'];
|
301 |
if (isset($useHighDetailValue) && $useHighDetailValue == "checked") {
|
302 |
Mage::getModel('core/config')->saveConfig('brainsins/BS_USE_HIGH_DETAIL', "1");
|
306 |
} else {
|
307 |
Mage::getModel('core/config')->saveConfig('brainsins/BS_USE_HIGH_DETAIL', "0");
|
308 |
}
|
309 |
+
|
310 |
if (array_key_exists("use_ajax_requests", $data)) {
|
311 |
$useAjaxRequestsValue = $data['use_ajax_requests'];
|
312 |
if (isset($useAjaxRequestsValue) && $useAjaxRequestsValue == "checked") {
|
app/code/community/Brainsins/Recsins/etc/config.xml
CHANGED
@@ -26,7 +26,7 @@
|
|
26 |
<config>
|
27 |
<modules>
|
28 |
<Brainsins_Recsins>
|
29 |
-
<version>1.5.
|
30 |
</Brainsins_Recsins>
|
31 |
</modules>
|
32 |
<frontend>
|
26 |
<config>
|
27 |
<modules>
|
28 |
<Brainsins_Recsins>
|
29 |
+
<version>1.5.9</version>
|
30 |
</Brainsins_Recsins>
|
31 |
</modules>
|
32 |
<frontend>
|
app/code/community/Brainsins/Recsins/sql/recsins_setup/mysql4-upgrade-1.5.8-1.5.9.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* BrainSINS' Magento Extension allows to integrate the BrainSINS
|
5 |
+
* personalized product recommendations into a Magento Store.
|
6 |
+
* Copyright (c) 2011 Social Gaming Platform S.R.L.
|
7 |
+
*
|
8 |
+
* This file is part of BrainSINS' Magento Extension.
|
9 |
+
*
|
10 |
+
* BrainSINS' Magento Extension is free software: you can redistribute it
|
11 |
+
* and/or modify it under the terms of the GNU General Public License
|
12 |
+
* as published by the Free Software Foundation, either version 3 of the
|
13 |
+
* License, or (at your option) any later version.
|
14 |
+
*
|
15 |
+
* Foobar is distributed in the hope that it will be useful,
|
16 |
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
+
* GNU General Public License for more details.
|
19 |
+
*
|
20 |
+
* You should have received a copy of the GNU General Public License
|
21 |
+
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
22 |
+
*
|
23 |
+
* Please do not hesitate to contact us at info@brainsins.com
|
24 |
+
*
|
25 |
+
*/
|
26 |
+
$installer = $this;
|
27 |
+
|
28 |
+
$table = $installer->getTable('recsins_recommender');
|
29 |
+
|
30 |
+
$installer->startSetup();
|
31 |
+
|
32 |
+
if (!$installer->tableExists($table)) {
|
33 |
+
$installer->run("
|
34 |
+
CREATE TABLE IF NOT EXISTS {$table} (
|
35 |
+
`id` int(10) unsigned NOT NULL,
|
36 |
+
`name` varchar(255),
|
37 |
+
`page` smallint(8),
|
38 |
+
PRIMARY KEY (`id`)
|
39 |
+
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Brainsins loaded Recommenders';
|
40 |
+
");
|
41 |
+
}
|
42 |
+
|
43 |
+
Mage::getModel('core/config')->saveConfig('brainsins/BS_VERSION', '1.5.9');
|
44 |
+
|
45 |
+
$installer->endSetup();
|
46 |
+
|
47 |
+
Mage::getConfig()->cleanCache();
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Brainsins_Recommender</name>
|
4 |
-
<version>1.5.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.brainsins.es/contrato-de-prestacion-de-servicios-brainsin-para-plugins/">GPL 3.0</license>
|
7 |
<channel>community</channel>
|
@@ -19,12 +19,11 @@ BrainSINS Recommender is offered as a software as a service. It processes the us
|
|
19 |
Increase your cross-sell, up-sell and Average Order Value (AOV) rates. Send personalized emails to your clients to increase the return to your store, and measure and control the effect of all the recommendations in your online store.
|
20 |

|
21 |
Install the plugin in a few minutes and offer more than 100 personalized recommenders in any web page of your online store in less than 24 hours. Choose the plan that better fits to your store at http://www.brainsins.es/tarifas/ and try it for Free 1 month, experimenting the benefits in your own online store without compromise.</description>
|
22 |
-
<notes>
|
23 |
-
Fixed minor bugs</notes>
|
24 |
<authors><author><name>BrainSINS</name><user>acuevas</user><email>alejandro.cuevas@brainsins.com</email></author></authors>
|
25 |
-
<date>2012-09
|
26 |
-
<time>
|
27 |
-
<contents><target name="magecommunity"><dir name="Brainsins"><dir name="Recsins"><dir name="Block"><dir name="Adminhtml"><dir name="Recsins"><dir name="Edit"><file name="Form.php" hash="
|
28 |
<compatible/>
|
29 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
30 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>Brainsins_Recommender</name>
|
4 |
+
<version>1.5.9</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="http://www.brainsins.es/contrato-de-prestacion-de-servicios-brainsin-para-plugins/">GPL 3.0</license>
|
7 |
<channel>community</channel>
|
19 |
Increase your cross-sell, up-sell and Average Order Value (AOV) rates. Send personalized emails to your clients to increase the return to your store, and measure and control the effect of all the recommendations in your online store.
|
20 |

|
21 |
Install the plugin in a few minutes and offer more than 100 personalized recommenders in any web page of your online store in less than 24 hours. Choose the plan that better fits to your store at http://www.brainsins.es/tarifas/ and try it for Free 1 month, experimenting the benefits in your own online store without compromise.</description>
|
22 |
+
<notes>Added personalized display options for currencies</notes>
|
|
|
23 |
<authors><author><name>BrainSINS</name><user>acuevas</user><email>alejandro.cuevas@brainsins.com</email></author></authors>
|
24 |
+
<date>2012-10-09</date>
|
25 |
+
<time>16:47:43</time>
|
26 |
+
<contents><target name="magecommunity"><dir name="Brainsins"><dir name="Recsins"><dir name="Block"><dir name="Adminhtml"><dir name="Recsins"><dir name="Edit"><file name="Form.php" hash="bbe6ae17c6b32bfe8db38af72654711a"/><dir name="Tab"><file name="Form.php" hash="f50e327073f6db6f0b7aaf2e6018834b"/></dir><file name="Tabs.php" hash="da7477ceefd6cc473fb2fb2a307f0282"/></dir><file name="Edit.php" hash="942d16b49fca2566799c7c393ffdd4d2"/><file name="Grid.php" hash="bf34a0c320aeebfe1cc645dc4120b4aa"/><file name=".DS_Store" hash="b3a2141f78050b615c0cea14480334ac"/></dir><file name="Recsins.php" hash="f0bb580c8238818273726847917789f8"/><file name=".DS_Store" hash="8432a930c41259d8cdd9990c2540f153"/></dir><file name="Category.php" hash="fa64d544ad0020dfa651b6c27f95d734"/><file name="Checkout.php" hash="e6e523a465b52ff1d93dea497c15db5e"/><file name="Home.php" hash="26eb9d8e4f796bb0a2ba8ea90691c943"/><file name="Product.php" hash="648d439dc8729a8205449c6887175371"/><file name="Recsins.php" hash="7a9b33c107be967b6dbcd80230b7385f"/><file name=".DS_Store" hash="0047fe0bc161a58c6088a4e959de43a4"/><file name=".LCKRecsins.php~" hash="ed46e9b84acaa2b3b33539877109417b"/></dir><file name="COPYING.txt" hash="4fe869ee987a340198fb0d54c55c47f1"/><dir name="Entity"><file name="Setup.php" hash="02af74b02e083c4552762ecc9987a1a7"/></dir><dir name="Helper"><file name="Data.php" hash="c117b4e42fef671651a78c8f4e01d0e5"/><file name="Recsins.php" hash="435d1402b9b860d906db3a3beb3c93de"/></dir><dir name="Model"><dir name="Api"><file name="Api.php" hash="93dc9bb52ecd977739361410c36f9881"/><file name="ProductsApi.php" hash="0af71e0b0a1f3b1884428a5e43dea402"/></dir><file name="Cart.php" hash="d19925676d18f200f25b1c995f035300"/><file name="CartProduct.php" hash="fffddbe0a759335f89bbdbcec7b4d2eb"/><file name="Client.php" hash="54ab4289c332f4414761ba4256dc205e"/><dir name="Mysql4"><dir name="Recsins"><file name="Collection.php" hash="8c69337dee2f64516174e59805c6ec83"/></dir><file name="Recsins.php" hash="57256b85a9e1279e0875ea50cf8325d4"/></dir><file name="NewFile.xml" hash="93286b7fccf6f6092628ada8b85c0727"/><file name="Observer.php" hash="6c0ff3f353947cda424057117c5ba530"/><file name="Order.php" hash="b8dcb3adfe676725fe4f09acff84cd97"/><file name="OrderProduct.php" hash="1d33e879db0bb8557704ed3b66fb584d"/><file name="Product.php" hash="222db5151109eb9e6741cc1fe0d1ba7f"/><file name="Recommender.php" hash="12532b4efd6fdec560522a2ecf029ed9"/><file name="Recsins.php" hash="1a4d3ff6a94336a08a709f925cf0579c"/><dir name="Resource"><dir name="Eav"><dir name="Mysql4"><dir name="Recommender"><file name="Collection.php" hash="6c36324bb84cba28f6a5bdb7eb0c2bce"/></dir><file name="Recommender.php" hash="f6857e56874c6480447b5c411aa7a066"/></dir></dir><file name="Setup.php" hash="02af74b02e083c4552762ecc9987a1a7"/></dir><file name="Status.php" hash="e3f1a39141d7a4aaa99252937f60ca8d"/><file name="User.php" hash="3244421d7331e5167e910f6fc3827361"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="RecsinsController.php" hash="8c39d102612421ca0d7e584d00b7ef4f"/></dir><file name="IndexController.php" hash="f111c628424a8e5fb0b8b883b9fc72c5"/><file name=".DS_Store" hash="0047fe0bc161a58c6088a4e959de43a4"/></dir><dir name="etc"><file name="api.xml" hash="c82c8df487ba808a8851ea9f1a8fe197"/><file name="config.xml" hash="ff6bede9026412be6aa49afc5360c8e3"/><file name="widget.xml" hash="c4f1829fa161f1119d817b64878f3b2f"/></dir><dir name="sql"><dir name="recsins_setup"><file name="mysql4-install-1.4.0.php" hash="33ae9091e3066779c13e738beae3650c"/><file name="mysql4-upgrade-1.4.0-1.4.1.php" hash="b636f16be2575bff013c14c012b34625"/><file name="mysql4-upgrade-1.4.1-1.4.2.php" hash="e73c5189c851c1ddb94d8ce8acd6f1a6"/><file name="mysql4-upgrade-1.4.2-1.4.3.php" hash="2297a4e5670b28a24c1fcd3d5d47aca6"/><file name="mysql4-upgrade-1.4.3-1.4.4.php" hash="6c76f6d7ffe9da72ebabd44779d13bde"/><file name="mysql4-upgrade-1.4.4-1.4.5.php" hash="1b932c2afb4543c6e067a7b769d48eb8"/><file name="mysql4-upgrade-1.4.5-1.4.6.php" hash="a851ccc0fa73440b74828c0b2ee993d9"/><file name="mysql4-upgrade-1.4.6-1.4.7.php" hash="923d491257ad9836738c1586d494e12c"/><file name="mysql4-upgrade-1.4.7-1.4.8.php" hash="a2c96553909227f5f5bd7a685691c0ac"/><file name="mysql4-upgrade-1.4.8-1.4.9.php" hash="86b6da79f302790ecb6a072c4ef68fb0"/><file name="mysql4-upgrade-1.4.9-1.5.0.php" hash="b10dd9d0dc951f3b783da743558af5ca"/><file name="mysql4-upgrade-1.5.0-1.5.1.php" hash="7f86ed73d2d35dd2989528046772fa8b"/><file name="mysql4-upgrade-1.5.1-1.5.2.php" hash="da8251355aa4811a099e5b22c9debca3"/><file name="mysql4-upgrade-1.5.2-1.5.3.php" hash="5ad2385bec084bc29a0673ed2a97231c"/><file name="mysql4-upgrade-1.5.3-1.5.4.php" hash="bda831da9d0a842c16092e1900d17087"/><file name="mysql4-upgrade-1.5.4-1.5.5.php" hash="b04a5a6ea7a5ec0df04a42953bb97729"/><file name="mysql4-upgrade-1.5.5-1.5.6.php" hash="cd94c569ee573f51e3e6062cfa25cb7e"/><file name="mysql4-upgrade-1.5.6-1.5.7.php" hash="f724855eebffa49ad0cad4d0205542a7"/><file name="mysql4-upgrade-1.5.7-1.5.8.php" hash="86df5a8f3c858d4c1b29f67e28e9c2fc"/><file name="mysql4-upgrade-1.5.8-1.5.9.php" hash="823f2a9313beb4255ff6892ec8ab48c5"/></dir></dir><file name=".DS_Store" hash="ec572d2af92dd05fb67f970d531163cd"/></dir><file name=".DS_Store" hash="8432a930c41259d8cdd9990c2540f153"/></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="recsins.xml" hash="c2608f0c7f9f6efcbeb74bd5b1427206"/></dir></dir></dir></dir><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="recsins"><file name="cart.phtml" hash="04ee1833a0177a83644e4d1f3211c789"/><file name="category.phtml" hash="1979377cb8f06740a6b44a922e46dacd"/><file name="product.phtml" hash="3a623d6b48cceae14912b4daf5113ca2"/><file name="recsins.phtml" hash="d41d8cd98f00b204e9800998ecf8427e"/><file name=".DS_Store" hash="f0948e76df06a209a9b7f51ff398fd60"/></dir></dir><dir name="layout"><file name="recsins.xml" hash="9185dc1897ec93c400edd2cd95b6533d"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Brainsins_Recsins.xml" hash="54e1c94137477548911c4ebce7eb97fe"/></dir></target><target name="magelocale"><dir name="es_ES"><file name="Brainsins_Recsins.csv" hash="7f731ae9e9faa8b003a63722ef3ce18a"/></dir><dir name="en_US"><file name="Brainsins_Recsins.csv" hash="6381582be5edc31cba54a052bb48b86d"/></dir></target></contents>
|
27 |
<compatible/>
|
28 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
29 |
</package>
|