lordshop Posted February 24, 2021 Share Posted February 24, 2021 @Backoffice > Orders > Order Page: I need to showing the complete details of the customer address information as VAT No & notes, when I am viewing the the customer order. The customers a lot of times write some messages or need something special and the operator can't see those comments. Need to make visible those fields if they aren't null. Any idea how? I have draw with red the missing fields. 1 Link to comment Share on other sites More sharing options...
GayatriY Posted February 25, 2021 Share Posted February 25, 2021 Hi, You can set the address format from Customers >>Addresses and from there you can select the VAT number. And this selected address format will be visible in all areas of website. Link to comment Share on other sites More sharing options...
lordshop Posted February 25, 2021 Author Share Posted February 25, 2021 from Customers >>Addresses is a list of customers. Maybe you suggesting from International > Locations > Country > Edit info. Here are mine, but it still don't see Vat_number and "Other details" in order detail page. 1 Link to comment Share on other sites More sharing options...
GayatriY Posted February 26, 2021 Share Posted February 26, 2021 No, but what you are doing is enable the vat number for that country, which is already there. And you want to show the vat_number in admin order page in backend. It is not displayed because there is no code in that tpl for display vat number. Link to comment Share on other sites More sharing options...
lordshop Posted February 26, 2021 Author Share Posted February 26, 2021 Sorry, If I understand correctly you giving me more information of the problem, but do you have an answer? Link to comment Share on other sites More sharing options...
GayatriY Posted February 26, 2021 Share Posted February 26, 2021 You need to add the code to display the VAT number in admin order page. It is location \src\PrestaShopBundle\Resources\views\Admin\Sell\Order\Order\Blocks\View\customer.html.twig Add below code: <p class="mb-0">{{ orderForViewing.shippingAddress.vatNumber }}</p> Also need to add code in 2 more files: \src\Adapter\Order\QueryHandler\GetOrderForViewingHandler.php \src\Core\Domain\Order\QueryResult\OrderShippingAddressForViewing.php Define variable vatNumber and define function public function getVatNumber() { return $this->vatNumber; } This works for me, I hope works for you too Take backup of files before apply. Thank you 1 Link to comment Share on other sites More sharing options...
zei Posted March 10, 2021 Share Posted March 10, 2021 On 2/26/2021 at 1:22 PM, GayatriY said: You need to add the code to display the VAT number in admin order page. It is location \src\PrestaShopBundle\Resources\views\Admin\Sell\Order\Order\Blocks\View\customer.html.twig Add below code: <p class="mb-0">{{ orderForViewing.shippingAddress.vatNumber }}</p> Also need to add code in 2 more files: \src\Adapter\Order\QueryHandler\GetOrderForViewingHandler.php \src\Core\Domain\Order\QueryResult\OrderShippingAddressForViewing.php Define variable vatNumber and define function public function getVatNumber() { return $this->vatNumber; } This works for me, I hope works for you too Take backup of files before apply. Thank you I got this error. What could i failed? Thanks in advance. Link to comment Share on other sites More sharing options...
lordshop Posted March 11, 2021 Author Share Posted March 11, 2021 (edited) I have added /src/PrestaShopBundle/Resources/views/Admin/Sell/Order/Order/Blocks/View/customer.html.twig under the <p class="mb-0">{{ orderForViewing.shippingAddress.fullName }}</p> {% if orderForViewing.shippingAddress.vatNumber is not empty %} <p class="mb-0">{{ orderForViewing.shippingAddress.vatNumber }}</p> {% endif %} also I have replace in src\Adapter\Order\QueryHandler\GetOrderForViewingHandler.php the public function getOrderShippingAddress(Order $order): OrderShippingAddressForViewing with public function getOrderShippingAddress(Order $order): OrderShippingAddressForViewing { $address = new Address($order->id_address_delivery); $country = new Country($address->id_country); $stateName = ''; if ($address->id_state) { $state = new State($address->id_state); $stateName = $state->name; } $vatNumber = $address->vat_number; return new OrderShippingAddressForViewing( $address->id, $address->firstname, $address->lastname, $address->company, $address->address1, $address->address2, $stateName, $address->city, $country->name[$order->id_lang], $address->postcode, $address->phone, $address->phone_mobile, $vatNumber ); } and 3: in the \src\Core\Domain\Order\QueryResult\OrderShippingAddressForViewing.php I have replace public function __construct private $vatNumber; public function __construct( int $addressId, string $firstName, string $lastName, string $companyName, string $address1, string $address2, string $stateName, string $cityName, string $countryName, string $postCode, string $phone, string $phoneMobile, string $vatNumber ) { $this->addressId = $addressId; $this->firstName = $firstName; $this->lastName = $lastName; $this->companyName = $companyName; $this->address1 = $address1; $this->address2 = $address2; $this->stateName = $stateName; $this->cityName = $cityName; $this->countryName = $countryName; $this->postCode = $postCode; $this->phoneNumber = $phone; $this->mobilePhoneNumber = $phoneMobile; $this->vatNumber = $vatNumber; } public function getVatNumber() { return $this->vatNumber; } the backoffice is working OK But I don't see the VAT number in the order and also I what to add the address notes. Any hint? Edited March 11, 2021 by lordshop (see edit history) 1 Link to comment Share on other sites More sharing options...
WizardStork Posted March 22, 2021 Share Posted March 22, 2021 Hello, There's a module on the store that seems to fix your problem: https://addons.prestashop.com/en/accounting-invoicing/51328-show-vat-number-in-bo-order-details.html Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now