我想在事务中获取客户地址。但我不知道如何做到这一点。我在下面尝试,但没有成功
下面是我的事务所在的文件路径。php文件将在那里&我正在尝试的代码
/var/www/html/Myproject/app/design/frontend/Megnor/mag110246_4/Lof_CustomerMembership/templates/customer/membership/transactions.phtml
<?php
$helper = $this->helper("LofCustomerMembershipHelperData");
$transactions = $block->getTransactions();
$address=$block->getPrimaryBillingAddress();
// var_dump($helper);
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$customerSession = $objectManager->get('MagentoCustomerModelSession');
$customerId =$customerSession->getCustomer()->getId();
// $address = $this->myHelper->getCustomerAddressById(Id);
// $customer = $this->_customerRepository->getById($customerId);
// $addresses = $customer->getAddresses();
// $billingAddress = $customer->getDefaultBilling();
?>
如果有人知道如何获得默认的账单和送货地址,请告诉我
try with$customer->getDefaultBillingAddress()
or$customer->getDefaultShippingAddress()