Skip to content

Commit

Permalink
Merge pull request #16 from magmodules/1.6.5
Browse files Browse the repository at this point in the history
1.6.5 combined update
  • Loading branch information
Marvin-Magmodules authored Jun 1, 2018
2 parents c1c13c6 + 0c61b89 commit 007f620
Show file tree
Hide file tree
Showing 17 changed files with 614 additions and 333 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@ class Magmodules_Channable_Block_Adminhtml_System_Config_Form_Field_Token
public function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
if ($token = Mage::helper('channable')->getToken()) {
return $token;
$element->setValue($token);
} else {
$html = '<a href="' . $this->getUrl('adminhtml/channable/createToken') . '">Create Token</a>';
$element->setValue($html);
}

return '<a href="' . $this->getUrl('adminhtml/channable/createToken') . '">Create Token</a>';
return parent::_getElementHtml($element);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
{
$modules = Mage::getConfig()->getNode('modules')->children();
$modulesArray = (array)$modules;
return $modulesArray['Magmodules_Channable']->version;
$element->setValue($modulesArray['Magmodules_Channable']->version);
return parent::_getElementHtml($element);
}

}
506 changes: 350 additions & 156 deletions app/code/community/Magmodules/Channable/Helper/Data.php

Large diffs are not rendered by default.

24 changes: 17 additions & 7 deletions app/code/community/Magmodules/Channable/Helper/Selftest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ public function runTests()
$atts = '<i>' . implode($nonFlatAttributes, ', ') . '</i>';
$url = Mage::helper("adminhtml")->getUrl('adminhtml/channable/addToFlat');
$msg = $this->__('Missing Attribute(s) in Catalog Product Flat: %s', $atts);
$msg .= '<br/> ' . $this->__('<a href="%s">Add</a> attributes to Flat Catalog or enable "Bypass Flat Product Tables"',
$url);
$msg .= '<br/> ' . $this->__(
'<a href="%s">Add</a> attributes to Flat Catalog or enable "Bypass Flat Product Tables"',
$url
);
$result[] = $this->getFail($msg, '#missingattributes');
}
}
Expand All @@ -98,8 +100,10 @@ public function runTests()
$modulesArray = (array)Mage::getConfig()->getNode('modules')->children();
$currentVersion = $modulesArray['Magmodules_Channable']->version;
if (version_compare($currentVersion, $latestVersion['version']) >= 0) {
$msg = $this->__('Running the latest version (Installed: v%s - Github: v%s)', $currentVersion,
$latestVersion['version']);
$msg = $this->__(
'Running the latest version (Installed: v%s - Github: v%s)', $currentVersion,
$latestVersion['version']
);
$result[] = $this->getPass($msg);
} else {
$msg = $this->__(
Expand All @@ -118,6 +122,7 @@ public function runTests()
if (!empty($apiModule['success'])) {
$result[] = $this->getPass($apiModule['success']);
}

if (!empty($apiModule['error'])) {
$result[] = $this->getFail($apiModule['error']);
}
Expand Down Expand Up @@ -151,17 +156,21 @@ public function getHtmlResult($msg, $type, $link)
if ($type == 'pass') {
$format = '<span class="channable-success">%s</span>';
}

if ($type == 'fail') {
$format = '<span class="channable-error">%s</span>';
}

if ($type == 'notice') {
$format = '<span class="channable-notice">%s</span>';
}

if ($format) {
if ($link) {
$format = str_replace('</span>', '<span class="more"><a href="%s">More Info</a></span></span>',
$format);
$format = str_replace(
'</span>', '<span class="more"><a href="%s">More Info</a></span></span>',
$format
);
return sprintf($format, Mage::helper('channable')->__($msg), self::SUPPORT_URL . $link);
} else {
return sprintf($format, Mage::helper('channable')->__($msg));
Expand Down Expand Up @@ -246,7 +255,8 @@ public function checkChannableApiModule()
'success' => $this->__(
'Running minumum required Channable API Module (Installed: v%s - Min. required: v%s)',
$currentVersion,
self::API_MIN_REQUIREMENT)
self::API_MIN_REQUIREMENT
)
);
} else {
return array(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ protected function _beforeSave()
unset($value['__empty']);
if (count($value)) {
$value = $this->orderData($value, 'label');
foreach ($value as $key => $field) {
foreach ($value as $key => $field) {
if (!empty($field['attribute']) && !empty($field['label'])) {
$label = str_replace(" ", "_", trim($field['label']));
$value[$key]['label'] = strtolower($label);
$value[$key]['attribute'] = $field['attribute'];
} else {
unset($value[$key]);
unset($value[$key]);
}
}
}

$keys = array();
for ($i = 0; $i < count($value); $i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ public function toOptionArray()
if (!$this->options) {
$options[] = array('value' => '', 'label' => Mage::helper('channable')->__('-- None'));
$options[] = $this->getAttributesArray();
$relations = $this->getRelations();
if (!empty($relations)) {
$options[] = $relations;
}

$this->options = $options;
}

Expand Down Expand Up @@ -66,7 +71,7 @@ public function getAttributesArray()
usort(
$optionArray, function ($a, $b) {
return strcmp($a["label"], $b["label"]);
}
}
);

return array(
Expand Down Expand Up @@ -114,6 +119,32 @@ public function getExtraFields()
return $optionArray;
}

/**
* @return array
*/
public function getRelations()
{
$optionArray = array();
$optionArray[] = array(
'label' => Mage::helper('channable')->__('Related Skus'),
'value' => 'related_skus'
);
$optionArray[] = array(
'label' => Mage::helper('channable')->__('Upsell Skus'),
'value' => 'upsell_skus'
);
$optionArray[] = array(
'label' => Mage::helper('channable')->__('Crosssell Skus'),
'value' => 'crosssell_skus'
);

return array(
'label' => Mage::helper('channable')->__('Product Relations'),
'value' => $optionArray,
'optgroup-name' => Mage::helper('channable')->__('Product Relations')
);
}

/**
* @return array
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ class Magmodules_Channable_Model_Adminhtml_System_Config_Source_Countries
public function toOptionArray()
{
if (!$this->options) {

$countries = array();
$countries[] = array('value' => '', 'label' => Mage::helper('channable')->__('-- All Countries'));

Expand Down
Loading

0 comments on commit 007f620

Please sign in to comment.