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)
-   -   Adding a "How Did You Hear About Us" ?? (https://forum.x-cart.com/showthread.php?t=2279)

dawing 08-19-2003 09:26 PM

Drop Down
 
Has anyone added a drop down box to this?

Thanks!

neroag 02-15-2006 05:40 AM

Useful little mod but copying the files doesnt work in 4.0.13 so if its useful to anyone these are the mods for 4.0.13.

Quote:

kpriest wrote:
use the Patch/Upgrade area of your xcart admin - at the bottom of the screen, paste this code into the Query box and click Apply:
Code:
ALTER TABLE `xcart_customers` ADD `hear` VARCHAR(255) NOT NULL;

Add the lbl_how_heard variable to the languages

in include/register.php

Find ..
Code:

db_query("UPDATE $sql_tbl[customers] SET password='$crypted', password_hint='$password_hint', password_hint_answer='$password_hint_answer', title='$title', firstname='$firstname', lastname='$lastname', company='$company', b_address='".$b_address."\n".$b_address_2."', b_city='$b_city', b_county='".(@$b_county)."', b_state='$b_state', b_country='$b_country', b_zipcode='$b_zipcode', s_address='".$s_address."\n".$s_address_2."', s_city='$s_city', s_county='".(@$s_county)."', s_state='$s_state', s_country='$s_country', s_zipcode='$s_zipcode', phone='$phone', email='$email', fax='$fax', url='$url', card_name='$card_name', card_type='$card_type', card_number='".addslashes(text_crypt($card_number))."', card_expire='$card_expire', card_cvv2='$card_cvv2', pending_membership='$pending_membership', ssn='$ssn', change_password='$change_password', parent = '$parent', pending_plan_id = '$pending_plan_id' WHERE login='$login' AND usertype='$login_type'");
Change to..
Code:

db_query("UPDATE $sql_tbl[customers] SET password='$crypted', password_hint='$password_hint', password_hint_answer='$password_hint_answer', title='$title', firstname='$firstname', lastname='$lastname', company='$company', b_address='".$b_address."\n".$b_address_2."', b_city='$b_city', b_county='".(@$b_county)."', b_state='$b_state', b_country='$b_country', b_zipcode='$b_zipcode', s_address='".$s_address."\n".$s_address_2."', s_city='$s_city', s_county='".(@$s_county)."', s_state='$s_state', s_country='$s_country', s_zipcode='$s_zipcode', phone='$phone', email='$email', fax='$fax', url='$url', card_name='$card_name', card_type='$card_type', card_number='".addslashes(text_crypt($card_number))."', card_expire='$card_expire', card_cvv2='$card_cvv2', pending_membership='$pending_membership', ssn='$ssn', change_password='$change_password', parent = '$parent', pending_plan_id = '$pending_plan_id', hear='$hear' WHERE login='$login' AND usertype='$login_type'");
Find ..
Code:

db_query("INSERT INTO $sql_tbl[customers] (login,usertype,password,password_hint,password_hint_answer,title,firstname,lastname,company,b_address,b_city,b_county,b_state,b_country,b_zipcode,s_address,s_city,s_county,s_state,s_country,s_zipcode,phone,email,fax,url,card_name,card_type,card_number,card_expire,card_cvv2,first_login,status,referer,pending_membership,ssn,parent,pending_plan_id,change_password) VALUES ('$uname','$usertype','$crypted','".@$password_hint."','".@$password_hint_answer."','$title','$firstname','$lastname','$company','".$b_address."\n".$b_address_2."','$b_city','".(@$b_county)."','$b_state','$b_country','$b_zipcode','".$s_address."\n".$s_address_2."','$s_city','".(@$s_county)."','$s_state','$s_country','$s_zipcode','$phone','$email','$fax','$url','".@$card_name."','".@$card_type."','".addslashes(text_crypt(@$card_number))."','".@$card_expire."','".@$card_cvv2."','".time()."','Y','".@$RefererCookie."','".@$pending_membership."','".@$ssn."', '$parent', '$pending_plan_id','$change_password')");
Change to..
Code:

db_query("INSERT INTO $sql_tbl[customers] (login,usertype,password,password_hint,password_hint_answer,title,firstname,lastname,company,b_address,b_city,b_county,b_state,b_country,b_zipcode,s_address,s_city,s_county,s_state,s_country,s_zipcode,phone,email,fax,url,card_name,card_type,card_number,card_expire,card_cvv2,first_login,status,referer,pending_membership,ssn,parent,pending_plan_id,change_password,hear) VALUES ('$uname','$usertype','$crypted','".@$password_hint."','".@$password_hint_answer."','$title','$firstname','$lastname','$company','".$b_address."\n".$b_address_2."','$b_city','".(@$b_county)."','$b_state','$b_country','$b_zipcode','".$s_address."\n".$s_address_2."','$s_city','".(@$s_county)."','$s_state','$s_country','$s_zipcode','$phone','$email','$fax','$url','".@$card_name."','".@$card_type."','".addslashes(text_crypt(@$card_number))."','".@$card_expire."','".@$card_cvv2."','".time()."','Y','".@$RefererCookie."','".@$pending_membership."','".@$ssn."', '$parent', '$pending_plan_id','$change_password','$hear')");
Find ..
Code:

$profile_modified_data[$user] = $userinfo;
add directly below it ..
Code:

$userinfo[hear]=stripslashes($hear);

in include/func.php

Find..
Code:

$mail_smarty->assign("userinfo",$order_data["userinfo"]);

Directly below it add..
Code:

$ha_result = func_query_first ("SELECT hear FROM xcart_customers WHERE login='$userinfo[login]'");
$hearabout = $ha_result ["hear"];
$mail_smarty->assign("hearabout",$hearabout);


in skin1/customer/main/

Find ..
Code:

{include file="main/register_personal_info.tpl" userinfo=$userinfo}

Directly below it add..
Code:

{* Added How Heard Here *}
<tr valign=middle>
<td align=right>{$lng.lbl_how_heard}</td>
<td></td>
<td nowrap>
<input type=text name=hear size=32 maxlength=255 value="{$userinfo.hear}">
</td>
</tr>
{*----------------------*}


Thats the mod completed, if you want it to appear on the admin email received after a sale add the following ..

in skin1/mail/order_notification_subj.tpl
After line ..
Code:

{config_load file="$skin_config"}{ $config.Company.company_name }: {$lng.lbl_order} #{$order.orderid} {$lng.eml_notification}

Add..
Code:

{$lng.lbl_how_heard}:    {$hearabout}

I take no credit for this mod i just made it work on Version4.0.13, thanx to you guys that made it

B00MER 02-15-2006 06:25 AM

:!: Just wanted to note that this can now be done with the custom fields that are built-in in version 4.0.x of X-Cart. You can find it in General Settings->User Profile options. :wink:

neroag 02-15-2006 07:07 AM

:oops: Thanx BOOMER, Errmmm Yup that would have been a simpler solution 8O, lol

Lionel 02-23-2006 06:18 PM

Please how to make those extra fields bi lingual?

hamid 04-24-2007 02:07 AM

Re: Adding a "How Did You Hear About Us" ??
 
Just a quick update to this.

After you add the custom fields using General Settings > User Profile Options, you may want it to appear on your order pages (admin side) so that you can see where customers have come from when you come to process the orders.

Open: skin1/main/history_order.tpl

Find:

{if $usertype eq "A"}
{$lng.lbl_status}: {include file="main/order_status.tpl" status=$order.status mode="select" name="status"}
<P>

Change it to:

{if $usertype eq "A"}
{$lng.lbl_status}: {include file="main/order_status.tpl" status=$order.status mode="select" name="status"}
<br><br>
{foreach from=$customer.additional_fields item=v}
{if $v.section eq 'A'}
{if $is_header ne 'Y'}
{/if}
{$v.value}
{/if}
{/foreach}
<P>

That's it!

Now, when a new customer registers and places an order you will be able to see where that customer has come from when you view their order in the admin section. (It appears underneath the dropdown menu called 'Status', and above the 'Tracking Number' text box)

This was tested on 4.0.16, but should be fine with other versions too.

Hayles 04-27-2007 07:17 PM

Re: Adding a "How Did You Hear About Us" ??
 
Done now, thanks.

sunset 09-25-2007 12:36 AM

Re: Adding a "How Did You Hear About Us" ??
 
Thanks for this info.

I have version 4.1.8. I looked in the file skin1/main/history_order.tpl
but couldnt quite see the same information.

Is there any chance that i could have the "how did you hear about us" script for my version.

Cheers

mitash 09-25-2007 02:50 AM

Re: Adding a "How Did You Hear About Us" ??
 
you don't need a script ...why don't u just add an extra field and have a select box with the options..?

sunset 09-25-2007 03:22 AM

Re: Adding a "How Did You Hear About Us" ??
 
Thanks Mitash, i think i have figured it now via your method.

Is there any way that we can pull this information received from customers, into statistics?


All times are GMT -8. The time now is 08:09 AM.

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