| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- 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;
- class ShippingCategory extends Template
- {
- protected $resource;
- public function __construct(
- Description $description,
- Repository $attribute,
- Context $context,
- array $data = [],
- DelayedShippingCategory $delayedShippingCategory,
- Collection $delayedCollection,
- ResourceConnection $resource
- ) {
- $this->description = $description;
- $this->attribute = $attribute;
- $this->delayedShippingCategory = $delayedShippingCategory;
- $this->delayedCollection = $delayedCollection;
- $this->resource = $resource;
- return parent::__construct($context, $data);
- }
- public function getAttributeData($attribute_code){
- return $this->attribute->get($attribute_code);
- }
- public function getShippingCategory(){
- $_product = $this->description->getProduct();
- $option_id = $_product->getShippingCategory();
- return $option_id;
- }
- public function getDelayedShippingCategories(){
- $this->delayedCollection->getSelect()->where("is_delayed = '1'");
- return $this->delayedCollection->load();
- }
- }
|