- Posts: 176
- Thank you received: 27
Email template causing issues
3 hours 2 minutes ago - 2 hours 55 minutes ago #100000297
by yerg55
Email template causing issues was created by yerg55
-- HikaShop version -- : 6.7.0
-- Joomla version -- : 6.2.0
-- Browser(s) name and version -- : Firefox 157.0
Preview Order Status Notification I get the following error in the popup with errors/debug enabled ....
0 syntax error, unexpected token "<", expecting end of file
The template is below ....
The email received shows the access to the video/recipes as it should at the bottom but it's also added at the top
When I "View Modifications" the "Original" shows * @version 6.7.0 and the O"Override" is * @version 6.7.0
I'm thinking these are all interconnected but may be totally wrong
-- Joomla version -- : 6.2.0
-- Browser(s) name and version -- : Firefox 157.0
Preview Order Status Notification I get the following error in the popup with errors/debug enabled ....
0 syntax error, unexpected token "<", expecting end of file
Code:
# Function Location
1 () JROOT/media/com_hikashop/mail/order_status_notification.confirmed.preload.php:546
2 hikashopMailClass->loadEmail() JROOT/administrator/components/com_hikashop/classes/mail.php:128
3 hikashopMailClass->get() JROOT/administrator/components/com_hikashop/classes/order.php:2430
4 hikashopOrderClass->loadOrderNotification() JROOT/administrator/components/com_hikashop/classes/order.php:2389
5 hikashopOrderClass->loadNotification() JROOT/media/com_hikashop/mail/order_status_notification.preview.php:20
6 order_status_notificationPreviewMaker->prepareMail() JROOT/administrator/components/com_hikashop/views/email/view.html.php:357
7 EmailViewEmail->preview() JROOT/administrator/components/com_hikashop/views/email/view.html.php:24
8 EmailViewEmail->display() JROOT/libraries/src/MVC/Controller/BaseController.php:705
9 Joomla\CMS\MVC\Controller\BaseController->display() JROOT/administrator/components/com_hikashop/helpers/helper.php:3216
10 hikashopController->display() JROOT/administrator/components/com_hikashop/controllers/email.php:124
11 emailController->preview() JROOT/libraries/src/MVC/Controller/BaseController.php:738
12 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/administrator/components/com_hikashop/helpers/helper.php:3194
13 hikashopController->execute() JROOT/administrator/components/com_hikashop/hikashop.php:77
14 require_once() JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:71
15 Joomla\CMS\Dispatcher\LegacyComponentDispatcher::{closure:Joomla\CMS\Dispatcher\LegacyComponentDispatcher::dispatch():70}() JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:73
16 Joomla\CMS\Dispatcher\LegacyComponentDispatcher->dispatch() JROOT/libraries/src/Component/ComponentHelper.php:361
17 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/AdministratorApplication.php:150
18 Joomla\CMS\Application\AdministratorApplication->dispatch() JROOT/libraries/src/Application/AdministratorApplication.php:206
19 Joomla\CMS\Application\AdministratorApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:320
20 Joomla\CMS\Application\CMSApplication->execute() JROOT/administrator/includes/app.php:58
21 require_once() JROOT/administrator/index.php:32
The template is below ....
Code:
<?php
/**
* @package HikaShop
* @version 6.7.0
* @author hikashop.com
* @copyright (C) 2010-2026 HIKARI SOFTWARE. All rights reserved.
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
*/
defined('_JEXEC') or defined('ABSPATH') or die('Restricted access');
?><?php
$app = \Joomla\CMS\Factory::getApplication();
$config = hikashop_config();
$orderClass = hikashop_get('class.order');
$imageHelper = hikashop_get('helper.image');
$productClass = hikashop_get('class.product');
$fieldsClass = hikashop_get('class.field');
global $Itemid;
$url_itemid = '';
if(!empty($Itemid)) {
$url_itemid = '&Itemid=' . $Itemid;
}
if(isset($data->url_itemid)) {
$url_itemid = (!empty($data->url_itemid) ? '&Itemid=':'') . $data->url_itemid;
}
$order_url = $data->order_url;
$mail_status = $data->mail_status;
$customer = $data->customer;
if(!isset($data->order))
$data->order = new stdClass();
$fs = array('order_number','order_discount_tax','order_shipping_tax','order_payment_tax','order_full_price','order_shipping_price','order_payment_price','order_discount_price','order_currency_id','order_status');
foreach($fs as $f) {
if(isset($data->$f) && !isset($data->order->$f))
$data->order->$f = $data->$f;
}
$data->order->order_url = $order_url;
$data->cart = $orderClass->loadFullOrder($data->order_id,true,false);
if(hikashop_level(2)) {
$itemFields = $fieldsClass->getFields('display:mail_status_notif=1', $data->cart->products, 'item');
}
$url = $data->order_number = $data->cart->order_number;
$url = '<a href="'.$order_url.'">'. $url.'</a>';
$data->cart->coupon = new stdClass();
$price = new stdClass();
$tax = $data->cart->order_subtotal - $data->cart->order_subtotal_no_vat - $data->cart->order_discount_tax + $data->cart->order_shipping_tax + $data->cart->order_payment_tax;
$price->price_value = max(0, $data->cart->order_full_price - $tax);
$price->price_value_with_tax = $data->cart->order_full_price;
$data->cart->full_total = new stdClass;
$data->cart->full_total->prices = array($price);
$data->cart->coupon->discount_value =& $data->cart->order_discount_price;
if(hikashop_isClient('administrator')) {
$view = 'order';
} else {
$view = 'address';
}
$colspan = 4;
$customer_name = @$customer->name;
if(empty($customer_name))
$customer_name = @$data->cart->billing_address->address_firstname.' '.@$data->cart->billing_address->address_lastname;
$vars = array(
'LIVE_SITE' => HIKASHOP_LIVE,
'URL' => $order_url,
'ORDER_PRODUCT_CODE' => (bool)$config->get('show_code', false),
'order' => $data->cart,
'user' => $customer,
'customer' => $customer,
'billing_address' => @$data->cart->billing_address,
'shipping_address' => @$data->cart->shipping_address,
'TPL_HEADER' => (bool)@$customer->user_cms_id,
'TPL_HEADER_URL' => $order_url,
);
$order_changed = \Joomla\CMS\Language\Text::sprintf('ORDER_STATUS_CHANGED_TO', $url, $data->mail_status);
if(!empty($data->usermsg->usermsg))
$order_changed = $data->usermsg->usermsg;
$texts = array(
'BILLING_ADDRESS' => \Joomla\CMS\Language\Text::_('HIKASHOP_BILLING_ADDRESS'),
'SHIPPING_ADDRESS' => \Joomla\CMS\Language\Text::_('HIKASHOP_SHIPPING_ADDRESS'),
'SUMMARY_OF_YOUR_ORDER' => \Joomla\CMS\Language\Text::_('SUMMARY_OF_YOUR_ORDER'),
'MAIL_HEADER' => \Joomla\CMS\Language\Text::_('HIKASHOP_MAIL_HEADER'),
'TPL_HEADER_TEXT' => \Joomla\CMS\Language\Text::_('HIKASHOP_MAIL_HEADER'),
'USER_ACCOUNT' => (bool)@$customer->user_cms_id,
'PRODUCT_NAME' => \Joomla\CMS\Language\Text::_('CART_PRODUCT_NAME'),
'PRODUCT_CODE' => \Joomla\CMS\Language\Text::_('CART_PRODUCT_CODE'),
'PRODUCT_PRICE' => \Joomla\CMS\Language\Text::_('CART_PRODUCT_UNIT_PRICE'),
'PRODUCT_QUANTITY' => \Joomla\CMS\Language\Text::_('CART_PRODUCT_QUANTITY'),
'PRODUCT_TOTAL' => \Joomla\CMS\Language\Text::_('HIKASHOP_TOTAL'),
'ADDITIONAL_INFORMATION' => \Joomla\CMS\Language\Text::_('ADDITIONAL_INFORMATION'),
'ORDER_TITLE' => \Joomla\CMS\Language\Text::_('YOUR_ORDER'),
'HI_CUSTOMER' => \Joomla\CMS\Language\Text::sprintf('HI_CUSTOMER', $customer_name),
'ORDER_CHANGED' => $order_changed,
'ORDER_BEGIN_MESSAGE' => \Joomla\CMS\Language\Text::sprintf('THANK_YOU_FOR_YOUR_ORDER_BEGIN', HIKASHOP_LIVE),
'ORDER_END_MESSAGE' => \Joomla\CMS\Language\Text::sprintf('THANK_YOU_FOR_YOUR_ORDER', HIKASHOP_LIVE) . '<br/>' . \Joomla\CMS\Language\Text::sprintf('BEST_REGARDS_CUSTOMER',$mail->from_name),
);
if(!empty($data->usermsg->usermsg)){
$texts['ORDER_CHANGED'] = $data->usermsg->usermsg;
}
$templates = array();
$products_ids = array();
foreach($data->cart->products as $item) { $products_ids[] = $item->product_id; }
$productClass->getProducts($products_ids);
$product_aliases = $productClass->getUrlAliases($products_ids);
$cartProducts = array();
$cartFooters = array();
if(!empty($data->cart->products)){
$null = null;
$fields = null;
$texts['CUSTOMFIELD_NAME'] = '';
$texts['FOOTER_COLSPAN'] = 3;
if(hikashop_level(1)){
$fields = $fieldsClass->getFields('display:mail_status_notif=1',$null,'product');
if(!empty($fields)){
$product_customfields = array();
$usefulFields = array();
foreach($fields as $field){
$namekey = $field->field_namekey;
foreach($productClass->all_products as $product){
if(!empty($product->$namekey)){
$usefulFields[] = $field;
break;
}
}
}
$fields = $usefulFields;
}
if(!empty($fields)){
foreach($fields as $field){
$texts['FOOTER_COLSPAN']++;
$texts['CUSTOMFIELD_NAME'].='<td class="hk-th" style="font-size:12px;line-height:16px;font-weight:bold;letter-spacing:0.5px;text-transform:uppercase;color:#6b7280;padding:12px 8px 8px 0;border-bottom:1px solid #e3e6ea;">'.$fieldsClass->getFieldName($field).'</td>';
}
}
}
$group = $config->get('group_options',0);
$subtotal = 0;
foreach($data->cart->products as $item) {
if($group && $item->order_product_option_parent_id)
continue;
$product = @$productClass->all_products[$item->product_id];
$cartProduct = array(
'PRODUCT_CODE' => $item->order_product_code,
'PRODUCT_QUANTITY' => $item->order_product_quantity,
'PRODUCT_IMG' => '',
'item' => $item,
'product' => $product,
);
if(!empty($item->images[0]->file_path) && $config->get('thumbnail', 1) != 0) {
$img = $imageHelper->getThumbnail($item->images[0]->file_path, array(50, 50), array('forcesize' => true, 'scale' => 'outside'));
if($img->success) {
if(substr($img->url, 0, 3) == '../')
$image = str_replace('../', HIKASHOP_LIVE, $img->url);
elseif(!$img->external)
$image = substr(HIKASHOP_LIVE, 0, strpos(HIKASHOP_LIVE, '/', 9)) . $img->url;
else
$image = $img->url;
$attributes = '';
if($img->external)
$attributes = ' width="'.$img->req_width.'" height="'.$img->req_height.'"';
$cartProduct['PRODUCT_IMG'] = '<img src="'.$image.'" alt="" align="left" style="float:left;margin:2px 10px 4px 0;border-radius:4px;"'.$attributes.'/>';
}
}
if(!empty($item->product_id)) {
$product_url = hikashop_contentLink('product&task=show&cid='.(int)$item->product_id.'&name='.@$product_aliases[$item->product_id].$url_itemid, $item, false, false, false, true);
if(!empty($data->cart->order_token)) {
$product_url .= (strpos($product_url, '?') !== false ? '&' : '?')
. 'order_id='.(int)$data->order_id
. '&order_token='.urlencode($data->cart->order_token);
}
$t = '<p><a href="'.$product_url.'">' . $item->order_product_name . '</a>';
} else {
$t = '<p>' . $item->order_product_name;
}
if($group){
$display_item_price=false;
foreach($data->cart->products as $j => $optionElement){
if($optionElement->order_product_option_parent_id != $item->order_product_id) continue;
if($optionElement->order_product_price>0){
$display_item_price = true;
}
}
if($display_item_price){
if($config->get('price_with_tax')){
$t .= ' '.$currencyHelper->format($item->order_product_price+$item->order_product_tax,$data->cart->order_currency_id);
}else{
$t .= ' '.$currencyHelper->format($item->order_product_price,$data->cart->order_currency_id);
}
}
}
$t .= '</p>';
if(!empty($itemFields)){
foreach($itemFields as $field){
$namekey = $field->field_namekey;
if(!isset($item->$namekey) || (empty($item->$namekey) && !strlen((string)$item->$namekey))) continue;
$field->currentElement = $item;
$t .= '<p>'.$fieldsClass->getFieldName($field).': '.$fieldsClass->show($field,$item->$namekey,'user_email',$data->cart->order_token).'</p>';
}
}
$cartProduct['CUSTOMFIELD_VALUE'] = '';
if(!empty($fields) && hikashop_level(1)){
foreach($fields as $field){
$namekey = $field->field_namekey;
$productData = @$productClass->all_products[$item->product_id];
$field->currentElement = $productData;
$cartProduct['CUSTOMFIELD_VALUE'] .= '<td class="hk-td hk-num" style="font-size:15px;line-height:22px;padding:12px 0 12px 14px;border-bottom:1px solid #e3e6ea;vertical-align:top;text-align:right;white-space:nowrap;">'.(empty($productData->$namekey)?'':$fieldsClass->show($field,$productData->$namekey)).'</td>';
}
}
if($group){
foreach($data->cart->products as $j => $optionElement){
if($optionElement->order_product_option_parent_id != $item->order_product_id) continue;
$item->order_product_price +=$optionElement->order_product_price;
$item->order_product_tax +=$optionElement->order_product_tax;
$item->order_product_total_price+=$optionElement->order_product_total_price;
$item->order_product_total_price_no_vat+=$optionElement->order_product_total_price_no_vat;
$t .= '<p class="hikashop_order_option_name">' . $optionElement->order_product_name;
if($optionElement->order_product_price>0){
if($config->get('price_with_tax')){
$t .= ' ( + '.$currencyHelper->format($optionElement->order_product_price+$optionElement->order_product_tax,$data->cart->order_currency_id).' )';
}else{
$t .= ' ( + '.$currencyHelper->format($optionElement->order_product_price,$data->cart->order_currency_id).' )';
}
}
$t .= '</p>';
}
}
$cartProduct['PRODUCT_NAME'] = $t;
$t = '';
$statusDownload = explode(',',$config->get('order_status_for_download','confirmed,shipped'));
if($group) {
foreach($data->cart->products as $j => $optionElement) {
if($optionElement->order_product_option_parent_id != $item->order_product_id) continue;
if(!empty($optionElement->files)) {
if(empty($item->files)) {
$item->files = array();
}
foreach($optionElement->files as $file) {
$item->files[] = $file;
}
}
}
}
if(!empty($item->files) && in_array($data->order_status,$statusDownload)){
$class = 'class="cart_button hika_template_color" style="display:inline-block;background-color:#2f6f9f;color:#ffffff;font-weight:bold;text-decoration:none;padding:12px 24px;border-radius:8px;"';
$t .= '<p>';
foreach($item->files as $file){
$fileName = empty($file->file_name) ? $file->file_path : $file->file_name;
$file_pos = empty($file->file_pos) ? '' : ('&file_pos=' . $file->file_pos);
if(empty($customer->user_cms_id))
$file_pos .= '&order_token=' . $data->cart->order_token;
$oid = $data->order_id;
if(!empty($data->cart->order_parent_id))
$oid = $data->cart->order_parent_id;
$t .= '<a '.$class.'href="'.hikashop_frontendLink('index.php?option=com_hikashop&ctrl=order&task=download&file_id='.$file->file_id.'&order_id='.$data->order_id.$file_pos.$url_itemid).'">'.$fileName.'</a><br/>';
}
$t .= '</p>';
}
$cartProduct['PRODUCT_DOWNLOAD'] = $t;
$cartProduct['PRODUCT_PRICE_BEFORE_DISCOUNT'] = '';
if($config->get('price_with_tax')){
$unit_price = $currencyHelper->format($item->order_product_price+$item->order_product_tax,$data->cart->order_currency_id);
if(!empty($item->order_product_price_before_discount) && $item->order_product_price_before_discount > 0.0)
$cartProduct['PRODUCT_PRICE_BEFORE_DISCOUNT'] = $currencyHelper->format($item->order_product_price_before_discount+$item->order_product_tax_before_discount,$data->cart->order_currency_id);
$total_price = $currencyHelper->format($item->order_product_total_price,$data->cart->order_currency_id);
$subtotal += $item->order_product_total_price;
}else{
$unit_price = $currencyHelper->format($item->order_product_price,$data->cart->order_currency_id);
if(!empty($item->order_product_price_before_discount) && $item->order_product_price_before_discount > 0.0)
$cartProduct['PRODUCT_PRICE_BEFORE_DISCOUNT'] = $currencyHelper->format($item->order_product_price_before_discount,$data->cart->order_currency_id);
$total_price = $currencyHelper->format($item->order_product_total_price_no_vat,$data->cart->order_currency_id);
$subtotal += $item->order_product_total_price_no_vat;
}
$cartProduct['PRODUCT_PRICE'] = $unit_price;
$cartProduct['PRODUCT_TOTAL'] = $total_price;
$cartProducts[] = $cartProduct;
}
$templates['PRODUCT_LINE'] = $cartProducts;
if(bccomp(sprintf('%F',$data->cart->order_discount_price),0,5) != 0 || bccomp(sprintf('%F',$data->cart->order_shipping_price),0,5) != 0 || bccomp(sprintf('%F',$data->cart->order_payment_price),0,5) != 0 || ($data->cart->full_total->prices[0]->price_value!=$data->cart->full_total->prices[0]->price_value_with_tax) || !empty($data->cart->additional)){
$cartFooters[] = array(
'CLASS' => 'subtotal',
'NAME' => \Joomla\CMS\Language\Text::_('SUBTOTAL'),
'VALUE' => $currencyHelper->format($subtotal,$data->cart->order_currency_id)
);
}
if(bccomp(sprintf('%F',$data->cart->order_discount_price),0,5) != 0) {
if($config->get('price_with_tax')) {
$t = $currencyHelper->format($data->cart->order_discount_price*-1,$data->cart->order_currency_id);
}else{
$t = $currencyHelper->format(($data->cart->order_discount_price-@$data->cart->order_discount_tax)*-1,$data->cart->order_currency_id);
}
$cartFooters[] = array(
'CLASS' => 'coupon',
'NAME' => \Joomla\CMS\Language\Text::_('HIKASHOP_COUPON'),
'VALUE' => $t
);
}
if(bccomp(sprintf('%F',$data->cart->order_shipping_price),0,5) != 0){
if($config->get('price_with_tax')) {
$t = $currencyHelper->format($data->cart->order_shipping_price,$data->cart->order_currency_id);
}else{
$t = $currencyHelper->format($data->cart->order_shipping_price-@$data->cart->order_shipping_tax,$data->cart->order_currency_id);
}
$cartFooters[] = array(
'CLASS' => 'shipping',
'NAME' => \Joomla\CMS\Language\Text::_('HIKASHOP_SHIPPING'),
'VALUE' => $t
);
}
if(bccomp(sprintf('%F',$data->cart->order_payment_price),0,5) != 0){
if($config->get('price_with_tax')) {
$t = $currencyHelper->format($data->cart->order_payment_price, $data->cart->order_currency_id);
} else {
$t = $currencyHelper->format($data->cart->order_payment_price - @$data->cart->order_payment_tax, $data->cart->order_currency_id);
}
$cartFooters[] = array(
'CLASS' => 'payment',
'NAME' => \Joomla\CMS\Language\Text::_('HIKASHOP_PAYMENT'),
'VALUE' => $t
);
}
if(!empty($data->cart->additional)) {
$exclude_additionnal = explode(',', $config->get('order_additional_hide', ''));
foreach($data->cart->additional as $additional) {
if(in_array($additional->order_product_name, $exclude_additionnal))
continue;
if( (!empty($additional->order_product_price) && ($additional->order_product_price > 0) ) || empty($additional->order_product_options)) {
if($config->get('price_with_tax')){
$t = $currencyHelper->format($additional->order_product_price + @$additional->order_product_tax, $data->cart->order_currency_id);
}else{
$t = $currencyHelper->format($additional->order_product_price, $data->cart->order_currency_id);
}
} else {
$t = $additional->order_product_options;
}
$cartFooters[] = array(
'CLASS' => 'additional'.preg_replace('#[^a-z0-9_]#i','', strip_tags($additional->order_product_name)),
'NAME' => \Joomla\CMS\Language\Text::_($additional->order_product_name),
'VALUE' => $t
);
}
}
if($data->cart->full_total->prices[0]->price_value!=$data->cart->full_total->prices[0]->price_value_with_tax) {
if($config->get('detailed_tax_display') && !empty($data->cart->order_tax_info)) {
foreach($data->cart->order_tax_info as $k => $tax) {
$cartFooters[] = array(
'CLASS' => 'tax_'.$k,
'NAME' => hikashop_translate($tax->tax_namekey),
'VALUE' => $currencyHelper->format($tax->tax_amount,$data->cart->order_currency_id)
);
}
} else {
$cartFooters[] = array(
'CLASS' => 'total_without_tax',
'NAME' => \Joomla\CMS\Language\Text::_('ORDER_TOTAL_WITHOUT_VAT'),
'VALUE' => $currencyHelper->format($data->cart->full_total->prices[0]->price_value,$data->cart->order_currency_id)
);
}
$cartFooters[] = array(
'CLASS' => 'total_with_tax',
'NAME' => \Joomla\CMS\Language\Text::_('ORDER_TOTAL_WITH_VAT'),
'VALUE' => $currencyHelper->format($data->cart->full_total->prices[0]->price_value_with_tax,$data->cart->order_currency_id)
);
} else {
$cartFooters[] = array(
'CLASS' => 'total_with_tax',
'NAME' => \Joomla\CMS\Language\Text::_('HIKASHOP_TOTAL'),
'VALUE' => $currencyHelper->format($data->cart->full_total->prices[0]->price_value_with_tax,$data->cart->order_currency_id)
);
}
$templates['ORDER_FOOTER'] = $cartFooters;
}
if(!empty($data->cart->order_payment_method)) {
if(!is_numeric($data->cart->order_payment_id)){
$vars['PAYMENT'] = $data->cart->order_payment_method.' '.$data->cart->order_payment_id;
}else{
$paymentClass = hikashop_get('class.payment');
$payment = $paymentClass->get($data->cart->order_payment_id);
if(!empty($payment))
$vars['PAYMENT'] = $payment->payment_name;
else
$vars['PAYMENT'] = $data->cart->order_payment_method;
unset($paymentClass);
}
}
if(!empty($data->cart->order_shipping_id)) {
$shippingClass = hikashop_get('class.shipping');
if(!empty($data->cart->order_shipping_method)) {
if(!is_numeric($data->cart->order_shipping_id)){
$shipping_name = $shippingClass->getShippingName($data->cart->order_shipping_method, $data->cart->order_shipping_id);
$vars['SHIPPING'] = $shipping_name;
$vars['SHIPPING_TXT'] = $vars['SHIPPING'];
}else{
$shipping = $shippingClass->get($data->cart->order_shipping_id);
$vars['SHIPPING'] = !empty($shipping) ? $shipping->shipping_name : $data->cart->order_shipping_method;
$vars['SHIPPING_TXT'] = $vars['SHIPPING'];
}
} else {
$shippings_data = array();
$shipping_ids = explode(';', $data->cart->order_shipping_id);
foreach($shipping_ids as $key) {
$shipping_data = '';
list($k, $w) = explode('@', $key);
$shipping_id = $k;
if(isset($data->cart->shippings[$shipping_id])) {
$shipping = $data->cart->shippings[$shipping_id];
$shipping_data = $shipping->shipping_name;
} else {
foreach($data->cart->products as $order_product) {
if($order_product->order_product_shipping_id == $key) {
if(!is_numeric($order_product->order_product_shipping_id)){
$shipping_name = $shippingClass->getShippingName($order_product->order_product_shipping_method, $shipping_id);
$shipping_data = $shipping_name;
}else{
$shipping_method_data = $shippingClass->get($shipping_id);
$shipping_data = !empty($shipping_method_data) ? $shipping_method_data->shipping_name : $order_product->order_product_shipping_method;
}
break;
}
}
if(empty($shipping_data))
$shipping_data = '[ ' . $key . ' ]';
}
if(isset($data->cart->order_shipping_params->prices[$key])) {
$price_params = $data->cart->order_shipping_params->prices[$key];
if($config->get('price_with_tax')){
$shipping_data .= ' (' . $currencyHelper->format($price_params->price_with_tax, $data->cart->order_currency_id) . ')';
}else{
$shipping_data .= ' (' . $currencyHelper->format($price_params->price_with_tax - @$price_params->tax, $data->cart->order_currency_id) . ')';
}
}
$shippings_data[] = $shipping_data;
}
if(!empty($shippings_data)) {
$vars['SHIPPING'] = '<ul><li>'.implode('</li><li>', $shippings_data).'</li></ul>';
$vars['SHIPPING_TXT'] = ' - ' . implode("\r\n - ", $shippings_data);
}
}
unset($shippingClass);
} else {
$vars['SHIPPING'] = '';
}
ob_start();
$sep = '';
if(hikashop_level(2)) {
$fields = $fieldsClass->getFields('display:mail_status_notif=1',$data->cart,'order','');
foreach($fields as $fieldName => $oneExtraField) {
if(isset($data->$fieldName) && !isset($data->cart->$fieldName))
$data->cart->$fieldName = $data->$fieldName;
if($oneExtraField->field_type != 'customtext' && empty($data->cart->$fieldName))
continue;
$oneExtraField->currentElement = $data->cart;
echo $sep . $fieldsClass->trans($oneExtraField->field_realname).' : '.$fieldsClass->show($oneExtraField, @$data->cart->$fieldName, 'user_email',$data->cart->order_token);
$sep = '<br />';
}
}
\Joomla\CMS\Plugin\PluginHelper::importPlugin('hikashop');
$app = \Joomla\CMS\Factory::getApplication();
$app->triggerEvent('onAfterOrderProductsListingDisplay', array(&$data->cart, 'email_notification_html'));
$content = ob_get_clean();
$vars['ORDER_SUMMARY'] = trim($content);
$unpaid_statuses = explode(',', $config->get('order_unpaid_statuses', 'created'));
if(in_array($data->order_status, $unpaid_statuses) && !empty($data->cart->order_payment_method)) {
ob_start();
if($data->cart->order_full_price>0 && hikashop_level(1) && $config->get('allow_payment_button',1)) {
echo '<p>' . \Joomla\CMS\Language\Text::_('ORDER_VALID_AFTER_PAYMENT') . '</p>';
$pay_url = 'index.php?option=com_hikashop&ctrl=order&task=pay&order_id='.$data->order_id.$url_itemid;
if(empty($customer->user_cms_id) && !empty($data->cart->order_token)) {
$pay_url .= '&order_token='.urlencode($data->cart->order_token);
}
$pay_url = hikashop_frontendLink($pay_url);
if($config->get('force_ssl',0) && strpos('https://',$pay_url) === false) {
$pay_url = str_replace('http://','https://',$pay_url);
}
echo '<p><a class="cart_button hika_template_color" style="display:inline-block;background-color:#2f6f9f;color:#ffffff;font-weight:bold;text-decoration:none;padding:12px 24px;border-radius:8px;" href="'. $pay_url .'">'.\Joomla\CMS\Language\Text::_('PAY_NOW') . '</a></p>';
}
$content = ob_get_clean();
$vars['ORDER_SUMMARY'] .= $content;
}
if($config->get('register_after_guest', 1) && empty($customer->user_cms_id) && !empty($data->order_token)){
$params = \Joomla\CMS\Component\ComponentHelper::getParams('com_users');
if((int)$params->get('allowUserRegistration') != 0) {
$register_url = 'index.php?option=com_hikashop&ctrl=user&task=guest_form&order_id='.$data->order_id.$url_itemid.'&order_token='.urlencode($data->order_token);
$register_url = hikashop_frontendLink($register_url);
$vars['ORDER_SUMMARY'] .= '<p><a href="'. $register_url .'">'.\Joomla\CMS\Language\Text::_('CLICK_HERE_TO_EASILY_CREATE_YOUR_USER_ACCOUNT') . '</a></p>';
}
}
$vars['BILLING_ADDRESS'] = '';
$vars['SHIPPING_ADDRESS'] = '';
$addressClass = hikashop_get('class.address');
if(!empty($data->cart->billing_address) && !empty($data->cart->fields)){
$vars['BILLING_ADDRESS'] = $addressClass->displayAddress($data->cart->fields,$data->cart->billing_address,$view);
}
if(!empty($data->cart->override_shipping_address)) {
$vars['SHIPPING_ADDRESS'] = $data->cart->override_shipping_address;
} elseif(!empty($data->cart->order_shipping_id) && !empty($data->cart->shipping_address) && !empty($data->cart->fields)) {
$vars['SHIPPING_ADDRESS'] = $addressClass->displayAddress($data->cart->fields,$data->cart->shipping_address,$view);
} else {
$vars['SHIPPING_ADDRESS'] = $vars['BILLING_ADDRESS'];
}
<?php
$digitalProductIds = array(21);
$hasDigital = false;
foreach($data->cart->products as $item) {
$ids = array((int)$item->product_id);
$p = @$productClass->all_products[$item->product_id];
if(!empty($p->product_parent_id))
$ids[] = (int)$p->product_parent_id;
if(array_intersect($ids, $digitalProductIds)) {
$hasDigital = true;
break;
}
}
if($hasDigital) {
echo '<p><a href="'.HIKASHOP_LIVE.'10-videos-and-recipes">Order Confirmed - Access your Recipes and Videos Here</a></p>';
}
?>
The email received shows the access to the video/recipes as it should at the bottom but it's also added at the top
When I "View Modifications" the "Original" shows * @version 6.7.0 and the O"Override" is * @version 6.7.0
I'm thinking these are all interconnected but may be totally wrong
Last edit: 2 hours 55 minutes ago by yerg55. Reason: Additional information
Please Log in or Create an account to join the conversation.
1 minute ago #100000298
by nicolas
Replied by nicolas on topic Email template causing issues
The error comes from the end of your preload override (order_status_notification.confirmed.preload.php). A preload file is one single block of PHP that is never closed, so when you add a new "<?php ... ?>" block after the last line, PHP finds "<!--?php" in the middle of PHP code and stops with "syntax error, unexpected token "<", expecting end of file". Because of that, the confirmed notification cannot be built at all.
The link appearing at the top of the email has a second cause: a preload runs before the email's HTML is built, so anything it "echo"es is output before the whole email, above the header. That is also where the "ids: 21,4,5,8" line in your screenshot comes from: an echo left in a preload. A preload should not echo anything; it should put the text in a variable that the HTML version displays. The "Additional information" area of the email shows the ORDER_SUMMARY variable, so adding your link to it puts it at the bottom, where you want it.
To fix it, in System > Emails, edit the preload version of the confirmed notification, delete everything from your "<?php $digitalProductIds = array(21);" line to the final "?>", and paste in its place, at the very end of the file, the content of the attached file recipes-videos-link.txt. It does the same check (product 21 or one of its variants) but adds the link to the "Additional information" area instead of echoing it. Do not add "<!--?php" or "?-->" around it. The documentation of the preload version is here: www.hikashop.com/support/documentation/2...shop-email-form.html
Then do the same in the other preload you edited, the one used by the email in your screenshot (the notification sent when the order is created): remove the echo lines (the "ids: ..." one and the one printing the link). That email already shows "Access Your Videos and Recipes Here" in its "Additional information" area, so the link only needs to stay there and it will no longer appear twice.
The "@version 6.7.0" line you see in both the original and the override in "View modifications" is only the file's header and is not related to the problem: your override is based on the current file.
The link appearing at the top of the email has a second cause: a preload runs before the email's HTML is built, so anything it "echo"es is output before the whole email, above the header. That is also where the "ids: 21,4,5,8" line in your screenshot comes from: an echo left in a preload. A preload should not echo anything; it should put the text in a variable that the HTML version displays. The "Additional information" area of the email shows the ORDER_SUMMARY variable, so adding your link to it puts it at the bottom, where you want it.
To fix it, in System > Emails, edit the preload version of the confirmed notification, delete everything from your "<?php $digitalProductIds = array(21);" line to the final "?>", and paste in its place, at the very end of the file, the content of the attached file recipes-videos-link.txt. It does the same check (product 21 or one of its variants) but adds the link to the "Additional information" area instead of echoing it. Do not add "<!--?php" or "?-->" around it. The documentation of the preload version is here: www.hikashop.com/support/documentation/2...shop-email-form.html
Then do the same in the other preload you edited, the one used by the email in your screenshot (the notification sent when the order is created): remove the echo lines (the "ids: ..." one and the one printing the link). That email already shows "Access Your Videos and Recipes Here" in its "Additional information" area, so the link only needs to stay there and it will no longer appear twice.
The "@version 6.7.0" line you see in both the original and the override in "View modifications" is only the file's header and is not related to the problem: your override is based on the current file.
Please Log in or Create an account to join the conversation.
Time to create page: 0.104 seconds