Results 1 to 10 of 10
  1. #1
    Join Date
    Dec 2009
    Posts
    4
    Plugin Contributions
    0

    Default Custom Email (including a password) based on product Ordered.

    I have 1.3.9h installed with a slighlty customized theme/template/skin. Other than that it's pretty much a out of the box installation.

    I have a new series of digital downloads that I want to offer, and when those products are ordered, I would like a custom email sent to the customer including a password (it will be the same for all downloads) to open the download (zip file).

    Is this possible? It appears that there is only one order confirmation email out of the box, and there is no easy way to add additional information based on product.

  2. #2
    Join Date
    Dec 2009
    Posts
    4
    Plugin Contributions
    0

    Default Re: Custom Email (including a password) based on product Ordered.

    For now I found an easy Hack and that is to edit the orders.php file to check for my specific product IDs and then add some additional info as needed.
    The code resembles:

    Code:
    	if ($this->products[$i]['id'] == 13) {
    		$this->products_ordered_attributes .=  "\nWelcome Text Blah Blah\n\n Need password: Blah Blah";
    	}

  3. #3
    Join Date
    Jan 2004
    Posts
    59,816
    Blog Entries
    4
    Plugin Contributions
    133

    Default Re: Custom Email (including a password) based on product Ordered.

    Using $this->products_ordered_attributes is the correct way.
    However, I'd suggest using an observer class to do it, which would make it much easier to configure and maintain your custom code.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #4
    Join Date
    Feb 2012
    Posts
    42
    Plugin Contributions
    0

    Default Re: Custom Email (including a password) based on product Ordered.

    I sell courses. Moodle is a good platform for courses, but Zen-cart is better for commerce. I need the confirmation email to include the link, user name and password for the course the student has ordered.
    Order.php has a custom section:
    /* START: ADD MY CUSTOM DETAILS
    * 1. calculate/prepare custom information to be added to this product entry in order-confirmation, perhaps as a function call to custom code to build a serial number etc:
    * Possible parameters to pass to custom functions at this point:
    * Product ID ordered (for this line item): $this->products[$i]['id']
    * Quantity ordered (of this line-item): $this->products[$i]['qty']
    * Order number: $zf_insert_id
    * Attribute Option Name ID: (int)$this->products[$i]['attributes'][$j]['option_id']
    * Attribute Option Value ID: (int)$this->products[$i]['attributes'][$j]['value_id']
    * Attribute Filename: $attributes_values->fields['products_attributes_filename']
    *
    * 2. Add that data to the $this->products_ordered_attributes variable, using this sort of format:
    * $this->products_ordered_attributes .= {INSERT CUSTOM INFORMATION HERE};
    */

    $this->products_ordered_attributes .= $custom_insertable_text;

    /* END: ADD MY CUSTOM DETAILS */

    As others have posted, I want to send different emails based on the ordered course. The courses/products need a link and password specific to the course...not the student. I have tried to hack this area to customize the confirmation email, but I still don't have it.
    I have older students and try and keep everything simple. Right now I have 3 courses available. Am I better off trying to create database entries for the links, usernames, and passwords (3 for 3) or will the correct change to order.php do the trick? Do I also need to change other files to get this to work?
    I am all set up and stuck.

  5. #5
    Join Date
    Feb 2012
    Posts
    42
    Plugin Contributions
    0

    Default Re: Order details on the check out success page

    Can the includes/languages/english/html_includes/classic/define_checkout_success.php
    be adapted to generate different text based on the product ordered? Can each product ordered generate its' own unique success.php script?

  6. #6
    Join Date
    Jan 2004
    Posts
    59,816
    Blog Entries
    4
    Plugin Contributions
    133

    Default Re: Custom Email (including a password) based on product Ordered.

    As I said previously, if you use an observer class to do the insertion of the required custom information, you can either control all of that in the PHP file that is the observer class, or if it needs more complex sophistication you can build yourself your own additional database tables and run your additional queries to extract the information to be inserted.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  7. #7
    Join Date
    Feb 2012
    Posts
    42
    Plugin Contributions
    0

    Default Re: Custom Email (including a password) based on product Ordered.

    Thank you DrByte! Is there someone that I can hire to get me started with one or 2 courses in both the confirmation email and the define_checkout_success.php file. I want the confirmation email and define_checkout_success.php to customize depending on the product ordered. When the student orders a course, he/she needs a link, user name and password for that course. At the present time, that is specific to the course, not the student. Right now the confirmation email is a receipt. I would prefer it if the receipt came as an attachment to the email and the email focused on the link, user name and password for the course; but if I can't do that and I just need to share the email, I can live with that, as long as the subject also contains something like 'Course Link Information' and that information is obvious in the email. Right now, the email looks like plain text, even though I have it set for html. I would like the link to be clickable. In the past, our confirmation emails were .txt, but I don't know if that is necessary for today's environment or not. Need advise there. I would also like it not to be accessible from a google search if possible. I know I can't have a user name and password to get a user name and password though, so I don't know where the protected files are. I have approx. 30 or so courses, so maybe instead I need to enter the info in database entry? Don't know the best way. Thank you!
    Cindy

  8. #8
    Join Date
    Feb 2012
    Posts
    42
    Plugin Contributions
    0

    Default Re: Custom Email (including a password) based on product Ordered.

    I am still attempting to send detail in a success email specific to the product ordered. I had it working until I tried to make it product specific. Now it gives me a PHP Parse error: syntax error, unexpected T_IF.
    PHP Code:
    if($this->products[$i]['id'] = '4') {
    $this->products_ordered_attributes .= "\n" 'custom information'
    I know it is somtimes the line before...here it is in context:
    PHP Code:
    // build output for email notification
          
    $this->products_ordered .=  $this->products[$i]['qty'] . ' x ' $this->products[$i]['name'] . ($this->products[$i]['model'] != '' ' (' $this->products[$i]['model'] . ') ' '') . ' = ' .
          
    $currencies->display_price($this->products[$i]['final_price'], $this->products[$i]['tax'], $this->products[$i]['qty']) .
    if(
    $this->products[$i]['id'] = '4') {
    $this->products_ordered_attributes .= "\n" 'custom information'
    Also, I am not sure how to include a link/bold/color within the custom information. <> doesn't work. I have my email setting set to html.
    Thank you!!

  9. #9
    Join Date
    Jan 2004
    Posts
    59,816
    Blog Entries
    4
    Plugin Contributions
    133

    Default Re: Custom Email (including a password) based on product Ordered.

    Right. The line before your IF statement needs a closing semicolon, instead of a period.
    And your IF statement needs a closing } after the last line you quoted.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  10. #10
    Join Date
    Feb 2012
    Posts
    42
    Plugin Contributions
    0

    Default Re: Custom Email (including a password) based on product Ordered.

    DrByte:
    Thank you for your response! I made the changes but it doesn't show in the email. Here is order.php in context.:

    Line 982// build output for email notification
    $this->products_ordered .= $this->products[$i]['qty'] . ' x ' . $this->products[$i]['name'] . ($this->products[$i]['model'] != '' ? ' (' . $this->products[$i]['model'] . ') ' : '') . ' = ' .
    $currencies->display_price($this->products[$i]['final_price'], $this->products[$i]['tax'], $this->products[$i]['qty']) ;
    if($this->products[$i]['id'] = '4') {
    $this->products_ordered_attributes .= "\n" . 'custom information';
    }
    $this->products_ordered_html .=
    '<tr>' . "\n" . Line 989

    The email looks like this:
    Order Confirmation from Vendor

    Buyer's name

    Thanks for shopping with us today!
    The following are the details of your order.
    ------------------------------------------------------
    Date Ordered: Monday 05 March, 2012
    Products
    ------------------------------------------------------
    1 x Product Name =
    $0.01------------------------------------------------------
    Sub-Total: $0.01
    Total: $0.01

    Delivery Address
    ------------------------------------------------------
    etc.

    The custom information will show up in all emails without IF.

    // build output for email notification
    $this->products_ordered .= $this->products[$i]['qty'] . ' x ' . $this->products[$i]['name'] . ($this->products[$i]['model'] != '' ? ' (' . $this->products[$i]['model'] . ') ' : '') . ' = ' .
    $currencies->display_price($this->products[$i]['final_price'], $this->products[$i]['tax'], $this->products[$i]['qty']) .
    ($this->products[$i]['onetime_charges'] !=0 ? "\n" . TEXT_ONETIME_CHARGES_EMAIL . $currencies->display_price($this->products[$i]['onetime_charges'], $this->products[$i]['tax'], 1) : '') .
    Line 986 $this->products_ordered_attributes . "\ncustom information";
    $this->products_ordered_html .=
    '<tr>' . "\n" .

    Is the IF statement in the correct area of the file? Should I have changed this area instead?
    // lets start with the email confirmation
    // make an array to store the html version

    I want to make a list of a dozen or so IF statements corresponding to specific product ID numbers that will include specific information (link/user name/password) tied to the product ID number.
    Thanks again!!

 

 

Similar Threads

  1. paypal not telling me product ordered in confirmation email
    By motoxcr17 in forum Addon Payment Modules
    Replies: 12
    Last Post: 10 Dec 2009, 02:34 AM
  2. Custom receipt email based on category
    By ardesmond in forum Managing Customers and Orders
    Replies: 3
    Last Post: 6 Jul 2009, 11:59 AM
  3. Trying to send unique e-mails based on product ordered
    By Greg Dean in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 12 May 2009, 11:55 PM
  4. Shipping discount based on qty ordered AND
    By tracievh in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 9 Dec 2007, 01:57 PM
  5. Product Discounts based on quantity ordered
    By rmn in forum General Questions
    Replies: 8
    Last Post: 23 Nov 2007, 05:12 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •