Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/app/code/community/AvS/FastSimpleImport/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,23 @@
*/

class AvS_FastSimpleImport_Helper_Data extends Mage_Core_Helper_Abstract
{}
{

/**
* Returns str with all alphabetic characters converted to lowercase.
* Uses the multibyte function variants if available.
*
* @param $str the string being lowercased
*
* @return string str with all alphabetic characters converted to lowercase
*/
public function strtolower($str)
{
if (function_exists('mb_strtolower') && function_exists('mb_detect_encoding')) {
return mb_strtolower($str, mb_detect_encoding($str));
}

return strtolower($str);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,9 @@ protected function _createDropdownAttributeOptions()

$options = $this->_getAttributeOptions($attribute);

if (!in_array(trim($rowData[$attributeCode]), $options, true)) {
/** @var AvS_FastSimpleImport_Helper_Data $helper */
$helper = Mage::helper('fastsimpleimport');
if (!in_array($helper->strtolower(trim($rowData[$attributeCode])), $options, true)) {
$this->_createAttributeOption($attribute, trim($rowData[$attributeCode]));
}
}
Expand Down Expand Up @@ -318,7 +320,9 @@ protected function _createMultiselectAttributeOptions()

$options = $this->_getAttributeOptions($attribute);

if (!in_array(trim($rowData[$attributeCode]), $options, true)) {
/** @var AvS_FastSimpleImport_Helper_Data $helper */
$helper = Mage::helper('fastsimpleimport');
if (!in_array($helper->strtolower(trim($rowData[$attributeCode])), $options, true)) {
$this->_createAttributeOption($attribute, trim($rowData[$attributeCode]));
}
}
Expand Down Expand Up @@ -346,7 +350,8 @@ protected function _getAttributeOptions($attribute)

$this->_attributeOptions[$attribute->getAttributeCode()] = array();
foreach ($attributeOptions->getAllOptions(false) as $option) {
$this->_attributeOptions[$attribute->getAttributeCode()][$option['value']] = $option['label'];
$label = Mage::helper('fastsimpleimport')->strtolower($option['label']);
$this->_attributeOptions[$attribute->getAttributeCode()][$option['value']] = $label;
}
}

Expand Down