Exception #0 (Exception): Notice: Undefined variable: context in /home/dukaania/public_html/testing2/app/code/Sugarcode/Test/Model/Total/Fee.php
on line 37
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Sugarcode\Test\Model\Total;
class Fee extends \Magento\Framework\Model\AbstractModel implements \Magento\Framework\DataObject\IdentityInterface {
const CACHE_TAG = 'mr_dukaaniatest';
protected $_cacheTag = 'mr_dukaaniatest';
protected $_eventPrefix = 'mr_dukaaniatest';
protected function _construct()
{
$this->_init('Sugarcode\Test\Model\ResourceModel\Fee.php');
}
/**
* Collect grand total address amount
*
* @param \Magento\Quote\Model\Quote $quote
* @param \Magento\Quote\Api\Data\ShippingAssignmentInterface $shippingAssignment
* @param \Magento\Quote\Model\Quote\Address\Total $total
* @return $this
*/
protected $_feeFactory;
public function __construct(
\Sugarcode\Test\Model\Total\FeeFactory $feeFactory
) {
parent::__construct($context);
$this->_feeFactory = $feeFactory;
}
public function collect(
) {
parent::collect($quote, $shippingAssignment, $total);
}
public function getIdentities()
{
$identities = [
self::CACHE_TAG . '_' . $this->getId(),
];
if ($this->hasDataChanges() || $this->isDeleted()) {
$identities[] = Product::CACHE_PRODUCT_CATEGORY_TAG . '_' . $this->getId();
}
return $identities;
}
public function fetch() {
$fee = $this->_feeFactory->create();
$collection = $fee->getCollection();
foreach($collection as $item){
\Zend_Debug::dump($item->getData());
}
exit();
}
public function execute()
{
$fee = $this->_feeFactory->create();
$collection = $fee->getCollection();
foreach($collection as $item){
\Zend_Debug::dump($item->getData());
}
exit();
}
/**
* Get Subtotal label
*
* @return \Magento\Framework\Phrase
*/
public function getLabel() {
return __('Fee');
}
}