|
|
@@ -0,0 +1,31 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace Cpcommerce\ShippingNotifications\Model\Config\Source;
|
|
|
+
|
|
|
+use Magento\Framework\Data\OptionSourceInterface;
|
|
|
+use Magento\Catalog\Model\Product\Attribute\Repository;
|
|
|
+
|
|
|
+class ShippingCategories implements OptionSourceInterface
|
|
|
+{
|
|
|
+
|
|
|
+ public function __construct(
|
|
|
+ Repository $attribute
|
|
|
+ ){
|
|
|
+ $this->attribute = $attribute;
|
|
|
+ }
|
|
|
+
|
|
|
+ public function toOptionArray()
|
|
|
+ {
|
|
|
+ $options = [];
|
|
|
+ $shippingCategories = $this->attribute->get('shipping_category')->getOptions();
|
|
|
+
|
|
|
+ foreach($shippingCategories AS $shippingCategory){
|
|
|
+ $options[] = [
|
|
|
+ 'value' => $shippingCategory->getValue(),
|
|
|
+ 'label' => $shippingCategory->getLabel()
|
|
|
+ ];
|
|
|
+ }
|
|
|
+
|
|
|
+ return $options;
|
|
|
+ }
|
|
|
+}
|