Additional step to the checkout
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!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Additional step to the checkout
Hello,
My employer wants me to add a new step to the checkout, meaning I have to add additional data to the checkout process ("Delivery time").
I've been bashing my head around, and using your documentation, somehow I createad what you can see above. However, after doing so I have broken the checkout .
Time si running out and I am still not clear how this works, so can you please guide me? Can you list all the steps I have to take for this to work?(even if it sounds dumb...I might have missed something)
Thank you
My employer wants me to add a new step to the checkout, meaning I have to add additional data to the checkout process ("Delivery time").
I've been bashing my head around, and using your documentation, somehow I createad what you can see above. However, after doing so I have broken the checkout .
Time si running out and I am still not clear how this works, so can you please guide me? Can you list all the steps I have to take for this to work?(even if it sounds dumb...I might have missed something)
Thank you
Re: Additional step to the checkout
1.) Create a new subpart for the checkout process (https://aimeos.org/docs/Developers/Html ... w_subparts)
2.) Configure a new step using https://aimeos.org/docs/Configuration/C ... d/subparts
3.) In the process step of your new subpart, save the selected date/time values as attributes in the order service item of the basket (https://aimeos.org/api/latest/class-Aim ... Iface.html)
2.) Configure a new step using https://aimeos.org/docs/Configuration/C ... d/subparts
3.) In the process step of your new subpart, save the selected date/time values as attributes in the order service item of the basket (https://aimeos.org/api/latest/class-Aim ... Iface.html)
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Additional step to the checkout
Many thanks for the answer!
d=(OwO)=b
I have come to understand that i missed the 3rd step, however I am still not clear how the flow works.
I think this is the part where i have to save the attributes
Now the checkout goes to the last step ("summary"), but i am not sure how to save the attributes
1. Do i have to give them a specific name or any name is fine? (this is the part i don't understand - see the comments in the code above)
2. After this I will have to display the option selected in summary whitch means I need to edit the subpart template for summary, right?
Thanks again!
d=(OwO)=b
I have come to understand that i missed the 3rd step, however I am still not clear how the flow works.
I think this is the part where i have to save the attributes
Code: Select all
public function process()
{
$view = $this->getView();
try
{
$context = $this->getContext();
$basketCtrl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'basket' );
// only start if there's something to do
if( ( $serviceId = $view->param( 'c_timeoption', null ) ) !== null )
{
$serviceCtrl = \Aimeos\Controller\Frontend\Factory::createController( $context, 'service' );
$attributes = $view->param( 'c_delivery/' . $serviceId, [] );
$errors = $serviceCtrl->checkAttributes( $serviceId, $attributes );
$view->deliveryError = $errors;
if( count( $errors ) > 0 )
{
$view->standardErrorList = $view->get( 'standardErrorList', [] ) + $errors;
throw new \Aimeos\Client\Html\Exception( sprintf( 'Please recheck your time choice' ) );
}
else
{
/* Is this the part where the attributes are saved?*/
$basketCtrl->setService( 'delivery', $serviceId, $attributes );
/* Is this the part where the attributes are saved?*/
}
}
parent::process();
// Test if delivery service is available
$services = $basketCtrl->get()->getServices();
if( !isset( $view->standardStepActive ) && !array_key_exists( 'summary', $services ) )
{
$view->standardStepActive = 'summary';
return false;
}
}
catch( \Exception $e )
{
$view->standardStepActive = 'summary';
throw $e;
}
}
1. Do i have to give them a specific name or any name is fine? (this is the part i don't understand - see the comments in the code above)
2. After this I will have to display the option selected in summary whitch means I need to edit the subpart template for summary, right?
Thanks again!
Re: Additional step to the checkout
No the name must be unique only but you need to add a decorator to your service options that checks if the data is correct like this ones:Icewind wrote: 1. Do i have to give them a specific name or any name is fine? (this is the part i don't understand - see the comments in the code above)
- https://github.com/aimeos/aimeos-core/b ... r/Time.php
- https://github.com/aimeos/aimeos-core/b ... r/Date.php
If you use the same names as they expect, you can even reuse them without writing your own one.
If you store them as service attributes, they may be shown automatically in the summary depending on their type. Just have a look into the template what are the conditions.Icewind wrote: 2. After this I will have to display the option selected in summary whitch means I need to edit the subpart template for summary, right?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Additional step to the checkout
Thank you! I did not expect you to answer so fast. This is great...it looks like exactly what i need but I am very stressed and I think my brain refuses to cooperate with me...
Can you please show me a bit of code how can I use this inside the process part?
While browsing the documentation, another question popped in my head...Do I have to add a new type of service provider(in admin I mean), beside delivery and payment and play around with those?
Can you please show me a bit of code how can I use this inside the process part?
While browsing the documentation, another question popped in my head...Do I have to add a new type of service provider(in admin I mean), beside delivery and payment and play around with those?
Re: Additional step to the checkout
Puh, maybe it's better to ask the Aimeos company for help to get this done as we are given support in our spare time ...Icewind wrote:Thank you! I did not expect you to answer so fast. This is great...it looks like exactly what i need but I am very stressed and I think my brain refuses to cooperate with me...
Can you please show me a bit of code how can I use this inside the process part?
No, you don't. Just use a delivery service provider.Icewind wrote:While browsing the documentation, another question popped in my head...Do I have to add a new type of service provider(in admin I mean), beside delivery and payment and play around with those?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Additional step to the checkout
Yes, I was kind of aware of that. Your answers are greatly appreciated.aimeos wrote: Puh, maybe it's better to ask the Aimeos company for help to get this done as we are given support in our spare time ...
After some rest and some testing I think I finally understand. Thank you for your support