User Address - Checkout Process

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
jramirezgranada
Posts: 40
Joined: 12 Jul 2018, 19:57

User Address - Checkout Process

Post by jramirezgranada » 08 Oct 2018, 20:08

Hi there;

I'm working in a some feature in the checkout process

I saw this code in the address-delivery-body-standard.php

Code: Select all

<?php foreach ($this->get('addressDeliveryItems', []) as $id => $addr) : ?>
.....
<?php endoreach; ?>
I supposed that that block code load the addresses stored in the users_address table.

Now, I checked Aimeos\Client\Html\Checkout\Standard\Address\Delivery\Standard.php in addData method this.

Code: Select all

$context = $this->getContext();
        $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'customer');
        $orderAddressManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/address');

        try {
            $deliveryAddressItems = [];
            $item = $controller->getItem($context->getUserId(), ['address']);

            foreach ($item->getAddressItems() as $id => $addrItem) {
                $deliveryAddressItems[$id] = $orderAddressManager->createItem()->copyFrom($addrItem);
            }

            $paymentAddressItem = $orderAddressManager->createItem()->copyFrom($item->getPaymentAddress());

            $view->addressCustomerItem = $item;
            $view->addressPaymentItem = $paymentAddressItem;
            $view->addressDeliveryItems = $deliveryAddressItems;
        } catch (\Exception $e) {
        } // customer has no account yet
But the $deliveryAddressItems array always is empty, is there something i need to do ?

Thanks
--
Jorge A Ramirez
System Engineer
PHP Developer

mohal_04
Advanced
Posts: 108
Joined: 27 Mar 2018, 05:59

Re: User Address - Checkout Process

Post by mohal_04 » 09 Oct 2018, 17:27

jramirezgranada wrote:Hi there;

I'm working in a some feature in the checkout process

I saw this code in the address-delivery-body-standard.php

Code: Select all

<?php foreach ($this->get('addressDeliveryItems', []) as $id => $addr) : ?>
.....
<?php endoreach; ?>
I supposed that that block code load the addresses stored in the users_address table.

Now, I checked Aimeos\Client\Html\Checkout\Standard\Address\Delivery\Standard.php in addData method this.

Code: Select all

$context = $this->getContext();
        $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'customer');
        $orderAddressManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/address');

        try {
            $deliveryAddressItems = [];
            $item = $controller->getItem($context->getUserId(), ['address']);

            foreach ($item->getAddressItems() as $id => $addrItem) {
                $deliveryAddressItems[$id] = $orderAddressManager->createItem()->copyFrom($addrItem);
            }

            $paymentAddressItem = $orderAddressManager->createItem()->copyFrom($item->getPaymentAddress());

            $view->addressCustomerItem = $item;
            $view->addressPaymentItem = $paymentAddressItem;
            $view->addressDeliveryItems = $deliveryAddressItems;
        } catch (\Exception $e) {
        } // customer has no account yet
But the $deliveryAddressItems array always is empty, is there something i need to do ?

Thanks
Hi,

Are you working on the page where user enters its addressess?

Thanks!

jramirezgranada
Posts: 40
Joined: 12 Jul 2018, 19:57

Re: User Address - Checkout Process

Post by jramirezgranada » 09 Oct 2018, 19:46

Yes, in the checkout process.

I found a bug there, in the Aimeos\Client\Html\Checkout\Standard\Address\Delivery\Standard.php in this line aimeos needs to change this $item = $controller->getItem($context->getUserId(), ['address']); to this $item = $controller->getItem($context->getUserId(), ['customer/address']);
--
Jorge A Ramirez
System Engineer
PHP Developer

User avatar
aimeos
Administrator
Posts: 7836
Joined: 01 Jan 1970, 00:00

Re: User Address - Checkout Process

Post by aimeos » 09 Oct 2018, 19:59

The bug should have been fixed in the new 2018.10 version released today. Could you check that please?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply