Skip to content

Commit

Permalink
Merge pull request #17 from magmodules/1.6.6
Browse files Browse the repository at this point in the history
1.6.6
  • Loading branch information
Marvin-Magmodules authored Jun 22, 2018
2 parents 007f620 + 8c72df7 commit c96fa98
Show file tree
Hide file tree
Showing 8 changed files with 66 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,40 @@ public function getAjaxCheckUrl()
return $this->helper->getUrl('adminhtml/selftest/run');
}

/**
* @return string
*/
public function getFlatcheck()
{
/** @var Magmodules_Channable_Model_Channable $model */
$model = Mage::getModel("channable/channable");

/** @var Magmodules_Channable_Helper_Data $helper */
$helper = Mage::helper("channable");

try {
$flatProduct = Mage::getStoreConfig('catalog/frontend/flat_catalog_product');
$bypassFlat = Mage::getStoreConfig('channable_connect/generate/bypass_flat');

if ($flatProduct && !$bypassFlat) {
$storeId = $helper->getStoreIdConfig();
$nonFlatAttributes = $helper->checkFlatCatalog($model->getFeedAttributes($storeId, 'flatcheck'));
if (!empty($nonFlatAttributes)) {
return sprintf(
'<span class="channable-flat" %s>%s</span>',
'onclick="javascript:testModule(); return false;"',
$helper->__('Possible data issue(s) found!')
);
}
}
} catch (\Exception $e) {
$helper->addToLog('checkFlat', $e->getMessage());
}

return null;
}


/**
* Generate button html
*
Expand Down
10 changes: 6 additions & 4 deletions app/code/community/Magmodules/Channable/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -871,11 +871,13 @@ public function getProductData($product, $data, $config = array())
$value = '';
switch ($type) {
case 'price':
if (!empty($product[$source])) {
$value = number_format($product[$source], 2, '.', '');
if (!empty($config['currency'])) {
$value .= ' ' . $config['currency'];
if (isset($product[$source])) {
if ($source == 'msrp') {
$price = $this->processPrice($product, $product[$source], $config);
} else {
$price = $product[$source];
}
$value = $this->formatPrice($price, $config);
}
break;
case 'select':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ public function getFeedConfig($storeId, $type = 'xml')
$config['force_tax'] = $this->helper->getConfigData('data/force_tax', $storeId);
$config['currency'] = $store->getDefaultCurrencyCode();
$config['base_currency_code'] = $store->getBaseCurrencyCode();
$config['use_currency'] = true;
$config['markup'] = $this->helper->getPriceMarkup($config);
$config['use_tax'] = $this->helper->getTaxUsage($config);
$config['skip_validation'] = false;
Expand Down
10 changes: 7 additions & 3 deletions app/code/community/Magmodules/Channable/Model/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ public function getDefaultAttributes()
* @param $type
*
* @return Mage_Catalog_Model_Resource_Product_Collection
* @throws Mage_Core_Exception
*/
public function addFilters($filters, $collection, $type = 'simple')
{
Expand Down Expand Up @@ -229,12 +230,15 @@ public function addFilters($filters, $collection, $type = 'simple')
continue;
}

$attributeModel = Mage::getSingleton('eav/config')
->getAttribute(Mage_Catalog_Model_Product::ENTITY, $attribute);
if (!$frontendInput = $attributeModel->getAttributeCode()) {
$productEntity = Mage_Catalog_Model_Product::ENTITY;
/** @var Mage_Eav_Model_Config $eavConfig */
$eavConfig = Mage::getSingleton('eav/config');
$attributeModel = $eavConfig->getAttribute($productEntity, $attribute);
if (!$attributeModel->getAttributeCode()) {
continue;
}

$frontendInput = $attributeModel->getFrontendInput();
if ($frontendInput == 'select' || $frontendInput == 'multiselect') {
$options = $attributeModel->getSource()->getAllOptions();
if (strpos($value, ',') !== false) {
Expand Down
2 changes: 1 addition & 1 deletion app/code/community/Magmodules/Channable/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<config>
<modules>
<Magmodules_Channable>
<version>1.6.5</version>
<version>1.6.6</version>
</Magmodules_Channable>
</modules>
<global>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@

//]]>
</script>
<?php echo $this->getButtonHtml() ?><a name="selftest"></a>
<?php echo $this->getButtonHtml() ?><a name="selftest"></a>
<?php echo $this->getFlatcheck() ?>
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "magmodules/magento1-channable",
"type": "magento-module",
"description": "Magento 1 Channable integration",
"version": "v1.6.5",
"version": "v1.6.6",
"keywords": [
"magento"
],
Expand Down
15 changes: 14 additions & 1 deletion skin/adminhtml/default/default/magmodules/channable/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,17 @@
.channable-notice .more {
float: right;
margin-right: 10px;
}
}

.channable-flat {
margin-left: 40px;
font-size: 13px;
font-style: normal;
font-weight: 200;
border: 1px solid #A6986B;
padding: 5px 10px 5px 10px;
color: #EF773B;
background: #FEFAB1;
text-decoration: underline;
cursor: pointer;
}

0 comments on commit c96fa98

Please sign in to comment.