Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Magmodules committed Dec 6, 2017
2 parents 1b667ec + 84e437e commit 66ed095
Show file tree
Hide file tree
Showing 25 changed files with 880 additions and 435 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class Magmodules_Sooqr_Block_Adminhtml_Config_Form_Field_Extra
extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
{

/**
* @var array
*/
protected $_renders = array();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class Magmodules_Sooqr_Block_Adminhtml_Config_Form_Field_Filter
extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
{

/**
* @var array
*/
protected $_renders = array();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,87 +32,42 @@ public function render(Varien_Data_Form_Element_Abstract $element)
$helper = Mage::helper('sooqr');
$storeIds = $helper->getStoreIds('sooqr_connect/generate/enabled');
$htmlFeedlinks = '';

foreach ($storeIds as $storeId) {
$generateUrl = $this->getUrl('*/sooqr/generateFeed/store_id/' . $storeId);
$generateUrl = $this->getUrl('*/sooqr/generateManual/store_id/' . $storeId);
$previewUrl = $this->getUrl('*/sooqr/preview/store_id/' . $storeId);
$downloadUrl = $this->getUrl('*/sooqr/download/store_id/' . $storeId);
$disableUrl = $this->getUrl('*/sooqr/disableFeed/store_id/' . $storeId);
$feedText = $helper->getUncachedConfigValue('sooqr_connect/generate/feed_result', $storeId);

if (empty($feedText)) {
$feedText = $helper->__('No active feed found');
$feedText = Mage::helper('sooqr')->__('No active feed found');
$downloadUrl = '';
}

$storeTitle = Mage::app()->getStore($storeId)->getName();
$storeCode = Mage::app()->getStore($storeId)->getCode();
$htmlFeedlinks .= '<tr>
<td>
' . $helper->__('✓ Enabled') . '
</td>
<td valign="top">
' . Mage::app()->getStore($storeId)->getName() . '<br/>
<small>Code: ' . Mage::app()->getStore($storeId)->getCode() . '</small>
</td>
<td>
' . $feedText . '
</td>
<td style="line-height: 25px;">
<a style="text-decoration: none;padding-left: 4px;" href="' . $generateUrl . '">
' . $helper->__('↺ Generate') . '
</a>
<br/>
<a style="text-decoration: none;padding-left: 3px;" href="' . $downloadUrl . '">
' . $helper->__('➞ Download') . '
</a>
<br/>
<a style="text-decoration: none; padding: 5px;" href="' . $disableUrl . '">
' . $helper->__('✕ Disable') . '</a>
</td>
</tr>';
}

$storeIds = $helper->getDisabledStoreIds('sooqr_connect/generate/enabled');

foreach ($storeIds as $storeId) {
$enableUrl = $this->getUrl('*/sooqr/enableFeed/store_id/' . $storeId);
$feedText = $helper->__('No active feed found');
$htmlFeedlinks .= '<tr>
<td>
' . $helper->__('✕ Disabled') . '
</td>
<td valign="top">
' . Mage::app()->getStore($storeId)->getName() . '
<br/>
<small>Code: ' . Mage::app()->getStore($storeId)->getCode() . '</small>
</td>
<td>
' . $feedText . '
</td>
<td>
<a style="text-decoration: none;padding-left: 5px;" href="' . $enableUrl . '">
' . $helper->__('✓ Enable') . '
</a>
</td>
<td valign="top">' . $storeTitle . '<br/><small>Code: ' . $storeCode . '</small></td>
<td>' . $feedText . '</td>
<td>
» <a href="' . $generateUrl . '">' . Mage::helper('sooqr')->__('Generate New') . '</a><br/>
» <a href="' . $previewUrl . '">' . Mage::helper('sooqr')->__('Preview 100') . '</a><br/>
» <a href="' . $downloadUrl . '">' . Mage::helper('sooqr')->__('Download Last') . '</a>
</td>
</tr>';
}

if (empty($htmlFeedlinks)) {
$htmlFeedlinks = $helper->__('No enabled feed(s) found');
$htmlFeedlinks = Mage::helper('sooqr')->__('No enabled feed(s) found');
} else {
$htmlHeader = '<div class="grid">
<table cellpadding="0" cellspacing="0" class="border" style="width: 100%">
<tbody>
<tr class="headings">
<th>' . $helper->__('Status') . '</th>
<th>' . $helper->__('Storeview') . '</th>
<th>' . $helper->__('Feed') . '</th>
<th>' . $helper->__('Action') . '</th>
</tr>';
<tr class="headings"><th>Store</th><th>Feed</th><th>Generate</th></tr>';
$htmlFooter = '</tbody></table></div>';
$htmlFeedlinks = $htmlHeader . $htmlFeedlinks . $htmlFooter;
}

return sprintf(
'<tr id="row_%s"><td colspan="7" class="label" style="margin-bottom: 10px;">%s</td></tr>',
'<tr id="row_%s"><td colspan="6" class="label" style="margin-bottom: 10px;">%s</td></tr>',
$element->getHtmlId(),
$htmlFeedlinks
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php
/**
* Magmodules.eu - http://www.magmodules.eu
* Magmodules.eu - http://www.magmodules.eu.
*
* NOTICE OF LICENSE
* This source file is subject to the Open Software License (OSL 3.0)
* This source file is subject to the EULA
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* https://www.magmodules.eu/MM-LICENSE.txt
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
Expand All @@ -15,25 +15,35 @@
* @package Magmodules_Sooqr
* @author Magmodules <[email protected]>
* @copyright Copyright (c) 2017 (http://www.magmodules.eu)
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* @license https://www.magmodules.eu/terms.html Single Service License
*/

class Magmodules_Sooqr_Block_Adminhtml_System_Config_Form_Field_Heading
extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
{


/**
* @param Varien_Data_Form_Element_Abstract $element
*
* @return string
*/
public function render(Varien_Data_Form_Element_Abstract $element)
{
$useContainerId = $element->getData('use_container_id');
return sprintf(
'<tr class="system-fieldset-sub-head" id="row_%s"><td colspan="5"><h4>%s</h4></td></tr>',
$element->getHtmlId(), $element->getLabel()
$html = sprintf(
'
<tr id="row_%s">
<td colspan="5">
<h4 id="%s" style="border-bottom: 1px solid #dddddd;padding: 20px 5px 5px 5px;">%s</h4>
<div class="comment">
<span>%s</span>
</div>
</td>
</tr>',
$element->getHtmlId(), $element->getHtmlId(), $element->getLabel(), $element->getComment()
);

return $html;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class Magmodules_Sooqr_Block_Adminhtml_System_Config_Form_Field_Note
*/
public function render(Varien_Data_Form_Element_Abstract $element)
{
$useContainerId = $element->getData('use_container_id');
return sprintf(
'<tr id="row_%s"><td colspan="5" class="label" style="margin-bottom: 10px;">%s</td></tr>',
$element->getHtmlId(), $element->getLabel()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,29 +79,48 @@ public function render(Varien_Data_Form_Element_Abstract $element)

$flatProduct = Mage::getStoreConfig('catalog/frontend/flat_catalog_product');
$flatCategory = Mage::getStoreConfig('catalog/frontend/flat_catalog_category');
if ((!$flatProduct) || (!$flatCategory)) {
$msg = '<div id="messages"><ul class="messages"><li class="error-msg"><ul><li><span>' . Mage::helper('sooqr')->__('Please enable "Flat Catalog Category" and "Flat Catalog Product" for the extension to work properly. <a href="https://www.magmodules.eu/help/enable-flat-catalog/" target="_blank">More information.</a>') . '</span></li></ul></li></ul></div>';
$bypassFlat = Mage::getStoreConfig('sooqr_connect/generate/bypass_flat');

if ((!$flatProduct || !$flatCategory) && !$bypassFlat) {
$msg = '<div id="messages">
<ul class="messages">
<li class="notice-msg">
<ul>
<li>
<span>
' . Mage::helper('sooqr')->__('Note: We recommend to enable the "Flat Catalog Category" and "Flat Catalog Product" to reduce the server load for the feed generation. <a href="https://www.magmodules.eu/help/sooqr/enable-flat-catalog" target="_blank">More information.</a>') . '
</span>
</li>
</ul>
</li>
</ul>
</div>';
$html = $html . $msg;
}

if (Mage::getStoreConfig('catalog/frontend/flat_catalog_product')) {
if (!$bypassFlat && Mage::getStoreConfig('catalog/frontend/flat_catalog_product')) {
$storeId = Mage::helper('sooqr')->getStoreIdConfig();
$nonFlatAttributes = Mage::helper('sooqr')->checkFlatCatalog(
Mage::getModel("sooqr/sooqr")->getFeedAttributes(
$storeId,
'flatcheck'
)
);
$atts = Mage::getModel("sooqr/sooqr")->getFeedAttributes('', $storeId, 'flatcheck');
$nonFlatAttributes = Mage::helper('sooqr')->checkFlatCatalog($atts);
if (count($nonFlatAttributes) > 0) {
$html .= '<div id="messages"><ul class="messages"><li class="error-msg"><ul><li><span>';

$msg = 'Note: The following used attribute(s) were not found in the flat catalog: %s. ';
$msg .= 'This can result in a higher resource usage which can slow down the feed generation. ';
$msg .= 'Click <a target="_blank" href="%s">here</a> to add these to the flat catalog. ';
$msg .= 'Or click <a target="_blank" href="%s">here</a> to bypass Flat Catalog.';
$msg .= '<span style="float:right"><a target="_blank" href="%s">[Read More]</a></span>';

$html .= '<div id="messages"><ul class="messages"><li class="notice-msg"><ul><li><span>';
$html .= $this->__(
'Warning: The following used attribute(s) were not found in the flat catalog: %s. This can result in empty data or higher resource usage. Click <a href="%s">here</a> to add these to the flat catalog. ',
implode($nonFlatAttributes, ', '), $this->getUrl('*/sooqr/addToFlat')
$msg,
implode($nonFlatAttributes, ', '),
$this->getUrl('*/sooqr/addToFlat'),
$this->getUrl('*/sooqr/bypassFlat'),
'https://www.magmodules.eu/help/sooqr/enable-flat-catalog'
);
$html .= '</span></ul></li></ul></div>';
}
}

return $html;
}

Expand Down
31 changes: 29 additions & 2 deletions app/code/community/Magmodules/Sooqr/Block/Search.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
class Magmodules_Sooqr_Block_Search extends Mage_Core_Block_Template
{

const SEARCH_FIELD_ID = 'search';

/**
*
*/
Expand Down Expand Up @@ -52,12 +54,37 @@ public function isEnabled()
}

/**
* @return bool
*/
public function multiSearch()
{
$multi = Mage::getStoreConfig('sooqr_connect/general/extra_search', 0);
if (!empty($multi)) {
return true;
}

return false;
}

/**
* @param string $type
*
* @return array
*/
public function getSooqrOptions()
public function getSooqrOptions($type = '')
{
$options = array();
$accountId = Mage::getStoreConfig('sooqr_connect/general/account_id');
$options = array('account' => $accountId, 'fieldId' => 'search');

if ($type == 'second') {
$options['fieldId'] = Mage::getStoreConfig('sooqr_connect/general/extra_search');
$options['namespace'] = 'suggest2';
$options['account'] = substr($accountId, 0, -1) . '2';
} else {
$options['account'] = $accountId;
$options['fieldId'] = self::SEARCH_FIELD_ID;
}

$parent = Mage::getStoreConfig('sooqr_connect/general/parent');
if (!empty($parent)) {
$options['containerParent'] = $parent;
Expand Down
Loading

0 comments on commit 66ed095

Please sign in to comment.