Jump to content

Edit History

lordshop

lordshop

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?

lordshop

lordshop

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

    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;
    }

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?

×
×
  • Create New...