49 lines
1.4 KiB
PHP
49 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace Wowow\Devis\Block\Adminhtml;
|
|
|
|
class Devis extends \Magento\Backend\Block\Template
|
|
{
|
|
|
|
protected $_template = 'view.phtml';
|
|
|
|
public function __construct(
|
|
\Magento\Backend\Block\Template\Context $context, array $data = []
|
|
) {
|
|
parent::__construct($context,$data);
|
|
}
|
|
|
|
protected function _toHtml() {
|
|
return parent::_toHtml();
|
|
}
|
|
|
|
public function getCustomer($id)
|
|
{
|
|
$objectManager = $this->getObjectManager();
|
|
$devisModel = $objectManager->create('\Wowow\Devis\Model\Devis');
|
|
$devis = $devisModel->load($id);
|
|
$customerId = $devis->getCustomerId();
|
|
$customerModel = $this->getObjectManager()->create('\Magento\Customer\Model\Customer');
|
|
return $customerModel->load($customerId);
|
|
}
|
|
|
|
public function getObjectManager()
|
|
{
|
|
return \Magento\Framework\App\ObjectManager::getInstance();
|
|
}
|
|
|
|
public function getAdresse($id)
|
|
{
|
|
$customer = $this->getCustomer($id);
|
|
return $customer->getAddresses();
|
|
}
|
|
|
|
public function getCountryHtml($countryCode)
|
|
{
|
|
$objectManager = $this->getObjectManager();
|
|
$countryModel = $objectManager->create('\Magento\Directory\Model\CountryFactory');
|
|
$country = $countryModel->create()->loadByCode($countryCode);
|
|
return $country->getName();
|
|
}
|
|
|
|
} |