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 :
-Then i uploaded the language file into the language subfolderCode:-- 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;
-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 :
-2-Then into includes/classes/order.phpPHP 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;
}
i modified the query to get also the product image :
and below :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']);
Then into che includes/modules/Uhtmlemail/forestgreen/checkout_process.phpPHP 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']);
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!



LinkBack URL
About LinkBacks











Bookmarks