-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. [](#fix) * #5 2. [](#add) * Mapeamento dos atributos Altura, Largura e Comprimento de forma dinâmica pelo Admin.
- Loading branch information
Showing
13 changed files
with
148 additions
and
31 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
48 changes: 48 additions & 0 deletions
48
src/module-correios-frete/Block/Adminhtml/Config/Source/Attributes.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,48 @@ | ||
<?php | ||
/** | ||
* | ||
* Frete com Correios para Magento | ||
* | ||
* @category elOOm | ||
* @package Modulo Frete com Correios | ||
* @copyright Copyright (c) 2023 elOOm (https://eloom.tech) | ||
* @version 2.0.2 | ||
* @license https://opensource.org/licenses/OSL-3.0 | ||
* @license https://opensource.org/licenses/AFL-3.0 | ||
* | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Eloom\CorreiosFrete\Block\Adminhtml\Config\Source; | ||
|
||
use Magento\Catalog\Model\ResourceModel\Eav\Attribute; | ||
|
||
class Attributes implements \Magento\Framework\Option\ArrayInterface { | ||
|
||
private $attributeFactory; | ||
|
||
public function __construct(Attribute $attributeFactory) { | ||
$this->attributeFactory = $attributeFactory; | ||
} | ||
|
||
public function toOptionArray() { | ||
$attributes = $this->attributeFactory->getCollection(); | ||
|
||
$options = []; | ||
$options[] = ['value' => '', 'label' => 'Selecione']; | ||
|
||
foreach ($attributes as $attribute) { | ||
$front = $attribute->getFrontendLabel(); | ||
|
||
if (!empty($front)) { | ||
$options[] = ['value' => $attribute->getAttributecode(), 'label' => $attribute->getAttributecode()]; | ||
} else { | ||
$options[] = ['value' => $attribute->getAttributecode(), 'label' => $attribute->getAttributecode()]; | ||
} | ||
} | ||
|
||
sort($options); | ||
|
||
return $options; | ||
} | ||
} |
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
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
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
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
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
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