Jump to content

Invoice/Order confirmation


keat

Recommended Posts

Guys.

I've added the "Company Details" field to the registration and profile of my site, but I'd like the company info to also show up on the order confirmation that we receive when a customer places an order.

I guess it's just a matter of adding the particular database field to the order confirmation.. but which file handles sends the order confirmation to our inbox.

Thanks in advance

Keat

Link to comment
Share on other sites

Folks. sorry to bump this, but resolving this issue, would be a great help for me if I could get it done this week.

I just need to know, which file executes the "Sale Confirmation" email.. as below, I'm guessing I could figure the rest out myself.

> Dear CubeCart Store Administrator,

>

> New Order Number: 090715-151908-6168 placed on Jul 15 2009, 15:19 PM

>

> ~~~~~~~~~~~~~~~~~~~~~~~~~~

> Name: mr John Doe

> E-Mail: [email protected]

> Subtotal: £14.70

> Postage & Packaging: £3.95

> Tax: £2.80

> Grand Total: £21.45

> ~~~~~~~~~~~~~~~~~~~~~~~~~~

>

> Invoice Address:

> mr John Doe

> unit 3 xxxxx

> xxxxxxx, west felton

> nr oswestry

> shropshire

> sy11 xxx

> United Kingdom

>

> Shipping Address:

> mr John Doe

> unit 3 xxxxx

> xxxxxxx, west felton

> nr oswestry

> shropshire

> sy11 xxx

> United Kingdom

>

> Payment Method: PayPal

> Shipping Method: Free for Orders Over 45 ~~~~~~~~~~~~~~~~~~~~~~~~~~

>

>

> Order Inventory:

> Product: Blue Female Spade 4.8mm Fully Insulated

> Options: Order - 100

> Quantity: 2

> Product Code: WT11

> Price: £6.30

Link to comment
Share on other sites

Guest MasterSites

Guys.

I've added the "Company Details" field to the registration and profile of my site, but I'd like the company info to also show up on the order confirmation that we receive when a customer places an order.

I guess it's just a matter of adding the particular database field to the order confirmation.. but which file handles sends the order confirmation to our inbox.

Thanks in advance

Keat

Hi Keat,

The file that sends out the emails is the "orderSucess.inc.php" file which is located in:

your-store-setup-files/includes/orderSuccess.inc.php

however in order to achieve what you want it to achieve quite rightly you will have to add the fileds to the database - but there is a bit more work involved than just adding new fields. what you will need to do in order to get it completely working is as follows:

Add the Company Details field to the database,

Write the companies details to the database at the same time as CubeCart writes the information to the database about the customer. So this would be in the registration file.

Then inside the orderSuccess.inc.php you will need to modify the MySQL statement to tell it to also select the Company_Details field

Once the MySQL field is modified you will need to add the contents of the Company_Details field the body of the email in the same way cubecart adds the other information.

Alternatively what you could do is get the customer to input there company details into the Company Details box every time they place a new order - Then write the contents of the Company Details box to a session cookie or querystring and pick either up inside the orderSucess.inc.php page.

I would recommend the first method.

Thanks

Rob

Link to comment
Share on other sites

Guys.

I've added the "Company Details" field to the registration and profile of my site, but I'd like the company info to also show up on the order confirmation that we receive when a customer places an order.

I guess it's just a matter of adding the particular database field to the order confirmation.. but which file handles sends the order confirmation to our inbox.

Thanks in advance

Keat

Hi Keat,

The file that sends out the emails is the "orderSucess.inc.php" file which is located in:

your-store-setup-files/includes/orderSuccess.inc.php

however in order to achieve what you want it to achieve quite rightly you will have to add the fileds to the database - but there is a bit more work involved than just adding new fields. what you will need to do in order to get it completely working is as follows:

Add the Company Details field to the database,

Write the companies details to the database at the same time as CubeCart writes the information to the database about the customer. So this would be in the registration file.

Then inside the orderSuccess.inc.php you will need to modify the MySQL statement to tell it to also select the Company_Details field

Once the MySQL field is modified you will need to add the contents of the Company_Details field the body of the email in the same way cubecart adds the other information.

Alternatively what you could do is get the customer to input there company details into the Company Details box every time they place a new order - Then write the contents of the Company Details box to a session cookie or querystring and pick either up inside the orderSucess.inc.php page.

I would recommend the first method.

Thanks

Rob

Hi Rob.

Thanks for the reply. Company details are being passed to the database upon registration, and can actually see them in the admin control panel "View Customers", but they are not being posted in the confirmation email.

The people who input the data from cubecart into our invoicing system are not particularly IT savvy, so I'd rather they didn't have to open the admin control panel, just to find the comapny name.

I can see all sorts of problems occuring.

Now I know which file I'm looking at, I can continue playing.

Thank You..

Of course I'll keep you posted

Link to comment
Share on other sites

I had an hour or so playing with orderSuccess.php, but didn't really get anywhere.

I'm sort of guessing i need to modify the following lines, (in red) and I thought I was OK with SQL, but I'm not as clever as I thought i was.

$query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_order_sum INNER JOIN ".$glob['dbprefix']."CubeCart_customer ON ".$glob['dbprefix']."CubeCart_order_sum.customer_id = ".$glob['dbprefix']."CubeCart_customer.customer_id WHERE ".$glob['dbprefix']."CubeCart_order_sum.cart_order_id = ".$db->mySQLSafe($cart_order_id);

(add something along the lines SELECT from Cubecart_Customers.company)

$order = $db->select($query);

include_once($glob['rootDir']."/includes/currencyVars.inc.php");

$text = sprintf($lang['front']['orderSuccess']['inv_email_body_1'],

$order[0]['name'],

$cart_order_id,

formatTime($order[0]['time']),

$order[0]['name'],

priceFormat($order[0]['subtotal']),

priceFormat($order[0]['total_ship']),

priceFormat($order[0]['total_tax']),

priceFormat($order[0]['prod_total']),

$order[0]['company'],

$order[0]['name'],

$order[0]['add_1'],

$order[0]['add_2'],

$order[0]['town'],

$order[0]['county'],

$order[0]['postcode'],

countryName($order[0]['country']),

$order[0]['name_d'],

$order[0]['add_1_d'],

$order[0]['add_2_d'],

$order[0]['town_d'],

$order[0]['county_d'],

$order[0]['postcode_d'],

$order[0]['country_d'],

str_replace("_"," ",$order[0]['gateway']),

str_replace("_"," ",$order[0]['shipMethod']));

Link to comment
Share on other sites

I had an hour or so playing with orderSuccess.php, but didn't really get anywhere.

I'm sort of guessing i need to modify the following lines, (in red) and I thought I was OK with SQL, but I'm not as clever as I thought i was.

$query = "SELECT * FROM ".$glob['dbprefix']."CubeCart_order_sum INNER JOIN ".$glob['dbprefix']."CubeCart_customer ON ".$glob['dbprefix']."CubeCart_order_sum.customer_id = ".$glob['dbprefix']."CubeCart_customer.customer_id WHERE ".$glob['dbprefix']."CubeCart_order_sum.cart_order_id = ".$db->mySQLSafe($cart_order_id);

(add something along the lines SELECT from Cubecart_Customers.company)

$order = $db->select($query);

include_once($glob['rootDir']."/includes/currencyVars.inc.php");

$text = sprintf($lang['front']['orderSuccess']['inv_email_body_1'],

$order[0]['name'],

$cart_order_id,

formatTime($order[0]['time']),

$order[0]['name'],

priceFormat($order[0]['subtotal']),

priceFormat($order[0]['total_ship']),

priceFormat($order[0]['total_tax']),

priceFormat($order[0]['prod_total']),

$order[0]['company'],

$order[0]['name'],

$order[0]['add_1'],

$order[0]['add_2'],

$order[0]['town'],

$order[0]['county'],

$order[0]['postcode'],

countryName($order[0]['country']),

$order[0]['name_d'],

$order[0]['add_1_d'],

$order[0]['add_2_d'],

$order[0]['town_d'],

$order[0]['county_d'],

$order[0]['postcode_d'],

$order[0]['country_d'],

str_replace("_"," ",$order[0]['gateway']),

str_replace("_"," ",$order[0]['shipMethod']));

Having had another hour again today, I'm still none the wiser.

Looking at the SQL query at the top, I guess the query is looking at the table "Customer", otherwise it wouldn't know where to pull the customer data from.. so why when I add the additional field "$order[0]['company']," does it not include the company details in the confirmation email.

The data is there in the Database, and can be clearly seen from Cubecart admin "View Customer".

I've also included it in the "Great News..........Company Registration" email

I'm obviously missing something fundamental but what.

Link to comment
Share on other sites

I give in.

I'll pay someone to do this for me..

Unfortunately, when I do get to the bottom of it, It would be unfair of me to divulge how it's done.

Thanks to those who answered, thanks to those who thought about it.

Link to comment
Share on other sites

Thanks for the reply. Company details are being passed to the database upon registration, and can actually see them in the admin control panel "View Customers", but they are not being posted in the confirmation email.

$query = "SELECT * FROM

$text = sprintf($lang['front']['orderSuccess']['inv_email_body_1'],

priceFormat($order[0]['prod_total']),

$order[0]['company'],

$order[0]['name'],

I've copied various parts of your past messages to assist:

Seeing the custom registration data in the View Customers admin screen implies you have successfully installed a "Custom Registion Info" modification of some sort. As such, the custom data is getting saved to the _customer table. What you now need to determine is the accurate table column name holding the desired data (Company Name may be in a column called 'companyName' or maybe 'customData1'. You will need to look directly at the Cubecart database _customers table.)

The query is fetching ALL data (the asterisk), so there's no need to specifically ask for the new column(s) *unless* the new data is in a separate table - but it doesn't sound like it.

The sprintf() function calls a string template from your language file. In the file /language/yourlanguage/lang.inc.php, look for the array $lang['front']['orderSuccess']['inv_email_body_1']. (It's a huge file, look carefully.) The string template will have lots of %s placeholders. You will need to add more text to the template where you want the Company Name to appear, followed by a placeholder. For example: Company Name: %s.

It is critically important that the order and count of data items (..., total price, company, name, ...) align accurately with the string template and number of placeholders as sprintf() replaces the first placeholder with the first item of data in the sprintf() list ('name' in this case) and proceeds on from there.

I hope I've given you more clues to solve your issue.

Link to comment
Share on other sites

Thanks for the reply. Company details are being passed to the database upon registration, and can actually see them in the admin control panel "View Customers", but they are not being posted in the confirmation email.

$query = "SELECT * FROM

$text = sprintf($lang['front']['orderSuccess']['inv_email_body_1'],

priceFormat($order[0]['prod_total']),

$order[0]['company'],

$order[0]['name'],

I've copied various parts of your past messages to assist:

Seeing the custom registration data in the View Customers admin screen implies you have successfully installed a "Custom Registion Info" modification of some sort. As such, the custom data is getting saved to the _customer table. What you now need to determine is the accurate table column name holding the desired data (Company Name may be in a column called 'companyName' or maybe 'customData1'. You will need to look directly at the Cubecart database _customers table.)

The query is fetching ALL data (the asterisk), so there's no need to specifically ask for the new column(s) *unless* the new data is in a separate table - but it doesn't sound like it.

The sprintf() function calls a string template from your language file. In the file /language/yourlanguage/lang.inc.php, look for the array $lang['front']['orderSuccess']['inv_email_body_1']. (It's a huge file, look carefully.) The string template will have lots of %s placeholders. You will need to add more text to the template where you want the Company Name to appear, followed by a placeholder. For example: Company Name: %s.

It is critically important that the order and count of data items (..., total price, company, name, ...) align accurately with the string template and number of placeholders as sprintf() replaces the first placeholder with the first item of data in the sprintf() list ('name' in this case) and proceeds on from there.

I hope I've given you more clues to solve your issue.

Hi.

Yes I have implimented company details upon registration. They appear in a new field called "company" in the "Customer" table. They appear upon registration, in the admin panel, they can also be seen in the database, so that part is working OK.

Getting them on the "Order Confirmation" email, is just proving a little too tricky for my knowledge level.

This morning, I set the wheels in motion to have this done by someone who understands Cubecart (PHP) better than I do.

I had been given very similar information by the chap who's doing the work for me, but having spent a good few hours again last night, I finally submitted and gave in.

Thanks for the reply

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...