Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-15455

Support for multiple shopaccounthandlers

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Obsolete
    • Icon: Medium Medium
    • Future
    • 4.1.3
    • Misc
    • None

    Description

      eZ Publish does not handle multiple shopaccounthandlers existing at the same time in one system. The problem is eZ Publish does not respect the accounthandler registered for the order.

      For instance, if you have several orders registered with different shopaccounthandlers, the shop/orderlist view will only display properly the ones that are registered with the (currently active?) shopaccounthandler.

      This can easily be fixed by mending eZShopAccountHandler::instance() to accept an order object as a parameter, and make use of the 'account_identifier' attribute found within the object.

      I've made a dirty hack to fix this, but this can probably be done better since I'm unsure what the eZExtension::findExtensionType() in eZShopAccountHandler::instance() actually does. In any case, I've modified the method to accept an $order variable containing the order object. This means that the calls to eZShopAccountHandler::instance() need to be updated to pass on the $order object, like in:

      eZOrder::accountInformation()
      eZOrder::accountName()
      eZOrder::accountEmail()

      …and any other occurrence that might exist.

      [hack]
      static function instance($order = false)
      {

      $accountHandler = null;
      if ( eZExtension::findExtensionType( array( 'ini-name' => 'shopaccount.ini',
      'repository-group' => 'HandlerSettings',
      'repository-variable' => 'Repositories',
      'extension-group' => 'HandlerSettings',
      'extension-variable' => 'ExtensionRepositories',
      'type-group' => 'AccountSettings',
      'type-variable' => 'Handler',
      'alias-group' => 'AccountSettings',
      'alias-variable' => 'Alias',
      'subdir' => 'shopaccounthandlers',
      'type-directory' => false,
      'extension-subdir' => 'shopaccounthandlers',
      'suffix-name' => 'shopaccounthandler.php' ),
      $out ) )
      {

      $customAccountHandlerExists = false;

      if($order)
      {
      foreach($out['repository-directory-list'] as $dir)
      {
      $accountHandlerFile = $dir . DIRECTORY_SEPARATOR . $order->attribute('account_identifier') . 'shopaccounthandler.php';
      if(file_exists($accountHandlerFile))

      { $customAccountHandlerExists = true; include_once($accountHandlerFile); $class = $order->attribute('account_identifier') . 'ShopAccountHandler'; $accountHandler = new $class(); }

      }
      }

      if(!$customAccountHandlerExists)

      { $filePath = $out['found-file-path']; include_once( $filePath ); $class = $out['type'] . 'ShopAccountHandler'; $accountHandler = new $class( ); }

      }
      else

      { $accountHandler = new eZDefaultShopAccountHandler(); }

      return $accountHandler;
      }
      [/hack]

      Attachments

        Activity

          People

            unknown unknown
            495f4094-ac4a-42b8-b5f6-d64d5508894c@accounts.ibexa.co Eirik Alfstad Johansen
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: