# Use a Zend Module in a Plugin Subscriber

**URL:** <https://forum.shopware.com/t/use-a-zend-module-in-a-plugin-subscriber/53924>\
**Category:** International (English Only)\
**Created:** [6. Juli 2018 um 08:43 UTC](https://forum.shopware.com/t/use-a-zend-module-in-a-plugin-subscriber/53924 "2018-07-06T08:43:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hlucas](https://avatars.discourse-cdn.com/v4/letter/h/ee59a6/32.png) [@hlucas](https://forum.shopware.com/u/hlucas)\
**Post date:** [6. Juli 2018 um 08:43 UTC](https://forum.shopware.com/t/use-a-zend-module-in-a-plugin-subscriber/53924/1 "2018-07-06T08:43:44Z")

</div>

Hi Shopware Community,

We sell in our shop a lot of MP3 files. And we want to create a unique MP3 files for each order. In our former shop we use a Zend module (Zend\_Media\_Id3v2) to add a MP3 tag with a Encrypted Code which contains an orderID and a customerID.

For it, I created a Download plugin, and add a FrontendCheckoutSubscriber. You can see the code below :&nbsp;

```
define('DIR_FS_DOCUMENT_ROOT', 'custom/plugins/HomsymDownload/Subscriber/');
define('DIR_ZEND_FOLDER', 'custom/plugins/HomsymDownload/Subscriber/Zend/');
require 'custom/plugins/HomsymDownload/Subscriber/Zend/Media/Zend_Media_Id3v2.php';
require 'custom/plugins/HomsymDownload/Subscriber/Zend/Media/Id3/Frame/Encr.php';

class FrontendCheckoutSubscriber implements SubscriberInterface
{
   public static function getSubscribedEvents()
   {
       return [
           'Enlight_Controller_Action_PostDispatchSecure_Frontend_Checkout' => 'onControllerActionFrontendCheckoutFinishAction'
       ];
   }

   public function onControllerActionFrontendCheckoutFinishAction(\Enlight_Event_EventArgs $args)
   {
        /** @var $controller Enlight_Controller_Action */
        $controller = $args->getSubject();

        /** @var \Enlight_Controller_Request_Request $request */
        $request = $controller->Request();

        if ($request->getActionName() !== 'finish') {
          return;
        }

        //Some code here

        $id3 = new Zend\Media\Zend_Media_Id3v2($file);

        //Some code here

   }

 }

```

I put a Zend folder I use in our former shop with all the files necessary. Here is the file tree of the folder **custom/plugins/My\_plugin/Subscriber** :

 ![](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/2X/d/dc0c07cd688c9bf01189829e3bc5572009afe64b.png)

When I go to the /checkout/finish page after ordering an esd file, I get this error message :

> **Fatal error** : Cannot declare class Zend\_Media\_Id3v2, because the name is already in use in **/home/www/custom/plugins/HomsymDownload/Subscriber/Zend/Media/Zend\_Media\_Id3v2.php** on line **713**

I did a research into the code of my website to see if the class was declared many times but I found only one declaration in **/Zend/Media/Zend\_Media\_Id3v2.php.** I’ve also checked that there were only require\_once in the files of the modules. So, I don’t understand why it says that the class is already declared.

You can also fing a Zend folder archive here :&nbsp;[https://files.fm/f/yk4kt8br](https://files.fm/f/yk4kt8br)

Does someone have a explanation for that error ? Thanks !
