Prestashop 1.7 - handle a file uploading in a ModuleFrontController - prestashop

How to get file posted in form in ModuleFrontController? I've added a
<input type="file" name="fileUpload"/>
in form which hits a Controller. Normally values are get by
Tools::getValue(...)
like in Prestashop 1.7 documentation
Prestashop Front Controllers doc
but
$file = Tools::getValue('fileUpload')
returns false. How to reference to file which was posted in form and eventually save it in given path?

Related

Ionic 3 view PDF in content view with external URL

The application has to show invoice PDF inside <div> which is currently rendered in Webapp itself.
For example :
The web app already has the PDF generation functionality which generates by clicking on generate_pdf function.
I want to show the same PDF by using the same function which is currently available for the public.
Example URL:
http://URL/index.php/pulic/view/generate_invoice_pdf/Smgr4NX7yiWfu3J6qhdtRzF9lVT0kLs2
I have tried InAppBrowser however, it opens up outside the app just want to show inside the app.
DocumentViewer is not supported since it does not contain .pdf in URL
Anyone who needs the solution
I use fileTranfer to download the file and File to show it on the device.

Prestashop 1.7 disable cart poup

I am using prestashop 1.7 and want to disable the popup and instead call a custom javascript function that toggles my shopping cart visible.
I found various instructions, however I don't have a file called ps_shoppingcart.js. The only one I have is the ps_shoppinccart.tpl which contains the HTML template.
Can someone help me to find where I can do the toggle?
If you take a look at the code of the master file of the module (ps_shoppingcart.php), you will see in the hookHeader() that the ps_shoppingcart.js is skipped when the option "Ajax cart" is turned off, so, you can remove these validation to keep the JS file loaded and in the file every time and now you can add your custom code, the code which show the popup is this:
if (resp.modal) {
showModal(resp.modal);
}
Hope this help you!

prestashop 1.6 homefeatured cathgory not shown on frontpanel

When loading the prestashop 1.6 site mastercubestore.dk, the homefeatured cathegory is not loaded on front.
When jeg press the different link and goes back to news then it shows upĀ“.
How can i overcome this
The pane you want open by default needs to have an "active" class too. In you case that would be <ul id="blocknewproducts"> just add the active class to that element and it should be shown on page load

Prestashop 1.6 how to send shop logo in emails?

In older version of prestashop (1.4) I would use <img src="{shop_logo}">
but in current version (1.6.1.4) when I use this syntax it automatically turn it to <img src="http://t.clicktoamerica.com/admin1/{shop_logo}">
(ie it adds the shop domain and admin path)
and the logo is not displayed.
What is the correct syntax to add a logo in emails ?
EDIT
The syntax <img src="{shop_logo}"> is correct however because of a bug the domain is added when editing with the TinyMce editor, therefore a simple by-pass is to edit the emails html files directly (with external editor)
The question remain - how to solve this bug?
In js/admin/tinymce.inc.js
find the line: relative_urls:false and change it to relative_urls:true

Receiver of Upload Button Vaadin

I am trying to upload a file. It uploads fine, but while uploading it shows all file. I want to restrict to only selected files like pdf,jpg and jpeg files.
I need to while uploading a file when a browser window open that time only these files are visible remaining file should be hide. So that user is not able to select wrong file.
Can anyone tell me how can I do this?
I am using Vaadin 7.5.1 and Upload component and a Receiver.
The current Vaadin Upload component does not support this. There's an enhancement request for it which would be dead easy for Vaadin Inc (or a contributor) to implement now that all the major browsers support this functionality.
Here's the technical explanation: The Vaadin Upload component creates HTML like this:
<input type="file" name="foo">
but what you would have liked it to produce would be something like this:
<input type="file" name="foo" accept=".pdf,.jpg,.jpeg">
Here's how the above HTML will look in Firefox:
Basically the accept attribute will tell the browser to open a file selection dialog with a certain filter.
Note that this is a client-side thing. It doesn't prevent a savvy end user from uploading something that doesn't match your filter to your server. That goes for any kind of filtering done on the client-side no matter how it is done. For this reason you'll still need some server-side validation as well.
Piece of cake with JavaScript - you just have to check into the HTML source of page where that button/browse field is placed to find actuall class name of generated html element - this is example for .csv, Vaadin generates class name titled "gwt-FileUpload", so you have to set it like this to see only .csv files after clicking on "Import" button:
upload.setButtonCaption("Import");
JavaScript.getCurrent().execute("document.getElementsByClassName('gwt-FileUpload')[0].setAttribute('accept', '.csv')");
Add this dependency to your pom file
<dependency>
<groupId>com.wcs.wcslib</groupId>
<artifactId>wcslib-vaadin-widget-multifileupload</artifactId>
<version>1.10</version>
</dependency>
And use the following code to upload files, set filter using setAcceptFilter method:
UploadStateWindow uploadStateWindow = new UploadStateWindow();
uploadStateWindow.setOverallProgressVisible(true);
MultiFileUpload fileUpload = new MultiFileUpload(uploadFinishedHandler,
uploadStateWindow, true);
fileUpload.setAcceptFilter(".png,.jpg");
fileUpload.setImmediate(true);
fileUpload.getSmartUpload().setUploadButtonCaptions("upload", "upload");