Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Uhtml Email - Work-in Progress - Help Wanted

This is a discussion on Uhtml Email - Work-in Progress - Help Wanted within the Custom Mods and Hacks forums, part of the osCmax V2.5 Forums category; Hi There, this is my first attempt to integrate a pre-existing oscommerce contribution into OscMAX. I use with success the ...

      
  1. #1
    Member
    Join Date
    Jul 2011
    Location
    Rome
    Posts
    35
    Rep Power
    0


    Cool Uhtml Email - Work-in Progress - Help Wanted

    Hi There,
    this is my first attempt to integrate a pre-existing oscommerce contribution into OscMAX.
    I use with success the Uhtml Email contribution, which can be found here :
    First Download :
    osCommerce Community Add-Ons
    Then also :
    osCommerce Community Add-Ons
    At this point i made the following step to integrate :
    -Added the Mysql but only for the part related to sending html email for orders
    so i Ran only this SQL :
    Code:
    -- U HTML EMAILS
    DELETE FROM configuration WHERE configuration_key='ULTIMATE_HTML_EMAIL_LAYOUT';
    INSERT INTO configuration SET configuration_title='U Html Emails - Layout', date_added=NOW(), sort_order='10', configuration_group_id=12, configuration_key='ULTIMATE_HTML_EMAIL_LAYOUT', configuration_value='Basic', configuration_description='<p>Which layout would you like your emails to have?</p><p>Remember you can create your own layout. See the manual for more information.</p>', use_function = NULL, set_function = 'tep_cfg_pull_down_uhtml_email_layout_list(';
    
    DELETE FROM configuration WHERE configuration_key='ULTIMATE_HTML_EMAIL_DEVELOPMENT_MODE';
    INSERT INTO configuration SET configuration_title='U Html Emails - Development mode', date_added=NOW(), sort_order='11', configuration_group_id=12, configuration_key='ULTIMATE_HTML_EMAIL_DEVELOPMENT_MODE', configuration_value='false', configuration_description='<p><b>If true:</b> Generated html emails, will be saved to the catalog folder as .htm files. This can be practical when developing a new layout.</p><p><b>Default is false</b></p>', use_function = NULL, set_function = 'tep_cfg_select_option(array(\'false\', \'true\'),';
    
    DELETE FROM configuration WHERE configuration_key='ULTIMATE_HTML_EMAIL_BULKMAIL_NUMBER';
    INSERT INTO configuration SET configuration_title='U Html Emails - Bulkmail number', date_added=NOW(), sort_order='12', configuration_group_id=12, configuration_key='ULTIMATE_HTML_EMAIL_BULKMAIL_NUMBER', configuration_value='10', configuration_description='Defines how many newsletter e-mails will be sent at a time.', use_function = NULL, set_function = NULL;
    -Then i uploaded the language file into the language subfolder
    -Modified the catalog/checkout_process.php following the instructions provided (i attach here the file to see the code and where changes have been made)
    -Into my current Oscommerce i managed to send along with the order by email, also the image of the product, in another column, to achieve this i changed the code into :
    -1- includes/functions/html_output.php
    adding a custom function :
    PHP Code:
    //email image linking
      
    function tep_image_email($src$alt ''$width ''$height ''$parameters '') {
        if ( (empty(
    $src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {
          return 
    false;
        }

    // alt is added to the img tag even if it is null to prevent browsers from outputting
    // the image filename as default
        
    $image '<img src="' tep_output_string($src) . '" border="0" alt="' tep_output_string($alt) . '"';

        if (
    tep_not_null($alt)) {
          
    $image .= ' title=" ' tep_output_string($alt) . ' "';
        }

        if ( (
    CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height)) ) {
          if (
    $image_size = @getimagesize($src)) {
            if (empty(
    $width) && tep_not_null($height)) {
              
    $ratio $height $image_size[1];
              
    $width $image_size[0] * $ratio;
            } elseif (
    tep_not_null($width) && empty($height)) {
              
    $ratio $width $image_size[0];
              
    $height $image_size[1] * $ratio;
            } elseif (empty(
    $width) && empty($height)) {
              
    $width $image_size[0];
              
    $height $image_size[1];
            }
          } elseif (
    IMAGE_REQUIRED == 'false') {
            return 
    false;
          }
        }

        if (
    tep_not_null($width) && tep_not_null($height)) {
          
    $image .= ' width="' tep_output_string($width) . '" height="' tep_output_string($height) . '"';
        }

        if (
    tep_not_null($parameters)) $image .= ' ' $parameters;

        
    $image .= '>';

        return 
    $image;
      } 
    -2-Then into includes/classes/order.php
    i modified the query to get also the product image :
    PHP Code:
     //mod to source more vars from DB
          //$orders_products_query = tep_db_query("select orders_products_id, products_id, products_name, products_model, products_code, products_price, products_tax, products_quantity, final_price from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int)$order_id . "'");
            
    $orders_products_query tep_db_query("select op.products_quantity, op.orders_products_id, op.products_id, op.products_name , op.products_model, op.products_code,p.products_image,op.products_tax, op.products_price, op.final_price, p.products_id from " TABLE_ORDERS_PRODUCTS " op , " TABLE_PRODUCTS " p where op.orders_id = '" . (int)$order_id "' and op.products_id=p.products_id");
          while (
    $orders_products tep_db_fetch_array($orders_products_query)) {
            
    $this->products[$index] = array('qty' => $orders_products['products_quantity'],
                                        
    'id' => $orders_products['products_id'],
                                            
    'name' => $orders_products['products_name'],
                                            
    'model' => $orders_products['products_model'],
                                                                                    
    'code' => $orders_products['products_code'], //Attributes Product-Code
                                                                                    
    'image' => $orders_products['products_image'],//image linking
                                            
    'tax' => $orders_products['products_tax'],
                                            
    'price' => $orders_products['products_price'],
                                            
    'final_price' => $orders_products['final_price']); 
    and below :
    PHP Code:
     for ($i=0$n=sizeof($products); $i<$n$i++) {
            
    $this->products[$index] = array('qty' => $products[$i]['quantity'],
                                            
    'name' => $products[$i]['name'],
                                            
    'model' => $products[$i]['model'],
                                            
    'code' => $products[$i]['code'],
                                            
    'image' => $products[$i]['products_image'],//image linking
                                            
    'tax' => tep_get_tax_rate($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']),
                                            
    'tax_description' => tep_get_tax_description($products[$i]['tax_class_id'], $tax_address['entry_country_id'], $tax_address['entry_zone_id']),
                                            
    'price' => $products[$i]['price'],
                                            
    'final_price' => $products[$i]['price'] + $cart->attributes_price($products[$i]['id']),
                                            
    'weight' => $products[$i]['weight'],
                                            
    'id' => $products[$i]['id']); 
    Then into che includes/modules/Uhtmlemail/forestgreen/checkout_process.php
    i added the column and the code to display the image:
    PHP Code:
            <table style="font-size:14px; font-family:\'times\';" border="0" cellpadding="3" cellspacing="2" bgcolor=white>
                <
    tr style="background-color:#87A44C; color:#FFFFFF; font-weight:bold;"
                  <
    td align="left" width="180"><font face="Verdana, serif" style="font-size:14px;">'.UHE_TEXT_PRODUCTS_IMAGE.'</font></td>
                    <
    td align="left" width="150"><font face="Verdana, serif" style="font-size:14px;">'.UHE_TEXT_PRODUCTS_ARTICLE.'</font></td>
                    <
    td align="left" width="150"><font face="Verdana, serif" style="font-size:14px;">'.UHE_TEXT_PRODUCTS_MODEL.'</font></td>
                    <
    td align="center" width="100"><font face="Verdana, serif" style="font-size:14px;">'.UHE_TEXT_PRODUCTS_PRICE.'</font></td>
                    <
    td align="center" width="40"><font face="Verdana, serif" style="font-size:14px;">'.UHE_TEXT_PRODUCTS_QTY.'</font></td>
                    <
    td align="right" width="50"><font face="Verdana, serif" style="font-size:14px;">'.UHE_TEXT_PRODUCTS_TOTAL.'</font></td>
                </
    tr>';
                for ($i=0, $n=sizeof($order->products); $i<$n; $i++) {//Add one row for each product. The array $order exists already in checkout_process.php; to which we will include this file.
                $html_email .='
                
    <tr style="background-color:#DDDDDD;"
                  <
    td valign="top" align="left"><font face="Verdana, serif" style="font-size:14px;">'. tep_image_email(HTTP_SERVER. '/'.DIR_WS_IMAGES . $order->products[$i]['image'], $products[$i]['name'], 150 ) . '</td>
                    <
    td valign="top" align="left"><font face="Verdana, serif" style="font-size:14px;">'.$order->products[$i]['name'] . $HTML_Email_product_attributes[$i].'</font></td>
                    <
    td valign="top" align="left"><font face="Verdana, serif" style="font-size:14px;">'.$order->products[$i]['model'].'</font></td>
                    <
    td valign="top" align="center"><font face="Verdana, serif" style="font-size:14px;">'.$currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], 1).'</font></td>
                    <
    td valign="top" align="center"><font face="Verdana, serif" style="font-size:14px;">'.$order->products[$i]['qty'].'</font></td>
                    <
    td valign="top" align="right"><font face="Verdana, serif" style="font-size:14px;">'.$currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']).'</font></td>
                </
    tr>';
                }
            $html_email .='
            
    </table
    -----
    Once modified from Admin we select the forest green template and use MIME emails and it's OK.
    Now the issues i'm having with OscMax :
    -1-I didn't test the various Voucher/Paypal integration yet
    -2-The image is not fetched correctly....email order confirmation only link to www.yoursite.com/images/...can't figure out why,probably a mysql bad call, but it works into Oscommere 2.2 so if anyone is willing to contribute please do that.This is a very good contribution , and give the order confirmation email a very professional look!

  2. #2
    osCMax Development Team
    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    3,121
    Rep Power
    55


    Default Re: Uhtml Email - Work-in Progress - Help Wanted

    The reason that your image is not working is because we have moved images into subfolders rather than chucking everything in DIR_WS_IMAGES ... you need to specify if you want a thumbnail, product or big image!

    So where you are trying to post the image from is empty - hence no image.

    Try adding DYNAMIC_MOPICS_THUMBS_DIR in includes/modules/Uhtmlemail/forestgreen/checkout_process.php

    Code:
    <td valign="top" align="left"><font face="Verdana, serif" style="font-size:14px;">'. tep_image_email(HTTP_SERVER. '/'.DIR_WS_IMAGES . DYNAMIC_MOPICS_THUMBS_DIR . $order->products[$i]['image'], $products[$i]['name'], 150 ) . '</td>
    Should do the trick ... Also you need to add this to your tep_image_email as well.

    Regards,
    pgmarshall
    _______________________________

  3. #3
    Member
    Join Date
    Jul 2011
    Location
    Rome
    Posts
    35
    Rep Power
    0


    Default Re: Uhtml Email - Work-in Progress - Help Wanted

    Hi Pg,
    unfortunately it's not working yet.
    I deleted the function from HTMLOUTPUT (since i can use the correct tep_image) and replaced the module checkout process line, but still it's showing no image (the default text).
    Can you have a look at the query:
    PHP Code:
    $orders_products_query tep_db_query("select op.products_quantity, op.orders_products_id, op.products_id, op.products_name , op.products_model, op.products_code,p.products_image,op.products_tax, op.products_price, op.final_price, p.products_id from " TABLE_ORDERS_PRODUCTS " op , " TABLE_PRODUCTS " p where op.orders_id = '" . (int)$order_id "' and op.products_id=p.products_id"); 
    Maybe this is the problem but can't find where

  4. #4
    osCMax Development Team
    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    3,121
    Rep Power
    55


    Default Re: Uhtml Email - Work-in Progress - Help Wanted

    Just to check:

    You have replaced this:

    tep_image_email(HTTP_SERVER. '/'.DIR_WS_IMAGES . $order->products[$i]['image']

    with

    tep_image(HTTP_SERVER. '/'.DIR_WS_IMAGES . DIR_DYNAMIC_MOPICS_THUMBS . $order->products[$i]['image']

    Yes?

    If you have, what is the exact URL being displayed in the email - can you post a screenshot ... I know this module works as I had it running on an old v2.0.25 store.

    Regards,
    pgmarshall
    _______________________________

  5. #5
    Member
    Join Date
    Jul 2011
    Location
    Rome
    Posts
    35
    Rep Power
    0


    Default Re: Uhtml Email - Work-in Progress - Help Wanted

    Here a screenshot, looks like it's replacing image with the default text cuz it's not finding it.

    The email code :
    <img src="images/icons/default.png" class="img" alt="Sorry, product image is currently not available" title=" Sorry, product image is currently not available " width="150" height="150">
    Which is normal
    I'm fixing also the pound thing soon

  6. #6
    Member
    Join Date
    Jul 2011
    Location
    Rome
    Posts
    35
    Rep Power
    0


    Default Re: Uhtml Email - Work-in Progress - Help Wanted

    Odd ..really odd....i also tried to point a different image using the function TEP_image
    like :
    tep_image('HTTP_SERVER . '/' . DIR_WS_IMAGES . DYNAMIC_MOPICS_THUMBS_DIR . 'prova.jpg', $products[$i]['name'], 150 )
    And it's not linking the image, nor showing the "default" image
    But the code shows :
    <img src="images/icons/default.png" class="img" alt="Sorry, product image is currently not available" title=" Sorry, product image is currently not available " width="150" height="150"></font></td></tr><tr style="background-color:#DDDDDD;">
    It's like if it's not "accepting" the path http_server....Strange one

  7. #7
    osCMax Development Team
    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    3,121
    Rep Power
    55


    Default Re: Uhtml Email - Work-in Progress - Help Wanted

    The default.png is because the system can not find the image at the path specified. Have you put the catalog/ bit in the URL string? Regards,
    pgmarshall
    _______________________________

  8. #8
    Member
    Join Date
    Jul 2011
    Location
    Rome
    Posts
    35
    Rep Power
    0


    Default Re: Uhtml Email - Work-in Progress - Help Wanted

    Hi Pg, no need because it's not in the /catalog folder, but in the main folder.
    I'm also having a problem with another post on an almost ended contribution integration, and it's very strange since i think the data fetching from DB looks changed or something related to query.
    Also the pointing to the "default.png" is not correct if you see, because it doesn't include the http_server address (which is present into the tep_image call).That's why in the image it shows an "x" instead of the default.png image.
    Quite lost,
    regards

  9. #9
    osCMax Development Team
    pgmarshall's Avatar
    Join Date
    Feb 2009
    Location
    London
    Posts
    3,121
    Rep Power
    55


    Default Re: Uhtml Email - Work-in Progress - Help Wanted

    Try hard coding the path to your store into the URL - this will allow us to check if it the constant or something else. Regards,
    pgmarshall
    _______________________________

  10. #10
    Member
    Join Date
    Jul 2011
    Location
    Rome
    Posts
    35
    Rep Power
    0


    Default Re: Uhtml Email - Work-in Progress - Help Wanted

    Hi Pg,
    tried to load this way:
    '.tep_image('http://www.mysite.com/images/prova.jpg','test',150).'</font></td>
    And still message pointing out to the images/default.png ...which isn't shown
    I think it's a constant problem or sumthing like that

Page 1 of 2 12 LastLast

Similar Threads

  1. Can't get email to work
    By bico959 in forum General Topics & Chit Chat
    Replies: 1
    Last Post: 07-23-2009, 10:06 AM
  2. Get HTML Email to work
    By michael_s in forum New osCommerce Contributions
    Replies: 0
    Last Post: 01-06-2008, 06:17 PM
  3. Can't progress through the checkout process
    By christianb2 in forum osCommerce 2.2 Modification Help
    Replies: 1
    Last Post: 02-19-2003, 12:16 AM

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
  •