getOrderLocaleId example

$zendAttachment = new Zend_Mime_Part($content);
        $zendAttachment->type = 'application/pdf';
        $zendAttachment->disposition = Zend_Mime::DISPOSITION_ATTACHMENT;
        $zendAttachment->encoding = Zend_Mime::ENCODING_BASE64;
        $zendAttachment->filename = $fileName;

        return $zendAttachment;
    }

    private function getFileName(int $orderId, int $typeId): string
    {
        $localeId = $this->getOrderLocaleId($orderId);

        $translationReader = $this->container->get(Shopware_Components_Translation::class);
        $translations = $translationReader->read($localeId, 'documents', $typeId, true);

        if (empty($translations) || empty($translations['name'])) {
            return $this->getDefaultName($typeId) . '.pdf';
        }

        return $translations['name'] . '.pdf';
    }

    
Home | Imprint | This part of the site doesn't use cookies.