-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from gento-arg/sucursales_agrupadas
Sucursales agrupadas
- Loading branch information
Showing
33 changed files
with
1,021 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
namespace Gento\Oca\Controller\Ajax; | ||
|
||
use Gento\Oca\Helper\Data; | ||
use Gento\Oca\Model\OcaApi; | ||
use Magento\Framework\App\Action\Action; | ||
use Magento\Framework\App\Action\Context; | ||
use Magento\Framework\App\Action\HttpPostActionInterface; | ||
use Magento\Framework\Controller\Result\JsonFactory; | ||
|
||
/** | ||
* Catalog index page controller. | ||
*/ | ||
class Branches extends Action implements HttpPostActionInterface | ||
{ | ||
/** | ||
* @var JsonFactory | ||
*/ | ||
protected $resultJsonFactory; | ||
|
||
/** | ||
* @var OcaApi | ||
*/ | ||
protected $ocaApi; | ||
|
||
/** | ||
* @var Data | ||
*/ | ||
protected $helper; | ||
|
||
/** | ||
* Branches constructor. | ||
* @param JsonFactory $resultJsonFactory | ||
* @param OcaApi $ocaApi | ||
* @param Context $context | ||
* @param Data $helper | ||
*/ | ||
public function __construct( | ||
JsonFactory $resultJsonFactory, | ||
OcaApi $ocaApi, | ||
Context $context, | ||
Data $helper | ||
) { | ||
$this->resultJsonFactory = $resultJsonFactory; | ||
$this->ocaApi = $ocaApi; | ||
$this->helper = $helper; | ||
parent::__construct($context); | ||
} | ||
|
||
public function execute() | ||
{ | ||
$result = $this->resultJsonFactory->create(); | ||
|
||
$zipcode = $this->getRequest()->getParam('zipcode'); | ||
$branches = $this->ocaApi->getBranchesZipCode($zipcode); | ||
$branches = $this->helper->addDescriptionToBranches($branches); | ||
|
||
return $result->setData($branches); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.