hlucashlucas MitgliedKommentare: 0 Danke erhalten: 0 Mitglied seit: 6. Juli

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 : 

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 :

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 : https://files.fm/f/yk4kt8br

Does someone have a explanation for that error ? Thanks !

Anmelden oder Registrieren, um zu kommentieren.