Questions around the TYPO3 integration and plugins as well as Flow and NeosCMS
Forum rules: Always add your TYPO3/Flow, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
#3474 by aimeos
02 Oct 2016, 13:53
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/Library/Service/Define_configuration

You can use the existing decorators as examples:
https://github.com/aimeos/aimeos-core/tree/master/lib/mshoplib/src/MShop/Service/Provider/Decorator

Here you can find how to configure your new decorator afterwards:
https://aimeos.org/docs/User_Manual/Administration_Interface/Service_decorators
#4308 by derJu
07 Jun 2017, 07:49
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
Attachments
Screen Shot 2017-06-07 at 09.42.23.png
Screen Shot 2017-06-07 at 09.42.23.png (12.81 KiB) Viewed 767 times
#4312 by derJu
08 Jun 2017, 07:29
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
    }
  }
}
#4313 by aimeos
08 Jun 2017, 20:52
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 allplugin.tx_aimeos.settings.i18n.en.0.2.domain = client/code

but it must be
Code: Select allplugin.tx_aimeos.settings.i18n.en.2.domain = client/code