|
@@ -6,17 +6,28 @@ use Magento\Catalog\Block\Product\View\Description;
|
|
|
use Magento\Catalog\Model\Product\Attribute\Repository;
|
|
use Magento\Catalog\Model\Product\Attribute\Repository;
|
|
|
use Magento\Framework\View\Element\Template;
|
|
use Magento\Framework\View\Element\Template;
|
|
|
use Magento\Framework\View\Element\Template\Context;
|
|
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;
|
|
|
|
|
|
|
|
class ShippingCategory extends Template
|
|
class ShippingCategory extends Template
|
|
|
{
|
|
{
|
|
|
|
|
+ protected $resource;
|
|
|
|
|
+
|
|
|
public function __construct(
|
|
public function __construct(
|
|
|
Description $description,
|
|
Description $description,
|
|
|
Repository $attribute,
|
|
Repository $attribute,
|
|
|
Context $context,
|
|
Context $context,
|
|
|
- array $data = []
|
|
|
|
|
|
|
+ array $data = [],
|
|
|
|
|
+ DelayedShippingCategory $delayedShippingCategory,
|
|
|
|
|
+ Collection $delayedCollection,
|
|
|
|
|
+ ResourceConnection $resource
|
|
|
) {
|
|
) {
|
|
|
$this->description = $description;
|
|
$this->description = $description;
|
|
|
$this->attribute = $attribute;
|
|
$this->attribute = $attribute;
|
|
|
|
|
+ $this->delayedShippingCategory = $delayedShippingCategory;
|
|
|
|
|
+ $this->delayedCollection = $delayedCollection;
|
|
|
|
|
+ $this->resource = $resource;
|
|
|
return parent::__construct($context, $data);
|
|
return parent::__construct($context, $data);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -26,7 +37,16 @@ class ShippingCategory extends Template
|
|
|
|
|
|
|
|
public function getShippingCategory(){
|
|
public function getShippingCategory(){
|
|
|
$_product = $this->description->getProduct();
|
|
$_product = $this->description->getProduct();
|
|
|
- $shipping_category = $_product->getResource()->getAttribute('shipping_category')->getFrontend()->getValue($_product);
|
|
|
|
|
- return $shipping_category;
|
|
|
|
|
|
|
+ $option_id = $_product->getShippingCategory();
|
|
|
|
|
+
|
|
|
|
|
+ return $option_id;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public function getDelayedShippingCategories(){
|
|
|
|
|
+
|
|
|
|
|
+ $this->delayedCollection->getSelect()->where("is_delayed = '1'");
|
|
|
|
|
+
|
|
|
|
|
+ return $this->delayedCollection->load();
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|