Jump to content

[Solved]How to send the link to the attachment file by mail


kerlin

Recommended Posts

Hello, with PS 1.6.1.16, if a document is attached at a product, there is a button to download it in the data sheet of the product, in Download section.

 

I wish to change the button : after clicking on a button a popup asks the name and the e-mail address. When the visitor send them, he receive a mail with the link to download the attachment.

 

I tried with a button and a form in product.list. 
For the link, I got :

<input type="hidden" name="message" value="<a href="{$link->getPageLink('attachment', true, NULL, "id_attachment={$attachment.id_attachment}")|escape:'html'}">{$attachment.name|escape:'htmlall':'UTF-8'}</a>"

but the result displaying in the mail is =<a href

 

Could you help me ?

 

I tried also 

msg="";
$url=$_SERVER['HTTP_REFERER'];
$str2 = substr($url, 54);
$id=substr($str2, 0, -19);
$query = "SELECT id_attachment FROM echps1_product_attachment WHERE id_product = '$id'";
$data=mysqli_query($con,$query); 
while($row=mysqli_fetch_array($data)){
    
    $msg=$row['id_attachment'];
}
$name = $_POST['name'];
$email = "[email protected]";

$formcontent="http://www.mysite.com/index.php?controller=attachment&id_attachment="".$id";
$recipient = $_POST['email'];
$subject = "download";
$mailheader = "From: $email \r\n";
$sent=mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
var_dump($msg);

With this the result is http://www.mysite.com/copie_tests/index.php?controller=attachment&id_attachment=p?id_product=8

 

and not http://www.mysite.com/copie_tests/index.php?controller=attachment&id_attachment=1 where 1 = id_attacment for id_produit=8

 

If you have an idea ? ...

 

thanks a lot !

Edited by kerlin (see edit history)
Link to comment
Share on other sites

Thanks for your reply Scully ! You're right ! The problem becam form the double quotes. But it didn't work first because I replaced all double by simple quotes. So it cannot read the id_attachment.

The good result is :

												 <input type="hidden"
name="message" value="<a href='{$link->getPageLink('attachment', true, NULL, "id_attachment={$attachment.id_attachment}")|escape:'html'}'>{$attachment.name|escape:'htmlall':'UTF-8'}</a>{$attachment.description|escape:'htmlall':'UTF-8'}"
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...