Skip to content
This repository was archived by the owner on Mar 9, 2023. It is now read-only.

Commit

Permalink
Merge pull request #197 from Flagbit/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
xpoback authored Mar 14, 2017
2 parents 99099d3 + f168801 commit 25e5376
Show file tree
Hide file tree
Showing 109 changed files with 1,626 additions and 856 deletions.
Binary file modified documentation/images/config-access.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified documentation/images/config-details.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified documentation/images/config-export.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified documentation/images/config-modules.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified documentation/images/config-overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions modman
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ src/app/locale/en_US/* app/locale/en_US
src/app/locale/de_DE/* app/locale/de_DE
src/app/design/frontend/base/default/layout/* app/design/frontend/base/default/layout
src/app/design/frontend/base/default/template/* app/design/frontend/base/default/template
src/app/design/adminhtml/default/default/template/* app/design/adminhtml/default/default/template
src/app/etc/factfinder.xml app/etc/factfinder.xml
src/lib/* lib
src/shell/* shell
Expand Down
2 changes: 1 addition & 1 deletion package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<description>Integrates the FACT-Finder for improved product search functionality.</description>
<license>The MIT License (MIT)</license>
<license_uri>https://opensource.org/licenses/MIT</license_uri>
<version>4.1.11</version>
<version>4.1.13</version>
<stability>stable</stability>
<notes>Completely refactored and now supporting FF v6.9-7.2</notes>
<authors>
Expand Down
26 changes: 25 additions & 1 deletion src/app/code/community/FACTFinder/Asn/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function getQueryParams($url)

$parseUrl = parse_url($url);
if (isset($parseUrl['query'])) {
parse_str($parseUrl['query'], $queryParams);
$queryParams = $this->parseStr($parseUrl['query']);
}

// recover spaces
Expand Down Expand Up @@ -94,4 +94,28 @@ public function removeCategoryParams($url)
}


/**
* Does practically the same as parse_str
* but does NOT underscore parameter names
*
* @param string $string
*
* @return array
*
*/
public function parseStr($string)
{
$result = array();
$query = trim($string, '?&');
$query = explode('&', $query);

foreach ($query as $item) {
$item = explode('=', $item);
$result[urldecode(array_shift($item))] = urldecode(array_shift($item));
}

return $result;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,11 @@ public function getAfterSearchNavigation()
* Get Attribute Options Array from FactFinder FilterGroupItems
*
* @param FACTFinder\Data\FilterGroup $filterGroup
* @param string $unit
*
* @return array
*/
protected function _getAttributeOptions(FACTFinder\Data\FilterGroup $filterGroup)
protected function _getAttributeOptions(FACTFinder\Data\FilterGroup $filterGroup, $unit = '')
{
$attributeOptions = array();

Expand All @@ -98,7 +99,7 @@ protected function _getAttributeOptions(FACTFinder\Data\FilterGroup $filterGroup
}

if ($filterGroup->isSliderStyle()) {
$queryParams['filter' . $option->getFieldName()] = $filterValue;
$queryParams[urldecode('filter' . $option->getFieldName())] = $filterValue;
$attributeOptions[] = $this->_prepareSliderOption($option, $filterGroup, $queryParams);
} else {
if (!$option->getLabel() || $this->_isTopLevelNavigation($option, $currentCategoryPath)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ class FACTFinder_Campaigns_Block_Feedback_Product extends FACTFinder_Campaigns_B
protected $_handlerModel = 'factfinder_campaigns/handler_product';


/**
* @return Mage_Core_Model_Abstract
*/
protected function _getHandler()
{
$product = Mage::registry('current_product');
if ($product) {
$productId = $product->getData(Mage::helper('factfinder_campaigns')->getIdFieldName());
return Mage::getSingleton($this->_handlerModel, array($productId));
}

return parent::_getHandler();
}


/**
* Check is the campign can be shown on product page
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,21 @@ class FACTFinder_Campaigns_Block_Pushed_Product extends FACTFinder_Campaigns_Blo
protected $_handlerModel = 'factfinder_campaigns/handler_product';


/**
* @return Mage_Core_Model_Abstract
*/
protected function _getHandler()
{
$product = Mage::registry('current_product');
if ($product) {
$productId = $product->getData(Mage::helper('factfinder_campaigns')->getIdFieldName());
return Mage::getSingleton($this->_handlerModel, array($productId));
}

return parent::_getHandler();
}


/**
* Check is the campign can be shown on product page
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function handleCampaignsRedirect($observer)
if (Mage::registry('current_product')) {
$product = Mage::registry('current_product');
$ids = array($product->getData(Mage::helper('factfinder_campaigns')->getIdFieldName()));
$handler = Mage::getModel('factfinder_campaigns/handler_product', $ids);
$handler = Mage::getSingleton('factfinder_campaigns/handler_product', $ids);
} elseif (Mage::helper('factfinder/search')->getIsOnSearchPage()) {
$handler = Mage::getSingleton('factfinder_campaigns/handler_search');
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @category Mage
* @package FACTFinder_Core
* @author Flagbit Magento Team <magento@flagbit.de>
* @copyright Copyright (c) 2016 Flagbit GmbH & Co. KG
* @copyright Copyright (c) 2017 Flagbit GmbH & Co. KG
* @license https://opensource.org/licenses/MIT The MIT License (MIT)
* @link http://www.flagbit.de
*
Expand All @@ -17,7 +17,7 @@
* @category Mage
* @package FACTFinder_Core
* @author Flagbit Magento Team <magento@flagbit.de>
* @copyright Copyright (c) 2016 Flagbit GmbH & Co. KG (http://www.flagbit.de)
* @copyright Copyright (c) 2017 Flagbit GmbH & Co. KG (http://www.flagbit.de)
* @license https://opensource.org/licenses/MIT The MIT License (MIT)
* @link http://www.flagbit.de
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @category Mage
* @package FACTFinder_Core
* @author Flagbit Magento Team <magento@flagbit.de>
* @copyright Copyright (c) 2016 Flagbit GmbH & Co. KG
* @copyright Copyright (c) 2017 Flagbit GmbH & Co. KG
* @license https://opensource.org/licenses/MIT The MIT License (MIT)
* @link http://www.flagbit.de
*
Expand All @@ -17,37 +17,28 @@
* @category Mage
* @package FACTFinder_Core
* @author Flagbit Magento Team <magento@flagbit.de>
* @copyright Copyright (c) 2016 Flagbit GmbH & Co. KG (http://www.flagbit.de)
* @copyright Copyright (c) 2017 Flagbit GmbH & Co. KG (http://www.flagbit.de)
* @license https://opensource.org/licenses/MIT The MIT License (MIT)
* @link http://www.flagbit.de
*/
class FACTFinder_Core_Block_Adminhtml_Form_Field_Attributes
extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
{
const RENDERER_ATTRIBUTE = 'factfinder/adminhtml_form_field_column_attribute';
const RENDERER_TYPE = 'factfinder/adminhtml_form_field_column_type';
const RENDERER_UNIT = 'factfinder/adminhtml_form_field_column_unit';

/**
* @var FACTFinder_Core_Block_Adminhtml_Form_Field_Attribute
*/
protected $_attributeRenderer;
protected $_columnRenderers = array();

protected $_template = 'factfinder/core/system/config/form/field/attributes.phtml';

/**
* Retrieve group column renderer
*
* @return FACTFinder_Core_Block_Adminhtml_Form_Field_Attribute
*/
protected function _getAttributeRenderer()

public function __construct()
{
if (!$this->_attributeRenderer) {
$this->_attributeRenderer = $this->getLayout()->createBlock(
'factfinder/adminhtml_form_field_attribute', '',
array('is_render_to_js_template' => true)
);
$this->_attributeRenderer->setClass('attribute_select');
$this->_attributeRenderer->setExtraParams('style="width:200px"');
if (!$this->_addButtonLabel) {
$this->_addButtonLabel = Mage::helper('adminhtml')->__('Add');
}

return $this->_attributeRenderer;
parent::__construct();
}


Expand All @@ -60,7 +51,17 @@ protected function _prepareToRender()
{
$this->addColumn('attribute', array(
'label' => Mage::helper('factfinder')->__('Attribute'),
'renderer' => $this->_getAttributeRenderer(),
'renderer' => $this->_getRenderer(self::RENDERER_ATTRIBUTE),
));

$this->addColumn('type', array(
'label' => Mage::helper('factfinder')->__('Data Type'),
'renderer' => $this->_getRenderer(self::RENDERER_TYPE),
));

$this->addColumn('unit', array(
'label' => Mage::helper('factfinder')->__('Unit'),
'renderer' => $this->_getRenderer(self::RENDERER_UNIT),
));

$this->_addAfter = false;
Expand All @@ -78,9 +79,48 @@ protected function _prepareToRender()
protected function _prepareArrayRow(Varien_Object $row)
{
$row->setData(
'option_extra_attr_' . $this->_getAttributeRenderer()->calcOptionHash($row->getData('attribute')),
'option_extra_attr_' . $this->_getRenderer(self::RENDERER_TYPE)
->calcOptionHash($row->getData('type')),
'selected="selected"'
);
$row->setData(
'option_extra_attr_' . $this->_getRenderer(self::RENDERER_ATTRIBUTE)
->calcOptionHash($row->getData('attribute')),
'selected="selected"'
);
}


/**
* @param $blockType
* @param array $data
*
* @return Mage_Core_Block_Abstract
*/
protected function _getRenderer($blockType, $data = array())
{
if (!isset($this->_columnRenderers[$blockType])) {
$renderer = $this->getLayout()->createBlock(
$blockType, '',
array('is_render_to_js_template' => true)
);

foreach ($data as $key => $value) {
$renderer->setData($key, $value);
}

$this->_columnRenderers[$blockType] = $renderer;
}

return $this->_columnRenderers[$blockType];
}


protected function _toHtml()
{
$html = parent::_toHtml();

return $this->_afterToHtml($html);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* @category Mage
* @package FACTFinder_Core
* @author Flagbit Magento Team <magento@flagbit.de>
* @copyright Copyright (c) 2016 Flagbit GmbH & Co. KG
* @copyright Copyright (c) 2017 Flagbit GmbH & Co. KG
* @license https://opensource.org/licenses/MIT The MIT License (MIT)
* @link http://www.flagbit.de
*
Expand All @@ -17,13 +17,27 @@
* @category Mage
* @package FACTFinder_Core
* @author Flagbit Magento Team <magento@flagbit.de>
* @copyright Copyright (c) 2016 Flagbit GmbH & Co. KG (http://www.flagbit.de)
* @copyright Copyright (c) 2017 Flagbit GmbH & Co. KG (http://www.flagbit.de)
* @license https://opensource.org/licenses/MIT The MIT License (MIT)
* @link http://www.flagbit.de
*/
class FACTFinder_Core_Block_Adminhtml_Form_Field_Attribute extends Mage_Core_Block_Html_Select
class FACTFinder_Core_Block_Adminhtml_Form_Field_Column_Attribute extends Mage_Core_Block_Html_Select
{

/**
* Set initial options
*/
protected function _construct()
{
parent::_construct();

$this->setId('attibute_select')
->setTitle('attribute')
->setClass('attribute_select')
;
}


/**
* Attributes cache
*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php
/**
* FACTFinder_Core
*
* @category Mage
* @package FACTFinder_Core
* @author Flagbit Magento Team <magento@flagbit.de>
* @copyright Copyright (c) 2017 Flagbit GmbH & Co. KG
* @license https://opensource.org/licenses/MIT The MIT License (MIT)
* @link http://www.flagbit.de
*
*/

/**
* Class FACTFinder_Core_Block_Adminhtml_Form_Field_Attribute
*
* @category Mage
* @package FACTFinder_Core
* @author Flagbit Magento Team <magento@flagbit.de>
* @copyright Copyright (c) 2017 Flagbit GmbH & Co. KG (http://www.flagbit.de)
* @license https://opensource.org/licenses/MIT The MIT License (MIT)
* @link http://www.flagbit.de
*/
class FACTFinder_Core_Block_Adminhtml_Form_Field_Column_Type extends Mage_Core_Block_Html_Select
{

/**
* Set initial options
*/
protected function _construct()
{
parent::_construct();

$this->setId('type_select')
->setTitle('type')
->setClass('type_select')
;
}


/**
* Set name of the html input
*
* @param string $value
*
* @return mixed
*/
public function setInputName($value)
{
return $this->setName($value);
}


/**
* Render block HTML
*
* @return string
*/
public function _toHtml()
{
if (!$this->getOptions()) {
foreach (array('text' => 'Text', 'number' => 'Number') as $id => $label) {
$htmlLabel = htmlspecialchars($label, ENT_QUOTES);
$this->addOption($id, $htmlLabel);
}
}

return parent::_toHtml();
}


}
Loading

0 comments on commit 25e5376

Please sign in to comment.