X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Send to Friend on product pages. (https://forum.x-cart.com/showthread.php?t=216)

B00MER 11-24-2003 09:40 PM

Just wanted to say, rrf, I would be all for a "Send to Friend" module appearing in future versions of X-Cart. :wink:

BoomBoomBap 11-24-2003 10:59 PM

well this is a great mod.

would be nice to have

{$product.product|escape}
{$product.descr|truncate:255:"...":true}

Included in the email.
I tried this but couldnt wrap my head around it...

MER 11-25-2003 12:06 AM

Boomer, I did what you suggested but then I have this error.

Can't write template cache in the directory: /templates_c.
Please check if it exists, and have writable permissions.

I check my /templates_c folder rights and it has 777. Do you have any hints?

Tks,

Ming

B00MER 11-25-2003 12:14 AM

Updated sendtofriend.php file for 3.5.0 (this should do the trick 8-[ ):

Code:

<?php
#
# sendtofriend mod by www.cart-lab.com
#

require $xcart_dir."/smarty.php";
require $xcart_dir."/config.php";
require "./auth.php";
require $xcart_dir."/include/categories.php";

if($active_modules["Bestsellers"])
  include "../modules/Bestsellers/bestsellers.php";

$product_info = func_select_product($productid, $user_account['membership']);
$cat = $product_info["categoryid"];

$userinfo = func_userinfo($login,$login_type);

if ($REQUEST_METHOD=="POST") {

#    phpinfo(); exit();

#
# Send mail to support
#
  $HTTP_POST_VARS["body"] = stripslashes($HTTP_POST_VARS["body"]);

  while (list($key,$val) = each($HTTP_POST_VARS))
      $contact[$key]=$val;

    $fillerror = (empty($contact["firstname"]) || empty($contact["lastname"]) || empty($contact["email"]) || empty($contact["sendtoemail"]));

  if(!$fillerror) {
      $mail_smarty->assign("contact",$contact);

      #print $contact["sendtoemail"]; exit();

      func_send_mail($contact["sendtoemail"], "mail/sendtofriend_subj.tpl", "mail/sendtofriend.tpl", $contact["email"], true);

    $productid = $product_info['productid'];
      header("Location: sendtofriend.php?section=sendtofriend&productid=$productid");
      exit;

  } else {

      $userinfo = $HTTP_POST_VARS;
      $userinfo["login"] = $userinfo["uname"];

  }
}


$smarty->assign("userinfo",$userinfo);
$smarty->assign("fillerror",$fillerror);
$smarty->assign("main","sendtofriend");
$smarty->assign("help_section",$section);
$smarty->assign("location",$location);
$smarty->assign("product",$product_info);

$smarty->display("customer/home.tpl");

?>


MER 11-25-2003 12:58 AM

Hi Boomer,

Thank for you such speedy respone. After trying out the new sendtofriend.php, I was able to send out an email but the email subject line & message body look like below. It doesn't populate the data. Any solution to that. Thanks in advance! -Ming


{$contact.firstname} {$contact.lastname} has recommended a product to you.
{if $contact.body ne ""}

{$contact.body}

{/if}
Checkout the product link below for more details:
http://www.EntrustResources.com/store/customer/product.php?productid={$contact.productid}

{include file="mail/signature.tpl"}

B00MER 11-25-2003 01:06 AM

Updated in the post above previous.

various 12-01-2003 05:45 AM

Thanks for a great mod, just got a "little" error over here:

Warning: main(/smarty.php) [function.main]: failed to create stream: No such file or directory in /web/sites/mydir/mysite.com/shop/customer/sendtofriend.php on line 6

Fatal error: main() [function.main]: Failed opening required '/smarty.php' (include_path='.:/usr/local/lib/php') in /web/sites/mydir/mysite.com/shop/customer/sendtofriend.php on line 6


Anyone that got any ideas what could have caused this...??

jacobkball 12-01-2003 08:41 PM

Various,

To get around it, I had to put require $xcart_dir."../smarty.php"; instead of require $xcart_dir."/smarty.php";

Having said that, I am now stuck on "Can't write template cache in the directory: /templates_c. Please check if it exists, and have writable permissions" error message, which I can't for the life of me get rid of.

I don't know if you'll have the same problem.....

Regards

Jacob

jacobkball 12-01-2003 08:42 PM

Ok, I've GOT IT SORTED.

To get around it, you need to remove/comment out the lines require $xcart_dir."/smarty.php"; and require $xcart_dir."/config.php";

This has fixed the "Can't write template cache in the directory: /templates_c. Please check if it exists, and have writable permissions" error messages that I was getting.

Regards

Jacob

B00MER 12-02-2003 10:06 AM

To update for 3.5.0 if your getting a funny error of:
"Can't to find template engine!"

Edit the sendtofriend.php file and adjust the includes:

Code:

require "../smarty.php";
require "../config.php";
@include "./https.php";
require "./auth.php";
require "../include/categories.php";


replace with:

Code:

require $xcart_dir."/smarty.php";
require $xcart_dir."/config.php";
@include "./https.php";
require "./auth.php";
require $xcart_dir."/include/categories.php";


jacobkball 12-02-2003 01:56 PM

I had tried that, but then kept getting the error "Can't write template cache in the directory: /templates_c. Please check if it exists, and have writable permissions".

You need to remove these lines:

Code:

require $xcart_dir."/smarty.php";
require $xcart_dir."/config.php";
@include "./https.php";


as you'll notice that in the files X-Cart have updated, they have removed these lines also.

various 12-02-2003 11:25 PM

Quote:

Originally Posted by jacobkball
I had tried that, but then kept getting the error "Can't write template cache in the directory: /templates_c. Please check if it exists, and have writable permissions".

You need to remove these lines:

Code:

require $xcart_dir."/smarty.php";
require $xcart_dir."/config.php";
@include "./https.php";


as you'll notice that in the files X-Cart have updated, they have removed these lines also.


This worked for me, thanks for your time jacobkball & BOOMER! :D

leon 12-03-2003 05:27 AM

Wonder if there is any stable and straightforward code for this mod ?

laureon 12-11-2003 08:37 AM

Quote:

Wonder if there is any stable and straightforward code for this mod ?

I am successfully loading the 'sendtofriend.php' after implementing the appropriate fixes, but am receiving the following error when submitting the information on the sendtofriend page:

Warning: Failed to Receive in c:\www\xcart\include\func.php on line 269

Warning: Cannot add header information - headers already sent by (output started at c:\www\xcart\include\func.php:269) in c:\www\xcart\customer\sendtofriend.php on line 39

I am using v3.5.1 as opposed to v3.5.0, perhaps further fixes are required for v3.5.1? or it could be something i'm doing wrong :)

Lines 268-272 of my include/func.php:
Code:

if (preg_match('/([^ @,;<>]+@[^ @,;<>]+)/S', $from, $m))
                        mail($to,$mail_subject,$mail_message,$headers, "-f".$m[1]);
                else
                        mail($to,$mail_subject,$mail_message,$headers);
}


Lines 36-42 of customer\sendtofriend.php:
Code:

func_send_mail($contact["sendtoemail"], "mail/sendtofriend_subj.tpl", "mail/sendtofriend.tpl", $contact["email"], true);

    $productid = $product_info['productid'];
      header("Location: sendtofriend.php?section=sendtofriend&productid=$productid");
      exit;

  } else {


shan 12-11-2003 10:01 AM

make sure you dont have any blank spaces at the end of the .php files

leon 12-11-2003 11:11 AM

That is something I havent been able to explain to myself, why do spaces get involved in this ?

BCSE 12-20-2003 08:06 PM

I got this to work like a charm in 3.3.5. I think I got it working in 30 min or less. I used only what was said in page 1 from Boomer. I also added &partner=sendtofriend onto the URL for tracking purposes (and if Affiliate gets installed at a later date).

Great Mod Boomer! Thanks! I'll be buying something from your store soon for my appreciation! :)

Carrie
BTW: Going to add a nice button for it instead of a text link in a few days. No time now. :)

mustang 12-22-2003 10:47 PM

I'd love to get Boomer's 'Send to Friend' mod working in LiteCommerce. Anyone have any idea how to accomplish this? Please let me know...

B00MER 12-22-2003 10:54 PM

Unfortunatly I'm not too familiar with the template system lite commerce uses, not to mention ive not customized a lite commerce site yet. 8O

PhilJ 01-07-2004 08:31 AM

check boomer's site for this mod in the freebie section

shan 01-07-2004 08:37 AM

nice one phil 8)

leon 01-07-2004 09:33 AM

Quote:

Originally Posted by PhilJ
Got this working for v3.5.2

here's a send to friend mod kit if anyone's stuck - http://www.lordshipfurnishers.co.uk/xmods/Send_to_Friend_Mod_v352.zip

also a variation, which is a basic enquiry form that sends an email to support - http://www.lordshipfurnishers.co.uk/xmods/Enquire_Mod_v352.zip

:lol:


Hey, thanx alot, Im going to take a look and try it myself. Im on 3.5.2 myself. :wink:

And about the second option, what do you mean about that being a basic enquiry form to send email to support, in what circumstances ? Or is it something like "Send to Support" instead of "Send to Friend" ?

PhilJ 01-07-2004 10:02 AM

Leon, I've added some screenshots, see thread before

leon 01-07-2004 10:20 AM

Wow, very nice. Now I get it, the enquiry thing is like sending a message from a certain product that a prospect is interested in, something like using the contact form, but giving the prospect a helping hand.

So I assume that it also integrates into the existing style ?

B00MER 01-07-2004 01:57 PM

Cool to see someone has updated this mod for 3.5.x, kudos! By any chance could I put this up as a freebie on x-cart?

Let me know, thanks. ;)

PhilJ 01-07-2004 02:22 PM

That's fine Boomer :lol: Thanks for the code in the first place.

DataViking 01-08-2004 09:42 AM

Thanks for the code

Sailor 01-12-2004 07:21 PM

...great mod! Should support the author...how can I donate my Million stones???

B00MER 01-12-2004 09:20 PM

Donations via paypal:

:arrow: http://www.cart-lab.com/lab/customer/help.php?section=about

Every stone helps! :)

leon 01-19-2004 11:48 AM

Works great and smooth to the cart. I would suggest using localization on any and every custom mod where possible, currently Im trying to do this myself, but if it is added as a Freebie anywhere as BOOMER mentions, for International sake, use localization variables, otherwise people might not know what you are talking about there. :D

jeeya 01-20-2004 01:07 AM

Good Mod :D

How to Include Product Detail or description with image in it in mail?

thanks

seaCOAST 01-20-2004 09:57 AM

installation
 
I downloaded the updated "Send to Friend" mod from PhilJ's post (Thank-you!)...but there were no installation instructions. Do I just dump it into my x-cart dir. overwriting whatever may be there?

Thanks.

leon 01-20-2004 10:14 AM

Just follow the same structure presented in the files.

SMDStudios 03-24-2004 12:08 PM

I've attempted to install this mod and managed to get the bugs worked out till now...

Warning: Smarty error: unable to read template resource: "shop/home.tpl" in /home/httpd/vhosts/shopgspot.com/httpdocs/Smarty-2.5.0/Smarty.class.php on line 1042

I am using version: 3.5.4

B00MER 03-24-2004 01:31 PM

And when exactly do you get this error, sendtofriend.php ?

SMDStudios 03-24-2004 02:22 PM

Quote:

Originally Posted by B00MER
And when exactly do you get this error, sendtofriend.php ?


http://www.shopgspot.com/shop/sendtofriend.php?mode=update&productid=16135

:)

B00MER 03-24-2004 08:01 PM

If your using 3.5.x download philj's version of the mod for it to work properly:

http://www.lordshipfurnishers.co.uk/xmods/Send_to_Friend_Mod_v352.zip

SMDStudios 03-25-2004 07:18 AM

Quote:

Originally Posted by B00MER
If your using 3.5.x download philj's version of the mod for it to work properly:

http://www.lordshipfurnishers.co.uk/xmods/Send_to_Friend_Mod_v352.zip


Works great now! Hey I was looking through the code to see how I could CC or BC the admin on the emails that are sent. Any ideas?

laureon 03-29-2004 06:28 AM

Hi,

I have previosuly installed this mod on v3.5.3 without any problems. I have since performed a 'clean' install of v3.5.5 and installed the 'Send to Friend' mod in the same was as I had previously, however when the 'Send to Friend' page is loaded, it loads only a clean 'home.tpl' page, without including the 'sendtofriend.tpl' file. I have checked and double checked all components and am still having no success.

If anyone can recommend a resolution it would be appreciated.

thanks

B00MER 03-29-2004 07:24 AM

Make sure you have added the proper code to skin1/common_templates.tpl this is what calls the sendtofriend.tpl for the main area of the page.

hth. ;)


All times are GMT -8. The time now is 02:26 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.