checkout process-add new step in checkout process
Posted: 23 Feb 2021, 07:33
hi aimeos,
i am using aimeos with laravel.
laravel version : laravel 8
aimeos version: "~2020.10"
i have given a task to add an additional step in checkoutprocess after address
for that purpose i have created a subpart
in directory
ext\moudhah\client\html\src\Client\Html\Checkout\Standard\SendOtp
and after that i created a template sendotp-body-standard.php
in directory ext\moudhah\client\html\templates\checkout\standard
now at first i want to show sendotp step as a 3rd step in navigation bar in checkout process so please guide me how can i achieve this do i have to add some cofiguration or something else that i am missing.
please note that above in my standard class(sendotp component) i only included getbody method i know there are methods
which i have to include but at first i want to see the option in checkout process so please guide me how can i achieve this task
i am using aimeos with laravel.
laravel version : laravel 8
aimeos version: "~2020.10"
i have given a task to add an additional step in checkoutprocess after address
for that purpose i have created a subpart
in directory
ext\moudhah\client\html\src\Client\Html\Checkout\Standard\SendOtp
Code: Select all
<?php
/**
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
* @copyright Metaways Infosystems GmbH, 2013
* @copyright Aimeos (aimeos.org), 2015-2020
* @package Client
* @subpackage Html
*/
namespace Aimeos\Client\Html\Checkout\Standard\SendOtp;
// Strings for translation
sprintf( 'address' );
/**
* Default implementation of checkout address HTML client.
*
* @package Client
* @subpackage Html
*/
class Standard
extends \Aimeos\Client\Html\Common\Client\Factory\Base
implements \Aimeos\Client\Html\Common\Client\Factory\Iface
{
/** client/html/checkout/standard/address/standard/subparts
* List of HTML sub-clients rendered within the checkout standard address section
*
* The output of the frontend is composed of the code generated by the HTML
* clients. Each HTML client can consist of serveral (or none) sub-clients
* that are responsible for rendering certain sub-parts of the output. The
* sub-clients can contain HTML clients themselves and therefore a
* hierarchical tree of HTML clients is composed. Each HTML client creates
* the output that is placed inside the container of its parent.
*
* At first, always the HTML code generated by the parent is printed, then
* the HTML code of its sub-clients. The order of the HTML sub-clients
* determines the order of the output of these sub-clients inside the parent
* container. If the configured list of clients is
*
* array( "subclient1", "subclient2" )
*
* you can easily change the order of the output by reordering the subparts:
*
* client/html/<clients>/subparts = array( "subclient1", "subclient2" )
*
* You can also remove one or more parts if they shouldn't be rendered:
*
* client/html/<clients>/subparts = array( "subclient1" )
*
* As the clients only generates structural HTML, the layout defined via CSS
* should support adding, removing or reordering content by a fluid like
* design.
*
* @param array List of sub-client names
* @since 2014.03
* @category Developer
*/
private $subPartPath = 'client/html/checkout/standard/sendotp/standard/subparts';
/** client/html/checkout/standard/address/billing/name
* Name of the billing part used by the checkout standard address client implementation
*
* Use "Myname" if your class is named "\Aimeos\Client\Checkout\Standard\Address\Billing\Myname".
* The name is case-sensitive and you should avoid camel case names like "MyName".
*
* @param string Last part of the client class name
* @since 2014.03
* @category Developer
*/
/** client/html/checkout/standard/address/delivery/name
* Name of the delivery part used by the checkout standard address client implementation
*
* Use "Myname" if your class is named "\Aimeos\Client\Checkout\Standard\Address\Delivery\Myname".
* The name is case-sensitive and you should avoid camel case names like "MyName".
*
* @param string Last part of the client class name
* @since 2014.03
* @category Developer
*/
private $subPartNames = [];
/**
* Returns the HTML code for insertion into the body.
*
* @param string $uid Unique identifier for the output if the content is placed more than once on the same page
* @return string HTML code
*/
public function getBody( string $uid = '' ) : string
{
$view = $this->getView();
$step = $view->get( 'standardStepActive', 'sendotp' );
$onepage = $view->config( 'client/html/checkout/standard/onepage', [] );
if( $step != 'sendotp' && !( in_array( 'sendotp', $onepage ) && in_array( $step, $onepage ) ) ) {
return '';
}
$html = '';
foreach( $this->getSubClients() as $subclient ) {
$html .= $subclient->setView( $view )->getBody( $uid );
}
$view->sendotpBody = $html;
/** client/html/checkout/standard/address/standard/template-body
* Relative path to the HTML body template of the checkout standard address client.
*
* The template file contains the HTML code and processing instructions
* to generate the result shown in the body of the frontend. The
* configuration string is the path to the template file relative
* to the templates directory (usually in client/html/templates).
*
* You can overwrite the template file configuration in extensions and
* provide alternative templates. These alternative templates should be
* named like the default one but with the string "standard" replaced by
* an unique name. You may use the name of your project for this. If
* you've implemented an alternative client class as well, "standard"
* should be replaced by the name of the new class.
*
* @param string Relative path to the template creating code for the HTML page body
* @since 2014.03
* @category Developer
* @see client/html/checkout/standard/address/standard/template-header
*/
$tplconf = 'client/html/checkout/standard/sendotp/standard/template-body';
$default = 'checkout/standard/sendotp-body-standard';
return $view->render( $view->config( $tplconf, $default ) );
}
}
in directory ext\moudhah\client\html\templates\checkout\standard
Code: Select all
<?php
/**
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
* @copyright Metaways Infosystems GmbH, 2013
* @copyright Aimeos (aimeos.org), 2015-2020
*/
$enc = $this->encoder();
?>
<?php $this->block()->start( 'checkout/standard/sendotp' ); ?>
<section class="checkout-standard-address">
<div class="form-horizontal row">
<input type="text" class="form-control">
</div>
<div class="button-group">
<a class="btn btn-default btn-lg btn-back" href="<?= $enc->attr( $this->get( 'standardUrlBack' ) ); ?>">
<?= $enc->html( $this->translate( 'client', 'Previous' ), $enc::TRUST ); ?>
</a>
<button class="btn btn-primary btn-lg btn-action">
<?= $enc->html( $this->translate( 'client', 'Next' ), $enc::TRUST ); ?>
</button>
</div>
</section>
<?php $this->block()->stop(); ?>
<?= $this->block()->get( 'checkout/standard/sendotp' ); ?>
please note that above in my standard class(sendotp component) i only included getbody method i know there are methods
which i have to include but at first i want to see the option in checkout process so please guide me how can i achieve this task