|
|
@@ -3,40 +3,34 @@
|
|
|
namespace Cpcommerce\ShippingNotifications\Block;
|
|
|
|
|
|
use Magento\Catalog\Block\Product\View\Description;
|
|
|
-use Magento\Catalog\Model\Product\Attribute\Repository;
|
|
|
use Magento\Framework\View\Element\Template;
|
|
|
use Magento\Framework\View\Element\Template\Context;
|
|
|
-use Cpcommerce\ShippingNotifications\Model\ShippingCategory AS DelayedShippingCategory;
|
|
|
-use Cpcommerce\ShippingNotifications\Model\ResourceModel\ShippingCategory\Collection;
|
|
|
-use Magento\Framework\App\ResourceConnection;
|
|
|
use \Magento\Framework\App\Config\ScopeConfigInterface;
|
|
|
|
|
|
class ShippingCategory extends Template
|
|
|
{
|
|
|
- protected $resource;
|
|
|
+ private $description;
|
|
|
+ private $context;
|
|
|
+ private $data;
|
|
|
+ private $scopeConfig;
|
|
|
|
|
|
public function __construct(
|
|
|
Description $description,
|
|
|
- Repository $attribute,
|
|
|
Context $context,
|
|
|
array $data = [],
|
|
|
- DelayedShippingCategory $delayedShippingCategory,
|
|
|
- Collection $delayedCollection,
|
|
|
- ResourceConnection $resource,
|
|
|
ScopeConfigInterface $scopeConfig
|
|
|
) {
|
|
|
$this->description = $description;
|
|
|
- $this->attribute = $attribute;
|
|
|
- $this->delayedShippingCategory = $delayedShippingCategory;
|
|
|
- $this->delayedCollection = $delayedCollection;
|
|
|
- $this->resource = $resource;
|
|
|
$this->scopeConfig = $scopeConfig;
|
|
|
return parent::__construct($context, $data);
|
|
|
}
|
|
|
|
|
|
public function getShippingCategory(){
|
|
|
$_product = $this->description->getProduct();
|
|
|
- $option_id = $_product->getShippingCategory();
|
|
|
+
|
|
|
+ $attributeCode = $this->scopeConfig->getValue('cpcommerce_shipping_notifications/general/attribute',\Magento\Store\Model\ScopeInterface::SCOPE_STORE);
|
|
|
+
|
|
|
+ $option_id = $_product->getData($attributeCode);
|
|
|
|
|
|
return $option_id;
|
|
|
}
|
|
|
@@ -49,8 +43,18 @@ class ShippingCategory extends Template
|
|
|
$delayedShipCategsArray = explode(",",$delayedShipCategs);
|
|
|
return $delayedShipCategsArray;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
+ public function getBlock(){
|
|
|
+ $notifBlock = $this->scopeConfig->getValue('cpcommerce_shipping_notifications/general/shipping_notification_block',\Magento\Store\Model\ScopeInterface::SCOPE_STORE);
|
|
|
+
|
|
|
+ if(!isset($notifBlock)){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ return $notifBlock;
|
|
|
+ }
|
|
|
+
|
|
|
}
|