Add notify email link to product descriptions
This mod will add a link to an item description. A customer can click that link to open an email and send a request to the store owner regarding that item. (See also: Add notify email link to out of stock items)
-
Open the products_variables.php file in the /enc/ folder.
-
Just under the code:
function var_description($vardescript, $varimgdir, $varthumbdir, $varlgdir, $varcatdir, $varisdiv) {add:
global $urldir, $searchrow, $Site_Name, $Admin_Email;
-
A little way down, find the code:
return $vardispdescription;
and just above that code, add:
// EMAIL LINK ABOUT ITEM $varitemid = $searchrow[ID]; $varitemname = stripslashes($searchrow[Item]); $varemailsubject = "$Site_Name Item Question"; $varitemlink = doItemLink($varitemname, $varitemid, "auto"); $varemailtitle = "Questions about this item?"; $varemailbody = "I have a question about the item%0D%0A%0D%0A$varitemname%0D%0A$varitemlink"; $varemail_subject = str_replace(" ", "%20", $varemailsubject); $varemail_body = str_replace(" ", "%20", $varemailbody); $vardispdescription .= ""; -
Optional! Change any of the following, if desired:
-
Link text: To change the link text, change the line:
$varemailtitle = "Questions about this item?";
changing the text within the quotes to whatever you'd like.
Alternately, you can use HTML (including images), as in:
$varemailtitle = "
";Notice that you must add a back slash in front of each double quote within your HTML code.
-
Subject: To change the subject of the email, change the line:
$varemailsubject = "$Site_Name Item Question";
changing the text within the quotes to whatever you'd like.
Note that you can use $Site_Name to represent the web site's name. (This will pull whatever name is set in the store admin area.)
-
Body: To change the body of the email, change the line:
$varemailbody = "I have a question about the item%0D%0A%0D%0A$varitemname%0D%0A$varitemlink;
changing the text within the quotes to whatever you'd like. Use %0D%0A to represent a line break.
Note that $varitemname represents the name of the item, and $varitemlink represents a link to the item on your site.
-
-
Save and reload the file.