![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/magento/module-checkout/Controller/Cart/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ namespace Magento\Checkout\Controller\Cart; use Magento\Framework; use Magento\Framework\App\Action\HttpPostActionInterface; use Magento\Checkout\Model\Cart as CustomerCart; class EstimatePost extends \Magento\Checkout\Controller\Cart implements HttpPostActionInterface { /** * @var \Magento\Quote\Api\CartRepositoryInterface */ protected $quoteRepository; /** * @param \Magento\Framework\App\Action\Context $context * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig * @param \Magento\Checkout\Model\Session $checkoutSession * @param \Magento\Store\Model\StoreManagerInterface $storeManager * @param \Magento\Framework\Data\Form\FormKey\Validator $formKeyValidator * @param CustomerCart $cart * @param \Magento\Quote\Api\CartRepositoryInterface $quoteRepository * @codeCoverageIgnore */ public function __construct( Framework\App\Action\Context $context, Framework\App\Config\ScopeConfigInterface $scopeConfig, \Magento\Checkout\Model\Session $checkoutSession, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Data\Form\FormKey\Validator $formKeyValidator, CustomerCart $cart, \Magento\Quote\Api\CartRepositoryInterface $quoteRepository ) { $this->quoteRepository = $quoteRepository; parent::__construct( $context, $scopeConfig, $checkoutSession, $storeManager, $formKeyValidator, $cart ); } /** * Initialize shipping information * * @return \Magento\Framework\Controller\Result\Redirect */ public function execute() { $country = (string)$this->getRequest()->getParam('country_id'); $postcode = (string)$this->getRequest()->getParam('estimate_postcode'); $city = (string)$this->getRequest()->getParam('estimate_city'); $regionId = (string)$this->getRequest()->getParam('region_id'); $region = (string)$this->getRequest()->getParam('region'); $this->cart->getQuote()->getShippingAddress() ->setCountryId($country) ->setCity($city) ->setPostcode($postcode) ->setRegionId($regionId) ->setRegion($region); $this->cart->save(); return $this->_goBack(); } }