X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   make send2friend a new form (https://forum.x-cart.com/showthread.php?t=17562)

pablo 10-27-2005 12:30 PM

make send2friend a new form
 
Hi,

I am trying to create an enquiry form on each product on the product detail page; ie product.tpl

I thought using send2friend as a base would be a good idea, as then it would include the productid each time, just need to change the send to email to send to me and add one text field.

However, my new send2friend2.tpl seems to get confused with the original, I can't separate them out - keeps saying that I have missed out the recipients name, even though I have removed it from my template along with the checking scripts.

While I know a bit about the templates, I don't think I know enough about the php files

I have added this line to product.php

include $xcart_dir.DIR_CUSTOMER."/send_to_friend.php";
include $xcart_dir.DIR_CUSTOMER."/send_to_friend2.php";

and then obviously duplicated one to the other.

What else do I need to do - what variables would I change,

Any pointers at all would be great, as I'm sure they would help me come up with the full solution.

shan 10-27-2005 04:19 PM

make sure the forms dont share the same name

pablo 10-28-2005 12:33 AM

Hi,

Many thanks for taking the time to reply - I think it is getting somewhere - but at the moment that somewhere is an access denied - error ID:33

I think it may be something to do with my new php script that I am calling from product.php.

This is just a duplicate of send2friend.php:

Code:

if ( !defined('XCART_START') ) { header("Location: home.php"); die("Access denied"); }

if(!$productid)
        func_header_location ("error_message.php?access_denied&id=48");

if($mode == 'send') {
        if($email && $from && $name) {
                $mail_smarty->assign ("product", $product_info);
                $mail_smarty->assign ("name", $name);
                func_send_mail ($email, "mail/send2friend_subj.tpl", "mail/send2friend.tpl", $from, false);
                $top_message["content"] = func_get_langvar_by_name("txt_recommendation_sent");
        } else {
                $top_message["content"] = func_get_langvar_by_name("err_filling_form");
                $top_message["type"] = "E";
        }
        func_header_location("product.php?productid=".$productid);
}

?>


It has references to Access denied (although one is ID:48 )

Is there anything else I should be changing here or adding somewhere?

Thanks

shan 10-28-2005 03:30 AM

Code:

  if($email && $from && $name)

notice there that it checks for active variables

pablo 10-28-2005 04:01 AM

Thanks, do these need to match then with the ones in the duplicate template:
customer/main/send2friend.tpl

perhaps in the Array at the top:

Code:

var requiredFields = new Array();
requiredFields[0] = new Array('send_name', "{$lng.lbl_send_your_name|strip_tags|replace:'"':'\"'}", false);
requiredFields[1] = new Array('send_from', "{$lng.lbl_send_your_email|strip_tags|replace:'"':'\"'}", false);
requiredFields[2] = new Array('send_to', "{$lng.lbl_sent_recipient_email|strip_tags|replace:'"':'\"'}", false);


I presume I need to remove the last one, as I am not asking for this to be inputted anymore?

Further, I am presuming in:
customer/home_main.tpl

I need to make this:

{elseif $main eq "send_to_friend2"}
{include file="customer/main/send_to_friend2.tpl"}

but am not sure how this ties in with the php, ie how is this $main variable defined?

shan 10-28-2005 04:03 AM

yeh,

remove anything that you dont need and make the change in home_main

the main variable gets created by the php files and used by the tpl files

junaid 03-11-2006 04:25 PM

this might help
http://forum.x-cart.com/viewtopic.php?t=27245


All times are GMT -8. The time now is 06:49 PM.

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