Help for integrating the Laravel package
Forum rules: Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#4156 by bill
24 Apr 2017, 18:06
Hello,

I am new to Aimeos and I am trying to figure out things here with the checkout process and how does it really work.

I am trying to find what is the best way to override the checkout process basically after they reach to checkout/summary page and click on "Buy Now" button, how does this gets submitted and proceed? Which controller if I want to add my own code? how would I extend this

If you could guide me if will be great

Thanks
#4164 by bill
25 Apr 2017, 16:16
Hello

Yes I have read it , there are some broken links and its hard to understand.

I am trying to see once the user clicks on "Buy Now" before the payment gateway, how can I intercept that and put my own code , where I grab the cart and do my own logic?

I read about extending the context like this : $context = \App::make('\Aimeos\Shop\Base\Context')->get();

Can I use that to grab the content of the current cart , and do my own custom method?

Please guide me through which files I need to modify or extend to do this

Thanks
#4178 by PeterEsser
01 May 2017, 14:58
We have the same question; we need to adjust some functionality which takes place in the following 2 files:

- /ext/ai-client-html/client/html/src/Client/Html/Checkout/Standard/Order/Standard.php;
public function process();
we need to execute some code based on the order data and update automatically the order status to completed.

- /ext/ai-laravel/lib/custom/src/MShop/Customer/Manager/Laravel.php;
public function saveItem();
We need the created user in Aimeos to get the userdata and process it for further usage in our application.

We created an extension using the extension creator and see that there is a manifest file which includes the src folder of the extension ('client/html/src'), but the autoload_classmap does not contain files which are added in these folders. To be consistant, we added the same folder/file structure in the extension folder, so /ext/ourextension/client/html/src/Client/Html/Checkout/Standard/Order/Standard.php is placed there and as OOP approach the following definition is used in the class

class Standard
extends \Aimeos\Client\Html\Checkout\Standard\Order\Standard

So everything should be in place, we debugged the bootstrap class in the aimeos-core and see that the manifest and folders are added as includes, but in the end the autoload file in the /vendor/composer/autoload_classmap.php is not updated with files from this ext. folder.

Any idea how to fix this so we can add our own logic to existing functions?

We did the dump-autoload command and the template files in our extension folder are getting loaded so the extension structure should be fine.

Hope to hear from you guys!
Peter
#4179 by aimeos
02 May 2017, 10:54
PeterEsser wrote:- /ext/ai-client-html/client/html/src/Client/Html/Checkout/Standard/Order/Standard.php;
public function process();
we need to execute some code based on the order data and update automatically the order status to completed.


Instead of overwriting the existing implementation, you can
- add your own subpart: https://aimeos.org/docs/Developers/Html_frontend/Create_new_subparts
- add a decorator that dynamically extends the class: https://aimeos.org/docs/Developers/Html_frontend/Extend_existing_components

PeterEsser wrote:- /ext/ai-laravel/lib/custom/src/MShop/Customer/Manager/Laravel.php;
public function saveItem();
We need the created user in Aimeos to get the userdata and process it for further usage in our application.


Maybe a job controller is the best place for this: https://aimeos.org/docs/Developers/Controller/Implement_job_controller

PeterEsser wrote:We created an extension using the extension creator and see that there is a manifest file which includes the src folder of the extension ('client/html/src'), but the autoload_classmap does not contain files which are added in these folders. To be consistant, we added the same folder/file structure in the extension folder, so /ext/ourextension/client/html/src/Client/Html/Checkout/Standard/Order/Standard.php is placed there and as OOP approach the following definition is used in the class

class Standard
extends \Aimeos\Client\Html\Checkout\Standard\Order\Standard


It doesn't work to name the class extending from itself. You need to rename it (e.g. "Ourproject") and configure the new class name of your class overwriting the standard implementation: https://aimeos.org/docs/Configuration/Core/client/html/checkout/standard/order/name