Results 1 to 9 of 9
  1. #1
    Join Date
    Jan 2008
    Posts
    4
    Plugin Contributions
    0

    Default Customizing Confirmation Email

    Hi Folks,

    Been working with zen cart since yesterday.

    I've been asked to include product descriptions in the confirmation email.

    Thought I had a handle on how to do this in ~/email/email_template_checkout.html, but all attempts have failed.

    I've read many of the docs, wiki and searched the posts on this topic, but haven't found what I'm looking for.

    Can anyone point me in the right direction?

    Thanks!

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Customizing Confirmation Email

    Not sure but think you are in the correct file need to edit this mail and add your content in a div here in red - this might run into additional pages if you place too much in there.

    Code:
    </tr> </tbody></table> </td> </tr> </tbody></table>
    </div>
    <div class="content-line"><p>Your Content....................</p></div>
    </div><!-- Footer Section --> <div class="footer">
    <div class="copyright">$EMAIL_FOOTER_COPYRIGHT</div>
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Jan 2008
    Posts
    4
    Plugin Contributions
    0

    Default Re: Customizing Confirmation Email

    I tried something like:
    <div class="order-detail-area">$PRODUCTS_LIST</div>
    Saw $PRODUCTS_LIST mentioned somewhere, but not sure what it holds. Still I figured I'd try it. Nothing extra showed in a test confirmation email.

    Tried grepping $PRODUCTS_LIST throughout the cart's doc root and nothing came up.

    Also tried:
    <div class="content-line">$PRODUCTS_LIST</div>
    ; no difference.

    Does it matter that the confirmation emails are configured to be text-only?

    Does anyone know if there is a variable that holds the product description I can use in the confirmation email?

    Thanks!

  4. #4
    Join Date
    Jan 2008
    Posts
    4
    Plugin Contributions
    0

    Default Re: Customizing Confirmation Email

    After digging around, this is what I've found.

    The file that needs to be modified is ~/includes/classes/order.php.

    The output for email notification is held in the $this->products array, so I need to add the product description into this array.

    Here's what I did:

    Added
    $orders_products_description_query = "select products_description
    from " . TABLE_PRODUCTS_DESCRIPTION . "
    where products_id = '" . (int)$orders_products->fields['products_id'] . "'";

    $orders_products_description = $db->Execute($orders_products_description_query);
    just before the $this->products array is built.

    Then changed
    $this->products[$index] = array('qty' => $new_qty,
    'id' => $orders_products->fields['products_id'],
    'name' => $orders_products->fields['products_name'],
    'model' => $orders_products->fields['products_model'],
    'tax' => $orders_products->fields['products_tax'],
    'price' => $orders_products->fields['products_price'],
    'final_price' => $orders_products->fields['final_price'],
    'onetime_charges' => $orders_products->fields['onetime_charges'],
    'products_priced_by_attribute' => $orders_products->fields['products_priced_by_attribute'],
    'product_is_free' => $orders_products->fields['product_is_free'],
    'products_discount_type' => $orders_products->fields['products_discount_type'],
    'products_discount_type_from' => $orders_products->fields['products_discount_type_from']);
    to
    $this->products[$index] = array('qty' => $new_qty,
    'id' => $orders_products->fields['products_id'],
    'name' => $orders_products->fields['products_name'],
    'model' => $orders_products->fields['products_model'],
    'description' => $orders_products_description->fields['products_description'],
    'tax' => $orders_products->fields['products_tax'],
    'price' => $orders_products->fields['products_price'],
    'final_price' => $orders_products->fields['final_price'],
    'onetime_charges' => $orders_products->fields['onetime_charges'],
    'products_priced_by_attribute' => $orders_products->fields['products_priced_by_attribute'],
    'product_is_free' => $orders_products->fields['product_is_free'],
    'products_discount_type' => $orders_products->fields['products_discount_type'],
    'products_discount_type_from' => $orders_products->fields['products_discount_type_from']);
    and then changed
    $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) : '') .
    $this->products_ordered_attributes . "\n";
    to
    $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']) . "\n" .
    $this->products[$i]['description'] . "\n" .
    ($this->products[$i]['onetime_charges'] !=0 ? "\n" . TEXT_ONETIME_CHARGES_EMAIL . $currencies->display_price($this->products[$i]['onetime_charges'], $this->products[$i]['tax'], 1) : '') .
    $this->products_ordered_attributes . "\n";
    My $orders_products_description_query works fine in phpmyadmin, but I still don't get the description in the confirmation email.

    The two extra newlines, show, though, which suggests that $this->products[$i]['description'] is empty ... but it is not.

    Can anyone lend a hand here?

    Thanks.

  5. #5

    Default Re: Customizing Confirmation Email

    Any help on this? I am interested in modifying the email that comes in to our office. I will keep looking around the forum in the mean time.
    Of course I went mad with power. Have you ever tried going mad without power? It's boring. No one listens to you.

  6. #6
    Join Date
    Feb 2007
    Posts
    10
    Plugin Contributions
    0

    Default Re: Customizing Confirmation Email

    I've been messing around with this idea, and made some headway like this.
    OLdSalt, I think your code wasn't working because you were using a local variable. I took your idea and moved it like this: (this is assuming we're using an unmodified version of order.php)

    order.php
    Starting at line 726
    Code:
    //  get the products description from the db 
        $orders_products_description_query = "select products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . zen_get_prid($this->products[$i]['id']) . "'";
        $orders_products_description = $db->Execute($orders_products_description_query);
        $this->orders_products_description = $orders_products_description->fields['products_description'];
    This gives us our products description in $this->orders_products_description.

    Now, it's important to note that at this point in the code we've been iterating through the customer's order here, (getting each product_id in turn) so this is going to be the description of the last item in the order. Some further coding will be necessary to get exactly what you want here.

    I didn't want to put the description into the $this->products_ordered array, because it doesn't end up where I want it in the email.
    I discovered there is the skeleton of a custom text functionality (around line 858) that adds your $custom_insertable_text into the $this->products_ordered_attributes array. This way, it appears right after the name of the product. That might be acceptable, so you'd use:

    Code:
    $this->products_ordered_attributes .= $this->orders_products_description;
    around line 864

    You might need to add a <br /> or something before the description to make it look better in the email.

    My approach was different, I created a template variable so I could put it in the email exactly as I wanted it to appear.

    Code:
    $html_msg['PRODUCT_DESCRIPTION'] = $this->orders_products_description;
    around line 949. this is in the "send_order_email" function that builds the template variables.

    Then, in your email template, put in a $PRODUCT_DESCRIPTION template variable where you want it to end up.

    I hope this is of help. This brings me about 3/4 of the way to the mod I'm working on, which is a way to include instructions for certain products in the confirmation email. The products that need the added instructions will have an extra item in their products_description table that gets added to the email. I plan to just put them into the db using phpMyAdmin 'cause I don't have time to figure out how to add it to the admin interface.

  7. #7
    Join Date
    Jan 2008
    Posts
    4
    Plugin Contributions
    0

    Default Re: Customizing Confirmation Email

    Thanks for your response, 7thVeil.

    I tried your suggestion, but saw no change. They are using text emails, but I don't believe that should make a difference here.

    Another attempt I made was to include product description directly into the $this->products array.

    First added for the product description in the SQL query:
    Code:
    $orders_products_query = "select op.orders_products_id, op.products_id, op.products_name,
                                 op.products_model, op.products_price, op.products_tax,
                                 op.products_quantity, op.final_price,
                                 op.onetime_charges,
                                 op.products_priced_by_attribute, op.product_is_free, op.products_discount_type,
                                 op.products_discount_type_from, tpd.products_description
                                 from " . TABLE_ORDERS_PRODUCTS . " AS op, " . TABLE_PRODUCTS_DESCRIPTION . " AS tpd
                                 where op.orders_id = '" . (int)$order_id . "' AND op.products_id=tpd.products_id";
    then added product description to the resulting array:
    Code:
    $this->products[$index] = array('qty' => $new_qty,
                                    'id' => $orders_products->fields['products_id'],
                                    'name' => $orders_products->fields['products_name'],
                                    'model' => $orders_products->fields['products_model'],
                                    'description' => $orders_products->fields['products_description'],
                                    'tax' => $orders_products->fields['products_tax'],
                                    'price' => $orders_products->fields['products_price'],
                                    'final_price' => $orders_products->fields['final_price'],
                                    'onetime_charges' => $orders_products->fields['onetime_charges'],
                                    'products_priced_by_attribute' => $orders_products->fields['products_priced_by_attribute'],
                                    'product_is_free' => $orders_products->fields['product_is_free'],
                                    'products_discount_type' => $orders_products->fields['products_discount_type'],
                                    'products_discount_type_from' => $orders_products->fields['products_discount_type_from']);
    and finally added the product description to the email confirmation:
    Code:
    // build output for email notification - added products_description
    $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']) . "\n" .
    $this->products[$i]['description'] . "\n" .
    ($this->products[$i]['onetime_charges'] !=0 ? "\n" . TEXT_ONETIME_CHARGES_EMAIL . $currencies->display_price($this->products[$i]['onetime_charges'], $this->products[$i]['tax'], 1) : '') .
    $this->products_ordered_attributes . "\n";
    Again, I get the newlines, but no product description.

  8. #8

    Default Re: Customizing Confirmation Email

    I've been trying to add the product description to my invoices, packing slips, and order confirmation emails. Somewhere, I found a code snippet that stores the product description in the order table. I have not had any problems incorporating the new description field into the packing slip and invoice, but I am having an issue with my email confirmations. The description of the first line item is fine, but the second one contains the description for the first and second line item. The third line item contains the description for the first, second, and third line item and so on.
    In the order.php file around line #725, I have changed
    Code:
    $sql_data_array = array('orders_id' => $zf_insert_id,
                                  'products_id' => zen_get_prid($this->products[$i]['id']),
                                  'products_model' => $this->products[$i]['model'],
                                  'products_name' => $this->products[$i]['name'],
                                  'products_price' => $this->products[$i]['price'],
                                  'final_price' => $this->products[$i]['final_price'],
                                  'onetime_charges' => $this->products[$i]['onetime_charges'],
                                  'products_tax' => $this->products[$i]['tax'],
                                  'products_quantity' => $this->products[$i]['qty'],
                                  'products_priced_by_attribute' => $this->products[$i]['products_priced_by_attribute'],
                                  'product_is_free' => $this->products[$i]['product_is_free'],
                                  'products_discount_type' => $this->products[$i]['products_discount_type'],
                                  'products_discount_type_from' => $this->products[$i]['products_discount_type_from'],
                                  'products_prid' => $this->products[$i]['id']);
          zen_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);
    to
    Code:
         $sql_data_array = array('orders_id' => $zf_insert_id,
                                  'products_id' => zen_get_prid($this->products[$i]['id']),
                                  'products_model' => $this->products[$i]['model'],
                                  'products_name' => $this->products[$i]['name'],
                                  'products_description' => zen_get_products_description($this->products[$i]['id']),
                                  'products_price' => $this->products[$i]['price'],
                                  'final_price' => $this->products[$i]['final_price'],
                                  'onetime_charges' => $this->products[$i]['onetime_charges'],
                                  'products_tax' => $this->products[$i]['tax'],
                                  'products_quantity' => $this->products[$i]['qty'],
                                  'products_priced_by_attribute' => $this->products[$i]['products_priced_by_attribute'],
                                  'product_is_free' => $this->products[$i]['product_is_free'],
                                  'products_discount_type' => $this->products[$i]['products_discount_type'],
                                  'products_discount_type_from' => $this->products[$i]['products_discount_type_from'],
                                  'products_prid' => $this->products[$i]['id']);
          zen_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);
    I have not posted a message with samples of code, so I'm not sure if I inserted the code segments correctly. Please forgive me lack of experience here. Any help would be greatly appreciated.

  9. #9
    Join Date
    Mar 2009
    Location
    Seattle
    Posts
    13
    Plugin Contributions
    0

    Default Re: Customizing Confirmation Email

    Version 1.3.8a
    Thanks to all for the input so far. Been cruising the posts for about 2 years, and found everything I needed without having to post.
    I've got the Product Description showing in the Shopping Cart and in the Confirmation Email, but not in the Order Confirmation (Step 3 of 3) or in the Order Information/Account History link in the confirmation email.
    I would assume they come from the same source.
    Anybody have good news?

 

 

Similar Threads

  1. Customizing Order Confirmation Emails
    By swilliams88 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 20 Aug 2012, 08:52 PM
  2. Customizing the Order Confirmation email
    By Beau91324 in forum General Questions
    Replies: 4
    Last Post: 3 Jul 2010, 02:36 AM
  3. Help customizing Confirmation Email
    By aperfecthost in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 15 Oct 2009, 08:19 PM
  4. Customizing order confirmation page
    By wadecbecker in forum Managing Customers and Orders
    Replies: 1
    Last Post: 15 Sep 2009, 11:44 PM
  5. Customizing order confirmation page
    By wadecbecker in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 12 Jun 2009, 10:34 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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR