0

I have some pdf file that is saved in the table named pdf_download the database name is loc_pos.

Need to download that file when I click.

<a href="http://domain.com/index.php?route=information/start_downloads&amp;name=<?php echo $category['name']; ?>&amp;download=drivers_manuals&amp;file=<?php echo $category['file']; ?>" target="_blank"><?php echo $category['name']; ?></a>

Output is:

http://domain.com/index.php?route=information/start_downloads&name=SENSORMATIC AMS 1140 SECURITY DETECTION&download=drivers_manuals&file=20140715164946.pdf

This script is not working.

I think the route is not working properly.

Can someone help me to get the correct code?

  • You donot follow magento routing logic. – Amit Bera Jun 7 '18 at 8:29
  • I know it's not magento routing logic.Plz help me with that.. Hope you can give me the correct code.. – Anandhu Vijayan Jun 7 '18 at 9:20
0
$block->getUrl('information/start_downloads', ['name' => $category['name'], 'download' => 'drivers_manuals', 'file' => $category['file']]);

This will create url with params. Of course, you need Magento Controller that returns file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.