Generate PDF file and send mail - php

I tried to insert a custom button through the code in the page.php file for each product page in order to connect functionality to this button in the future. In the future, it should look like this: click on the button, call the window for sending by mail a generated pdf file with a photo gallery on this page (if this is even possible). I'm new to wordpress and not closely related to web development, but I have a task in front of me and I'm trying to find a solution. I've tried adding a button through the function.php file by hook woocommerce_after_single_product_summary and i did it. I have only button for every product page. this is my code
add_action('woocommerce_after_single_product_summary',function(){
printf('<button class="send_button">SEND PDF</button>');
}
);
But now after click on this button i need to call window for sending by mail generated pdf file (like pdf attachment with a photo gallery on this page). Please help me to suggest how I can do this without plugin. Thank you very much in advance.

Related

Download created pdf on load and redirect

I'm trying to make a product overview page where a user can download an invoice. However this invoice needs to be generated to the specific product.
At the moment the way i do this is to navigate to invoice.jsp which sends the ID to the server which in turn creates the invoice.pdf, after this is created the user can push a button to download the just created file.
However I would like to skip the last step and trigger the download as soon as the page is loaded and redirect back to the orderoveriew.jsp
Make an iframe on orderoveriew.jsp with the pdf code. Just remember to set
header('Content-Type: application/force-download');
and it will download automatically, other methods might not work with pop-up blockers.

Jquery Webcam Redirect after upload

I am new to JQuery and PHP, and I am trying to implement a jquery webcam in a site, I used this tutorial to implement one, http://tutorialzine.com/2011/04/jquery-webcam-photobooth/. I succesfully integrated it and the upload to file system works, My problem is how can I force redirect a page after clicking the upload button?
Any help will be greatly appreciated,
Use window.location = "http://....";
You have to place it in the function that "saves" and places the image in the grid because if you bind the Button just to redirect, it is possible that the image will not be saved

Need to create image from content of div

I want to create a programme that can
take text input from user and adjust anywhere in specific div
change font, fontcolor and size as per user selection
upload image as background
save whole customization and send as email
with help of PHP/JavaScript
Can anyone suggest how to do this.
Main issue is create image from user customization.
An existing programme to do this is also acceptable
I am programmer and working on php javascript magento
EDIT
Reading your description, it doesn't sound like you really need a screencapture-like version of the content the user created, you just need an HTML embedded editor and a way for someone to upload an image as the background with a way to preview the result. You can send emails with backgrounds using CSS.
(Not sure what you mean, but I presume you can figure this one out)
Use TinyMCE for an editor: http://tinymce.moxiecode.com/
Use jQuery AJAX file upload plugins (maybe http://www.uploadify.com/)
Submit the form (with the selected settings and edited html) to server and process as email
Try here for how to add an image to the background of an email:
http://www.campaignmonitor.com/blog/post/3170/adding-background-images-to-your-email-in-two-simple-steps/

API Upload file in Wordpress

I am not sure if Wordpress has API to upload file but what I am looking for is very simple:
Context: I have another plugin that I need to modify so that user can upload file in the Admin area of that plugin
Solution:
1. Rewrite a new upload thru some specific path. This has nothing to do with Wordpress. I am fine doing this.
2. I prefer to use existing Media upload feature or some Wordpress upload API. I read this post but it was problematic because I want to change the text title of "Insert to Post" to "Finish Upload".
http://www.webmaster-source.com/2010/01/08/using-the-wordpress-uploader-in-your-plugin-or-theme/
Can anyone help? Prefer to go with #2 but just need to change the text. How do I change it when it is a fanbox appearing when image button is clicked? And the "Insert to Post" doesn't come out until the image is done uploading. The issue is how to trigger a function to change that text when fancybox is shown and image uploading completed!!?
I put Post id into url and it solves problem

Jquery problem with plugin

I have PHP page where users can upload photos (using Ajax & PHP script). Those uploaded photos (thumbs) are shown after upload in DIV below upload field and fancybox plugin (I'm using it for popup window for photos) is working ok then.
Then, after hitting send button I want to clone that DIV at that same page at message board, bellow other messages with or without uploaded photos.
When I try to do that with:
var pht = $("#photos").clone().addClass('p_pht');
and try to display sent photos bellow sent message like this:
$("div#wall").append('<div class=msg>'+ message +'</div><div class=n_pht>'+ pht.html() +'</div>');
Fancybox plugin don't work. Only the link is working but not with popup window as it should be.
What am I doing wrong?
because you've changed the dom the fancybox plugin doesn't know the new elements exist. there are two ways of solving this.
Call the fancybox plugin again when you've finished adding elements
Use jquery live as answered here jquery live & livequery
Hope that helps.

Categories