Гость
28 Окт 2013 15:09

Hi, I just purchased the 2Checkout Plugin. Everything is working fine except that once the order is completed, no confirmation email is sent to the customer or me. The order status is changed to "confirmed" just no email sent. This is important because the confirmation email contains the link for digital goods.

When I use the Paypal plugin, it sends a confirmation email. What can I do to change this?

Последние изменения: 17 Фев 2015


Sergey
Total posts: 13,748
29 Окт 2013 00:34

2co plugin for what? We have number of them. Hikashop, Emerald, Cobalt.


Гость
29 Окт 2013 11:00

Sorry, for Joomla 2.5.


Sergey
Total posts: 13,748
30 Окт 2013 00:06

Ok. then emails are sent by Hikashop not by payment plugin. And also there is email that is sent by 2CO.


Гость
30 Окт 2013 10:51

Do you have any ideas of what could have changed? It was sending the confirmation email when I was using the Paypal plugin.

Thanks for your help!


Гость
30 Окт 2013 11:04

Just checked with Hikashop and here was their reply:

"Then the issue is probably in the payment plugin which doesn't tell HikaShop to send the email (it's up to the payment plugin to say if he wants hikashop to send the notification or not when changing the status of an order). So I would recommend to check on that with the support of the plugin you're using."

Any ideas? Thanks so much!


Sergey
Total posts: 13,748
31 Окт 2013 00:40

Please send me PayPal plugin as example I'll check how it does it.


Гость
31 Окт 2013 18:35

Hi Sergey,

It is the standard Paypal plugin that comes with Hikashop (already installed). Here is a link to info about it:

[ http://www.hikashop.com/support/documentation/32-hikashop-payment-paypal-form.html

]( http://www.hikashop.com/support/documentation/32-hikashop-payment-paypal-form.html )

Thanks for looking into this! I am hoping we can get it figured out before I have an order for a digital product that needs to be downloaded.


Sergey
Total posts: 13,748
31 Окт 2013 23:48

I have updated plugin please download. And in description please read at the very bottom how to setup email body.


Гость
05 Нояб 2013 21:01

Hi Sergey,

I uninstalled the 2CO plugin and installed the one that is now in the downloads section (version 1.0) and added the language override as stated in the instructions. Nothing has changed. Still no confirmation email to either the purchaser or the administrator when a purchase is made.

What do we try next? Thanks!


Sergey
Total posts: 13,748
05 Нояб 2013 22:48

I am sorry. I missed Joomla version again. I updated Joomla 3.0 plugin version.

I updated Joomla 2.5 version too. Please try v 1.10


Гость
06 Нояб 2013 10:42

Hi Sergey,

Thanks for updating. Unfortunately when I uploaded the new plugin I get an error. When the customer gets to the final page of checkout (the one that redirects them to 2Checkout) I receive this message on a blank page:

http://www.sustainablepreparedness.com/index.php/products/checkout/notify/notif_payment-pay2co/tmpl-component

So I had to switch back to a previous version of the plugin. I added the language override as specified in your instructions. What do we do now? Thanks!


Гость
06 Нояб 2013 11:34

Here is some code that might be helpful from the Paypal plugin. If you search for "email", near the bottom you will find some code that I think is what triggers a confirmation email when the order status changes to "confirmed"...


text/x-generic paypal.php PHP script text <?php /** * @package HikaShop for Joomla! * @version 2.2.2 * @author hikashop.com * @copyright (C) 2010-2013 HIKARI SOFTWARE. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ defined('_JEXEC') or die('Restricted access'); ?><?php class plgHikashoppaymentPaypal extends hikashopPaymentPlugin { var $accepted_currencies = array( 'AUD','BRL','CAD','EUR','GBP','JPY','USD','NZD','CHF','HKD','SGD','SEK', 'DKK','PLN','NOK','HUF','CZK','MXN','MYR','PHP','TWD','THB','ILS','TRY' ); var $multiple = true; var $name = 'paypal'; var $doc_form = 'paypal'; function __construct(&$subject, $config) { parent::__construct($subject, $config); } function onBeforeOrderCreate(&$order,&$do){ if(parent::onBeforeOrderCreate($order, $do) === true) return true; if(empty($this->payment_params->email) || empty($this->payment_params->url)) { $this->app->enqueueMessage('Please check your &quot;PayPal&quot; plugin configuration'); $do = false; } } function onAfterOrderConfirm(&$order, &$methods, $method_id) { parent::onAfterOrderConfirm($order, $methods, $method_id); if($this->currency->currency_locale['int_frac_digits'] > 2) $this->currency->currency_locale['int_frac_digits'] = 2; $notify_url = HIKASHOP_LIVE.'index.php?option=com_hikashop&ctrl=checkout&task=notify&notif_payment='.$this->name.'&tmpl=component&lang='.$this->locale . $this->url_itemid; $return_url = HIKASHOP_LIVE.'index.php?option=com_hikashop&ctrl=checkout&task=after_end&order_id='.$order->order_id . $this->url_itemid; $cancel_url = HIKASHOP_LIVE.'index.php?option=com_hikashop&ctrl=order&task=cancel_order&order_id='.$order->order_id . $this->url_itemid; $tax_total = ''; $discount_total = ''; $debug = $this->payment_params->debug; if(!isset($this->payment_params->no_shipping)) $this->payment_params->no_shipping = 1; if(!empty($this->payment_params->rm)) $this->payment_params->rm = 2; $vars = array( 'cmd' => '_ext-enter', 'redirect_cmd' => '_cart', 'upload' => '1', 'business' => $this->payment_params->email, 'receiver_email' => $this->payment_params->email, 'invoice' => $order->order_id, 'currency_code' => $this->currency->currency_code, 'return' => $return_url, 'notify_url' => $notify_url, 'cancel_return' => $cancel_url, 'undefined_quantity' => '0', 'test_ipn' => $debug, 'no_shipping' => $this->payment_params->no_shipping, 'no_note' => !@$this->payment_params->notes, 'charset' => 'utf-8', 'rm' => (int)@$this->payment_params->rm, 'bn' => 'HikariSoftware_Cart_WPS' ); if(!empty($this->payment_params->address_type)) { $address_type = $this->payment_params->address_type . '_address'; $address = $this->app->getUserState(HIKASHOP_COMPONENT . '.' . $address_type); if(!empty($address)) { if(!isset($this->payment_params->address_override)) { $this->payment_params->address_override = '1'; } $vars['address_override'] = $this->payment_params->address_override; $vars['first_name'] = @$order->cart->$address_type->address_firstname; $vars['last_name'] = @$order->cart->$address_type->address_lastname; $address1 = ''; $address2 = ''; if(!empty($order->cart->$address_type->address_street2)) $address2 = substr($order->cart->$address_type->address_street2, 0, 99); if(!empty($order->cart->$address_type->address_street)) { if(strlen($order->cart->$address_type->address_street) > 100) { $address1 = substr($order->cart->$address_type->address_street, 0, 99); if(empty($address2)) $address2 = substr($order->cart->$address_type->address_street, 99, 199); } else { $address1 = $order->cart->$address_type->address_street; } } $vars['address1'] = $address1; $vars['address2'] = $address2; $vars['zip'] = @$order->cart->$address_type->address_post_code; $vars['city'] = @$order->cart->$address_type->address_city; if((!isset($order->cart->$address_type->address_state->zone_code_3) || is_numeric($order->cart->$address_type->address_state->zone_code_3)) && !empty($order->cart->$address_type->address_country->zone_name)){ $vars['state'] = @$order->cart->$address_type->address_state->zone_name; }else{ $vars['state'] = @$order->cart->$address_type->address_state->zone_code_3; } $vars['country'] = @$order->cart->$address_type->address_country->zone_code_2; $vars['email'] = $this->user->user_email; $vars['night_phone_b'] = @$order->cart->$address_type->address_telephone; } elseif(!empty($order->cart->billing_address->address_country->zone_code_2)) { $vars['lc'] = $order->cart->billing_address->address_country->zone_code_2; } } elseif(!empty($order->cart->billing_address->address_country->zone_code_2)) { $vars['lc'] = $order->cart->billing_address->address_country->zone_code_2; } if(!empty($this->payment_params->cpp_header_image)) { $vars['cpp_header_image'] = $this->payment_params->cpp_header_image; } if(empty($this->payment_params->details)) { $vars['amount_1'] = round($order->cart->full_total->prices[0]->price_value_with_tax, (int)$this->currency->currency_locale['int_frac_digits']); $vars['item_name_1'] = JText::_('CART_PRODUCT_TOTAL_PRICE'); } else { $i = 1; $tax = 0; $config =& hikashop_config(); $group = $config->get('group_options',0); foreach($order->cart->products as $product) { if($group && $product->order_product_option_parent_id) continue; $vars['item_name_' . $i] = substr(strip_tags($product->order_product_name), 0, 127); $vars['item_number_' . $i] = $product->order_product_code; $vars['amount_'.$i] = round($product->order_product_price, (int)$this->currency->currency_locale['int_frac_digits']); $vars['quantity_' . $i] = $product->order_product_quantity; $tax += round($product->order_product_tax, (int)$this->currency->currency_locale['int_frac_digits']) * $product->order_product_quantity; $i++; } if(!empty($order->order_shipping_price) && bccomp($order->order_shipping_price, 0, 5)) { $vars['item_name_' . $i] = JText::_('HIKASHOP_SHIPPING'); $vars['amount_' . $i] = round($order->order_shipping_price - @$order->order_shipping_tax, (int)$this->currency->currency_locale['int_frac_digits']); $tax += round($order->order_shipping_tax, (int)$this->currency->currency_locale['int_frac_digits']); $vars['quantity_' . $i] = 1; $i++; } if(!empty($order->order_payment_price) && bccomp($order->order_payment_price, 0, 5)) { $vars['item_name_' . $i] = JText::_('HIKASHOP_PAYMENT'); $vars['amount_' . $i] = round($order->order_payment_price, (int)$this->currency->currency_locale['int_frac_digits']); $vars['quantity_' . $i] = 1; $i++; } if(bccomp($tax, 0, 5)) $vars['tax_cart'] = $tax; if(!empty($order->cart->coupon)) $vars['discount_amount_cart'] = round($order->order_discount_price, (int)$this->currency->currency_locale['int_frac_digits']); } if((isset($this->payment_params->validation) && $this->payment_params->validation) || (isset($this->payment_params->enable_validation) && !$this->payment_params->enable_validation)) { $vars['paymentaction'] = 'authorization'; } if(empty($this->payment_params->url)) $this->payment_params->url = ' https://www.paypal.com/cgi-bin/webscr '; $this->vars = $vars; return $this->showPage('end'); } function onPaymentNotification(&$statuses) { $vars = array(); $data = array(); $filter = JFilterInput::getInstance(); foreach($_REQUEST as $key => $value) { $key = $filter->clean($key); if(preg_match('#^[0-9a-z_-]{1,30}$#i', $key) && !preg_match('#^cmd$#i', $key)) { $value = JRequest::getString($key); $vars[$key] = $value; $data[] = $key . '=' . urlencode($value); } } $data = implode('&', $data) . '&cmd=_notify-validate'; $dbOrder = $this->getOrder((int)@$vars['invoice']); $this->loadPaymentParams($dbOrder); if(empty($this->payment_params)) return false; $this->loadOrderData($dbOrder); if(!$this->payment_params->notification) return false; if($this->payment_params->debug) echo print_r($vars, true) . "\r\n\r\n"; if(empty($dbOrder)) { echo 'Could not load any order for your notification ' . @$vars['invoice']; return false; } if($this->payment_params->debug) { echo print_r($dbOrder, true) . "\r\n\r\n"; } $order_id = $dbOrder->order_id; $url = HIKASHOP_LIVE.'administrator/index.php?option=com_hikashop&ctrl=order&task=edit&order_id=' . $order_id; $order_text = "\r\n" . JText::sprintf('NOTIFICATION_OF_ORDER_ON_WEBSITE', $dbOrder->order_number, HIKASHOP_LIVE); $order_text .= "\r\n" . str_replace('<br/>', "\r\n", JText::sprintf('ACCESS_ORDER_WITH_LINK', $url)); if(!empty($this->payment_params->ips)){ $ip = hikashop_getIP(); $ips = str_replace(array('.', '*', ','), array('\.', '[0-9]+', '|'), $this->payment_params->ips); if(!preg_match('#('.implode('|',$ips).')#', $ip)) { $email = new stdClass(); $email->subject = JText::sprintf('NOTIFICATION_REFUSED_FOR_THE_ORDER','Paypal') . ' ' . JText::sprintf('IP_NOT_VALID', $dbOrder->order_number); $email->body = str_replace('<br/>',"\r\n",JText::sprintf('NOTIFICATION_REFUSED_FROM_IP','Paypal',$ip,implode("\r\n",$this->payment_params->ips)))."\r\n\r\n".JText::sprintf('CHECK_DOCUMENTATION',HIKASHOP_HELPURL.'payment-paypal-error#ip').$order_text; $action = false; $this->modifyOrder($action, null, null, $email); JError::raiseError(403, JText::_('Access Forbidden')); return false; } } if(empty($this->payment_params->url)) $this->payment_params->url = ' https://www.paypal.com/cgi-bin/webscr '; $url = parse_url($this->payment_params->url); if(!isset($url['query'])) $url['query'] = ''; if(!isset($url['port'])) { if(!empty($url['scheme']) && in_array($url['scheme'], array('https', 'ssl'))) { $url['port'] = 443; } else { $url['port'] = 80; } } if(!empty($url['scheme']) && in_array($url['scheme'], array('https', 'ssl'))) { $url['host_socket'] = 'ssl://' . $url['host']; } else { $url['host_socket'] = $url['host']; } if($this->payment_params->debug) echo print_r($url, true) . "\r\n\r\n"; $fp = fsockopen($url['host_socket'], $url['port'], $errno, $errstr, 30); if(!$fp) { $email = new stdClass(); $email->subject = JText::sprintf('NOTIFICATION_REFUSED_FOR_THE_ORDER','Paypal').' '.JText::sprintf('PAYPAL_CONNECTION_FAILED',$dbOrder->order_number); $email->body = str_replace('<br/>',"\r\n",JText::sprintf('NOTIFICATION_REFUSED_NO_CONNECTION','Paypal'))."\r\n\r\n".JText::sprintf('CHECK_DOCUMENTATION',HIKASHOP_HELPURL.'payment-paypal-error#connection') . $order_text; $action = false; $this->modifyOrder($action, null, null, $email); JError::raiseError( 403, JText::_( 'Access Forbidden' )); return false; } $uri = $url['path'] . ($url['query'] != '' ? '?' . $url['query'] : ''); $header = 'POST '.$uri.' HTTP/1.1'."\r\n". 'User-Agent: PHP/'.phpversion()."\r\n". 'Referer: '.hikashop_currentURL()."\r\n". 'Server: '.$_SERVER['SERVER_SOFTWARE']."\r\n". 'Host: '.$url['host']."\r\n". 'Content-Type: application/x-www-form-urlencoded'."\r\n". 'Content-Length: '.strlen($data)."\r\n". 'Accept: */'.'*'."\r\n". 'Connection: close'."\r\n\r\n"; fwrite($fp, $header . $data); $response = ''; while(!feof($fp)) { $response .= fgets($fp, 1024); } fclose ($fp); if($this->payment_params->debug) { echo print_r($header, true) . "\r\n\r\n"; echo print_r($data, true) . "\r\n\r\n"; echo print_r($response, true) . "\r\n\r\n"; } $response = substr($response, strpos($response, "\r\n\r\n") + strlen("\r\n\r\n")); $verified = preg_match('#VERIFIED#i', $response); if(!$verified) { $email = new stdClass(); if(preg_match('#INVALID#i', $response)) { $email->subject = JText::sprintf('NOTIFICATION_REFUSED_FOR_THE_ORDER','Paypal').'invalid transaction'; $email->body = JText::sprintf("Hello,\r\n A paypal notification was refused because it could not be verified by the paypal server")."\r\n\r\n".JText::sprintf('CHECK_DOCUMENTATION',HIKASHOP_HELPURL.'payment-paypal-error#invalidtnx').$order_text; if($this->payment_params->debug) echo 'invalid transaction'."\n\n\n"; } else { $email->subject = JText::sprintf('NOTIFICATION_REFUSED_FOR_THE_ORDER','Paypal').'invalid response'; $email->body = JText::sprintf("Hello,\r\n A paypal notification was refused because the response from the paypal server was invalid")."\r\n\r\n".JText::sprintf('CHECK_DOCUMENTATION',HIKASHOP_HELPURL.'payment-paypal-error#invalidresponse').$order_text; if($this->payment_params->debug) echo 'invalid response'."\n\n\n"; } $action = false; $this->modifyOrder($action, null, null, $email); return false; } $completed = preg_match('#Completed#i', $vars['payment_status']); $pending = preg_match('#Pending#i', $vars['payment_status']); if(!$completed && !$pending) { $email = new stdClass(); $email->subject = JText::sprintf('PAYMENT_NOTIFICATION_FOR_ORDER','Paypal',$vars['payment_status'],$dbOrder->order_number); $email->body = str_replace('<br/>',"\r\n",JText::sprintf('PAYMENT_NOTIFICATION_STATUS','Paypal',$vars['payment_status'])).' '.JText::_('STATUS_NOT_CHANGED')."\r\n\r\n".JText::sprintf('CHECK_DOCUMENTATION',HIKASHOP_HELPURL.'payment-paypal-error#status').$order_text; $action = false; $this->modifyOrder($action, null, null, $email); if($this->payment_params->debug) echo 'payment ' . $vars['payment_status'] . "\r\n\r\n"; return false; } echo 'PayPal transaction id: '.$vars['txn_id'] . "\r\n\r\n"; $history = new stdClass(); $history->notified = 0; $history->amount = @$vars['mc_gross'].@$vars['mc_currency']; $history->data = ob_get_clean(); $price_check = round($dbOrder->order_full_price, (int)$this->currency->currency_locale['int_frac_digits']); if($price_check != @$vars['mc_gross'] || $this->currency->currency_code != @$vars['mc_currency']) { $email = new stdClass(); $email->subject = JText::sprintf('NOTIFICATION_REFUSED_FOR_THE_ORDER','Paypal').JText::_('INVALID_AMOUNT'); $email->body = str_replace('<br/>', "\r\n", JText::sprintf('AMOUNT_RECEIVED_DIFFERENT_FROM_ORDER', 'Paypal', $history->amount, $price_check . $this->currency->currency_code)) . "\r\n\r\n" . JText::sprintf('CHECK_DOCUMENTATION', HIKASHOP_HELPURL . 'payment-paypal-error#amount') . $order_text; $this->modifyOrder($order_id, $this->payment_params->invalid_status, $history, $email); return false; } if($completed){ $order_status = $this->payment_params->verified_status; }else{ $order_status = $this->payment_params->pending_status; $order_text = JText::sprintf('CHECK_DOCUMENTATION',HIKASHOP_HELPURL.'payment-paypal-error#pending')."\r\n\r\n".$order_text; } if($dbOrder->order_status == $order_status) return true; $config =& hikashop_config(); if($config->get('order_confirmed_status', 'confirmed') == $order_status) { $history->notified = 1; } $email = new stdClass(); $email->subject = JText::sprintf('PAYMENT_NOTIFICATION_FOR_ORDER','Paypal',$vars['payment_status'],$dbOrder->order_number); $email->body = str_replace('<br/>',"\r\n",JText::sprintf('PAYMENT_NOTIFICATION_STATUS','Paypal',$vars['payment_status'])).' '.JText::sprintf('ORDER_STATUS_CHANGED',$order_status)."\r\n\r\n".$order_text; $this->modifyOrder($order_id, $order_status, $history, $email); return true; } function onPaymentConfiguration(&$element) { $subtask = JRequest::getCmd('subtask', ''); if($subtask == 'ips') { $ips = null; echo implode(',', $this->_getIPList($ips)); exit; } parent::onPaymentConfiguration($element); $this->address = hikashop_get('type.address'); if(empty($element->payment_params->email)) { $app = JFactory::getApplication(); $lang = JFactory::getLanguage(); $locale = strtolower(substr($lang->get('tag'), 0, 2)); $app->enqueueMessage(JText::sprintf('ENTER_INFO_REGISTER_IF_NEEDED', 'PayPal', JText::_('HIKA_EMAIL'), 'PayPal', ' https://www.paypal.com/ ' . $locale . '/mrb/pal=SXL9FKNKGAEM8')); } } function onPaymentConfigurationSave(&$element) { if(!empty($element->payment_params->ips)) $element->payment_params->ips = explode(',', $element->payment_params->ips); return true; } function getPaymentDefaultValues(&$element) { $element->payment_name = 'PayPal'; $element->payment_description='You can pay by credit card or paypal using this payment method'; $element->payment_images = 'MasterCard,VISA,Credit_card,PayPal'; $element->payment_params->url = ' https://www.paypal.com/cgi-bin/webscr '; $element->payment_params->notification = 1; $element->payment_params->ips = ''; $element->payment_params->details = 0; $element->payment_params->invalid_status = 'cancelled'; $element->payment_params->pending_status = 'created'; $element->payment_params->verified_status = 'confirmed'; $element->payment_params->address_override = 1; } function _getIPList(&$ipList) { $hosts = array( 'www.paypal.com', 'notify.paypal.com', 'ipn.sandbox.paypal.com' ); $ipList = array(); foreach($hosts as $host) { $ips = gethostbynamel($host); if(!empty($ips)) { if(empty($ipList)) $ipsList = $ips; else $ipList = array_merge($ipList, $ips); } } if(empty($ipList)) return $ipList; $newList = array(); foreach($ipList as $k => $ip) { $ipParts = explode('.', $ip); if(count($ipParts) == 4) { array_pop($ipParts); $ip = implode('.', $ipParts) . '.*'; } if(!in_array($ip, $newList)) $newList[] = $ip; } return $newList; } }

Sergey
Total posts: 13,748
07 Нояб 2013 06:58

What was there error?


Гость
08 Нояб 2013 11:20

In the final step of the checkout in Hikashop, the customer is supposed to be redirected to the 2Checkout website for payment. Instead of redirecting the customer to the 2Checkout website for payment processing, it only dsiplays a blank page with the following message:

http://www.sustainablepreparedness.com/index.php/products/checkout/notify/notif_payment-pay2co/tmpl-component

That is all that the message says. No explanation.

Please help as I am needing to get my sales of digital goods worked out and right now the only way it works is if I manually send each customer an email with their link right after they purchase. This is not a workable solution right now. So thanks for your work. Hopefully we can get this worked out soon!


Гость
08 Нояб 2013 11:22

I forgot to mention that because of the problem mentioned above, I switched back to one of the previous versions of your plugin so customers can continue to checkout. So if you try checking out on my website shopping cart you will not get the error message now.


Гость
11 Нояб 2013 10:06

Hi Sergey, Just checking to see if we have a solution yet? All I need is for the confirmation email to be sent out when 2Checkout changes the order status to "confirmed". Your help is greatly appreciated to get this plugin where it is functional.

Thanks!


Sergey
Total posts: 13,748
11 Нояб 2013 12:25

Hello,

Unluckily you posted on Friday at the end of the day. Saturday and Sunday are weekends and we do not work. I apologize for that.

I'll fix this problem shortly and update plugin. Please in private comment give me your site access if possible so i could test it.


Sergey
Total posts: 13,748
12 Нояб 2013 01:25

I* checked everything and I cannot find why it happens. Please provide super admin level access to your site and I'll check it online. I cannot reproduce it locally.


Гость
13 Нояб 2013 15:44

Hi Sergey, I tried emailing but am not sure if my email is getting through to you. So if there is a better way to contact you, please let me know.

Thanks!


Sergey
Total posts: 13,748
13 Нояб 2013 22:12

The best way is here. I check topics here much more frequently than my email box. Use lock icon to place private text block which will be visible only for me.

Работает на Cobalt