/**
  * Execute action
  *
  * @return \Magento\Backend\Model\View\Result\Redirect
  * @throws \Magento\Framework\Exception\LocalizedException|\Exception
  */
 public function execute()
 {
     $collection = $this->filter->getCollection($this->collectionFactory->create());
     var_dump($collection);
     exit;
     $collectionSize = $collection->getSize();
     foreach ($collection as $location) {
         //$location->delete();
     }
     $this->messageManager->addSuccess(__('A total of %1 record(s) have been deleted.', $collectionSize));
     /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
     $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
     return $resultRedirect->setPath('*/*/');
 }
Example #2
0
 /**
  * Get serialized options
  *
  * @return string
  */
 public function getSerializedOptions()
 {
     $height = $this->_scopeConfig->getValue("fastgento/general/height");
     $width = $this->_scopeConfig->getValue("fastgento/general/width");
     $zoom = $this->_scopeConfig->getValue("fastgento/general/zoom");
     $lat = $this->_scopeConfig->getValue("fastgento/general/lat");
     $long = $this->_scopeConfig->getValue("fastgento/general/long");
     $collection = $this->_collectionFactory->create();
     $markers = array();
     /** @var $location /Fastgento/Storelocator/Model/Location */
     foreach ($collection as $location) {
         $markers[] = array("latitude" => (double) $location->getLatitude(), "longitude" => (double) $location->getLongitude(), "title" => $location->getName());
     }
     // Test value data
     $this->_options = array("height" => $height, "width" => $width, "zoom" => (int) $zoom, "lat" => $lat, "long" => $long, "markers" => $markers);
     return json_encode($this->_options);
 }
 /**
  * Constructor
  *
  * @param string $name
  * @param string $primaryFieldName
  * @param string $requestFieldName
  * @param CollectionFactory $locationCollectionFactory
  * @param FilterPool $filterPool
  * @param array $meta
  * @param array $data
  */
 public function __construct($name, $primaryFieldName, $requestFieldName, CollectionFactory $locationCollectionFactory, FilterPool $filterPool, array $meta = [], array $data = [])
 {
     parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data);
     $this->collection = $locationCollectionFactory->create();
     $this->filterPool = $filterPool;
 }