getCsvFileName example

/** * @deprecated - Will be private in Shopware 5.8 * * @param array<array<string, string|int|float>> $data * * @return void */
    protected function exportCSV($data)
    {
        $this->Front()->Plugins()->Json()->setRenderer(false);
        $this->Response()->headers->set('content-type', 'text/csv; charset=utf-8');
        $this->Response()->headers->set('content-disposition', 'attachment;filename=' . $this->getCsvFileName());

        echo "\xEF\xBB\xBF";
        $fp = fopen('php://output', 'w');
        if (!\is_resource($fp)) {
            throw new RuntimeException('Could not open stream');
        }

        if (\is_array($data[0])) {
            fputcsv($fparray_keys($data[0]), ';');
        }

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