How to send an e-mail for each item in the order basket

Author Message

Luc Chase

Thursday 16 October 2003 7:49:25 am

I need to send an e-mail notice for each item in the confirmed order basket to the owner of the node-product orderded ( {$Basket:ProductItem:item.item_object.contentobject.main_node.contentobject_version_object.creator.data_map.user_account.content.email} ).
I'm hoping to get some hints on how to do this from the default .php script file that sends the order confirmation.

ezshopoperationcollection.php seems to be the one, but I can't figure out how to reference the above value from there and how to loop through the items in the basket to send a copy of the order to the creator of the product (filtered to show only the ordered product they created).

The Web Application Service Provider

Luc Chase

Monday 27 October 2003 4:24:02 am

Ok I've been trying to work this out for two weeks now and I don't want to wait much longer... I've posted a $25 bounty on getting the answer quickly at http://answers.google.com/answers/threadview?id=270037
I'm sure it's easy if you know how.

The Web Application Service Provider

Paul Forsyth

Monday 27 October 2003 5:20:56 am

Have you considered using workflow for this?

Are you intending to take the user to a payment gateway after the order is confirmed, or just send an email?

paul

Luc Chase

Monday 27 October 2003 10:04:21 am

I had a look at the workflow to see if I could achieve this there, but I couldn't find anything that looked like it might work. Right now with no workflow the system does everything I need except the extra e-mails to the suppliers/creators of the products. The customer will not be making any payment for the products they have chosen; they will simply wait to be contacted by the supplier(s) of the product(s) they have chosen; so no payment gateway to deal with, just send the two normal e-mails (to the shopkeeper and the customer) plus one e-mail to each of the product 'owners'/creators to send them their part of the order so they can contact the customer.

The Web Application Service Provider

Luc Chase

Wednesday 29 October 2003 5:42:59 am

Paul,
I was getting all excited that you might be about to suggest a solution... is workflow the way to solve this?

The Web Application Service Provider

Paul Forsyth

Wednesday 29 October 2003 6:03:43 am

Sorry, was busy ;)

You need to write a workflow event that will send the email after you checkout your list. If you know php it isn't too diffficult. But learning can be time consuming.

You should set up a new workflow. Then in the trigger section associate your new workflow with 'shop checkout before'. The aim here is to execute some specific code when your client checkouts, in your case this will be to send an email.

To go through with this you need to write a workflow event that will take the order and send the email. Once you have this event you can associate it with the workflow, then the system should work as expected.

Here are some docs on workflow events:

http://ez.no/developer/ez_publish_3/documentation/development/extensions/workflow_events/wrapping_event
http://ez.no/developer/ez_publish_3/documentation/development/extensions/workflow_events/creating_a_new_event

Hope this helps. Its not the quick-fix you wanted though :(

paul

Luc Chase

Wednesday 29 October 2003 8:25:08 am

okay, at least it's a hint... but don't think I'll be able to get very far. I'm only just learning php right now. Before I sit myself down for an all nighter and hopefully before you're gone for the day...
If I use the gift wrapping code as a template, how would I find the orderID and the items in that order from there. Do I need to find the order in the database or is it passed on to the workflow as a variable?
Would it just be...
$order =& eZOrder::fetch( $orderID ); ?

I need more hints....

The Web Application Service Provider

Paul Forsyth

Wednesday 29 October 2003 9:29:51 am

Yip, you need to get your hands dirty with this.

I believe the order_id is part by post variables and in this case named 'cartId'. Grab the order_id by:

$orderId =& $http->variable( "cartId" );

then it would just be:

$order = eZOrder::fetch( $orderId );

Sorry, i need to go now. Take a look at the documentation for classes:

http://pubsvn.ez.no/doxygen-3.2-1/

Spend time trying things out. Best way to learn, just costly with time.

Paul

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 20:56:46
Script start
Timing: Jan 18 2025 20:56:46
Module start 'layout'
Timing: Jan 18 2025 20:56:46
Module start 'content'
Timing: Jan 18 2025 20:56:47
Module end 'content'
Timing: Jan 18 2025 20:56:47
Script end

Main resources:

Total runtime1.0860 sec
Peak memory usage4,096.0000 KB
Database Queries72

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0077 588.1563152.6563
Module start 'layout' 0.00770.0036 740.812539.5078
Module start 'content' 0.01131.0731 780.3203557.5234
Module end 'content' 1.08440.0016 1,337.843816.1094
Script end 1.0859  1,353.9531 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00370.3396160.0002
Check MTime0.00140.1283160.0001
Mysql Total
Database connection0.00140.133010.0014
Mysqli_queries1.008592.8667720.0140
Looping result0.00060.0576700.0000
Template Total1.039195.720.5195
Template load0.00240.221120.0012
Template processing1.036695.454620.5183
Template load and register function0.00020.021710.0002
states
state_id_array0.00120.112410.0012
state_identifier_array0.00240.221820.0012
Override
Cache load0.00190.1750440.0000
Sytem overhead
Fetch class attribute can translate value0.00060.052220.0003
Fetch class attribute name0.00110.103080.0001
XML
Image XML parsing0.00030.024020.0001
class_abstraction
Instantiating content class attribute0.00000.001180.0000
General
dbfile0.00270.2465100.0003
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
8content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
5content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
9content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 24
 Number of unique templates used: 5

Time used to render debug report: 0.0001 secs