Page 1 of 1
Delivery date in order process
Posted: 30 Sep 2016, 07:58
by derJu
Hi,
how can i include a delivery date (custom value) in order process?
is this possible?
best regards
derJu
Re: Delivery date in order process
Posted: 02 Oct 2016, 13:53
by aimeos
Yes, that's not a big problem. Create a new service provider decorator and add the configuration for the value you want to add as additionally required value in the delivery checkout page:
https://aimeos.org/docs/Developers/Libr ... figuration
You can use the existing decorators as examples:
https://github.com/aimeos/aimeos-core/t ... /Decorator
Here you can find how to configure your new decorator afterwards:
https://aimeos.org/docs/User_Manual/Adm ... decorators
Re: Delivery date in order process
Posted: 07 Jun 2017, 07:49
by derJu
hi,
i have a problem in the backend config of my own service provider.
i got an error when i will save it in backend see print screen.
hear ist the code of my own service decorator:
Code: Select all
<?php
/**
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
* @copyright Metaways Infosystems GmbH, 2011
* @copyright Aimeos (aimeos.org), 2015-2016
* @package MShop
* @subpackage Service
*/
namespace Aimeos\MShop\Service\Provider\Decorator;
/**
* Ddate decorator for service provider.
*
* @package MShop
* @subpackage Service
*/
class Swisspost
extends \Aimeos\MShop\Service\Provider\Decorator\Base
implements \Aimeos\MShop\Service\Provider\Decorator\Iface
{
private $feConfig = array(
'swisspost' => array(
'code' => 'swisspost',
'internalcode'=> 'swisspost',
'label'=> 'PostPac Priority',
'type'=> 'date',
'internaltype'=> 'datetime',
'default'=> '',
'required'=> true,
),
);
private $beConfig = array(
'swisspost.date' => array(
'code' => 'swisspost.date',
'internalcode'=> 'swisspost.date',
'label'=> 'PostPac Priority',
'type'=> 'date',
'internaltype'=> 'datetime',
'default'=> '',
'required'=> true,
),
);
public function getConfigFE( \Aimeos\MShop\Order\Item\Base\Iface $basket )
{
$list = [];
$feconfig = $this->feConfig;
foreach( $feconfig as $key => $config ) {
$list[$key] = new \Aimeos\MW\Criteria\Attribute\Standard( $config );
}
return $list;
}
public function checkConfigFE( array $attributes )
{
return $this->checkConfig( $this->feConfig, $attributes );
}
/**
* Checks the backend configuration attributes for validity.
*
* @param array $attributes Attributes added by the shop owner in the administraton interface
* @return array An array with the attribute keys as key and an error message as values for all attributes that are
* known by the provider but aren't valid
*/
public function checkConfigBE( array $attributes )
{
$error = $this->getProvider()->checkConfigBE( $attributes );
$error += $this->checkConfig( $this->beConfig, $attributes );
return $error;
}
/**
* Returns the configuration attribute definitions of the provider to generate a list of available fields and
* rules for the value of each field in the administration interface.
*
* @return array List of attribute definitions implementing \Aimeos\MW\Common\Critera\Attribute\Iface
*/
public function getConfigBE()
{
$list = $this->getProvider()->getConfigBE();
foreach( $this->beConfig as $key => $config ) {
$list[$key] = new \Aimeos\MW\Criteria\Attribute\Standard( $config );
}
return $list;
}
/**
* Checks if payment provider can be used based on the basket content.
* Checks for country, currency, address, scoring, etc. should be implemented in separate decorators
*
* @param \Aimeos\MShop\Order\Item\Base\Iface $basket Basket object
* @return boolean True if payment provider can be used, false if not
*/
public function isAvailable( \Aimeos\MShop\Order\Item\Base\Iface $basket )
{
if( $basket->getLocale()->getLanguageId() === 'en' ) {
return $this->getProvider()->isAvailable( $basket );
}
return false;
}
}
has someone an idea?
LG - derju
Re: Delivery date in order process
Posted: 07 Jun 2017, 15:26
by aimeos
You've defined it as backend config instead of a frontend configuration.
Re: Delivery date in order process
Posted: 08 Jun 2017, 07:29
by derJu
thank's that's it!
next problem it show the code as label in frontend not the label from the config?
i tried:
Code: Select all
# Example for overwriting translations
plugin.tx_aimeos.settings.i18n.en.0 {
0 {
domain = client
string = Attributes
trans = Filter
}
1 {
domain = client
string = %1$d article
trans {
0 = %1$d
1 = %1$d
}
2 {
domain = client/code
string = swisspost
trans = Lieferdatum
}
}
}
Re: Delivery date in order process
Posted: 08 Jun 2017, 20:52
by aimeos
The label is only for internal use because you can't localize it. Therefore, the code is used which you can translate but your translation array is wrong. You have one index to much and your TS config is equal to
Code: Select all
plugin.tx_aimeos.settings.i18n.en.0.2.domain = client/code
but it must be
Code: Select all
plugin.tx_aimeos.settings.i18n.en.2.domain = client/code