-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adicionada opção de configurar os atributos do catálogo
- Loading branch information
1 parent
1d10a8b
commit e6f97a0
Showing
4 changed files
with
127 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
app/code/community/Quack/TntBrasil/Model/Source/Attribute.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
/** | ||
* Este arquivo é parte do programa Quack TntBrasil | ||
* | ||
* Quack TntBrasil é um software livre; você pode redistribuí-lo e/ou | ||
* modificá-lo dentro dos termos da Licença Pública Geral GNU como | ||
* publicada pela Fundação do Software Livre (FSF); na versão 3 da | ||
* Licença, ou (na sua opinião) qualquer versão. | ||
* | ||
* Este programa é distribuído na esperança de que possa ser útil, | ||
* mas SEM NENHUMA GARANTIA; sem uma garantia implícita de ADEQUAÇÃO | ||
* a qualquer MERCADO ou APLICAÇÃO EM PARTICULAR. Veja a Licença | ||
* Pública Geral GNU para maiores detalhes. | ||
* | ||
* Você deve ter recebido uma cópia da Licença Pública Geral GNU junto | ||
* com este programa, Se não, veja <http://www.gnu.org/licenses/>. | ||
* | ||
* @category Quack | ||
* @package Quack_TntBrasil | ||
* @author Rafael Patro <rafaelpatro@gmail.com> | ||
* @copyright Copyright (c) 2017 Rafael Patro (rafaelpatro@gmail.com) | ||
* @license http://www.gnu.org/licenses/gpl.txt | ||
* @link https://github.com/rafaelpatro/Quack_TntBrasil | ||
*/ | ||
|
||
class Quack_TntBrasil_Model_Source_Attribute extends Mage_Eav_Model_Entity_Attribute_Source_Abstract | ||
{ | ||
public function toOptionArray() | ||
{ | ||
$optionArray = array( | ||
array('value' => '', 'label' => Mage::helper('adminhtml')->__('Select')) | ||
); | ||
$collection = Mage::getResourceSingleton('catalog/product_attribute_collection'); | ||
/* @var $attribute Mage_Catalog_Model_Resource_Eav_Attribute */ | ||
foreach ($collection as $attribute) { | ||
$code = $attribute->getAttributeCode(); | ||
$label = $attribute->getFrontendLabel(); | ||
if (empty($label)) { | ||
$label = $code; | ||
} else { | ||
$label.= " ({$code})"; | ||
} | ||
$optionArray[] = array( | ||
'value' => $code, | ||
'label' => $label, | ||
); | ||
} | ||
return $optionArray; | ||
} | ||
|
||
/** | ||
* (non-PHPdoc) | ||
* @see Mage_Eav_Model_Entity_Attribute_Source_Interface::getAllOptions() | ||
*/ | ||
public function getAllOptions() | ||
{ | ||
return self::toOptionArray(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters