Jump to content

Looking to modify email sent to admin after payment is made


Guest GospelLabs

Recommended Posts

Guest GospelLabs

Hi all,

I am looking to modify the payment received email sent to the ADMIN to include more than just the order number, but also include the products purchased.

Can anyone give me a clue to what needs to be done and where. I believe the file needed to be edited is classes::cart::order.php

I am just not sure where in the file.

Link to comment
Share on other sites

Guest GospelLabs

Can someone tell me if this would work?

Classes::Cart:Order.php in the OrderStatus function. I just basically

copied the "case 3: ## Order Complete (Payment Taken/Cleared)"

code to case 2: like so

if ($currentStatus[0]['status'] !== $statusId) {

switch($statusId) {

case 2; ## Processing Nothing to do

## Email the customer to say payment has been accepted and cleared

$lang = getLang("email.inc.php",$this->orderSum['lang']);

$this->getOrderSum($cart_order_id);

$macroArray = array(

"ORDER_ID" => $this->orderSum['cart_order_id'],

"RECIP_NAME" => $this->orderSum['name'],

"STORE_URL" => $glob['storeURL']

);

$text = macroSub($lang['email']['payment_complete_body'], $macroArray);

unset($macroArray);

if (!empty($_POST['extra_notes'])) {

$text .= "\n\n---\n".$_POST['extra_notes'];

}

## Send email

require_once CC_ROOT_DIR.CC_DS."classes".CC_DS."htmlMimeMail".CC_DS."htmlMimeMail.php";

## email to customer

$mail = new htmlMimeMail();

$mail->setText($text);

$mail->setReturnPath($config['masterEmail']);

$mail->setFrom($config['masterName'].' <'.$config['masterEmail'].'>');

$mail->setSubject(macroSub($lang['email']['payment_complete_subject'], array("ORDER_ID" => $this->orderSum['cart_order_id'])));

$mail->setHeader('X-Mailer', 'CubeCart Mailer');

$mail->send(array($this->orderSum['email']), $config['mailMethod']);

#ADMIN ONLY

$breakStatus = false;

## Look up order

$this->getOrderSum($cart_order_id);

$this->getOrderInv($cart_order_id);

if (is_array($this->orderInv)) {

foreach ($this->orderInv as $i => $orderItem) {

## If the order contains tangible items, we set it to ORDER_PROCESSING, and break the loop

if (!$this->orderInv[$i]['digital'] && !$force) {

$this->orderStatus(2, $cart_order_id);

$statusId = 2; ## Safeguard

$breakStatus = true; ## Stops email sending below no way to stop this case ?!

break;

}

## Send Gift Certificate

if (!empty($this->orderInv[$i]['custom'])) {

$customArray = unserialize(html_entity_decode($this->orderInv[$i]['custom']));

if ($customArray['cert'] == true) {

$this->sendCoupon($customArray, $this->orderInv[$i]['id']);

}

}

}

if($breakStatus == false) {

## If order is completely digital send digital file and keep status as complete

$this->digitalAccess();

## Send order complete email OOOOOH it's a bit diiiirty

$lang = getLang("email.inc.php",$this->orderSum['lang']);

$langAdmin = getLang("email.inc.php");

if ($this->orderSum['discount']>0) {

$grandTotal = priceFormat($this->orderSum['prod_total'], true)." (-".priceFormat($this->orderSum['discount'], true).")";

} else {

$grandTotal = priceFormat($this->orderSum['prod_total'], true);

}

$macroArray = array(

"RECIP_NAME" => $this->orderSum['name'],

"ORDER_ID" => $this->orderSum['cart_order_id'],

"ORDER_DATE" => formatTime($this->orderSum['time']),

"INVOICE_NAME" => $this->orderSum['name'],

"SUBTOTAL" => priceFormat($this->orderSum['subtotal'], true),

"SHIPPING_COST" => priceFormat($this->orderSum['total_ship'], true),

"TAX_COST" => priceFormat($this->orderSum['total_tax'], true),

"GRAND_TOTAL" => $grandTotal,

"INVOICE_COMPANY" => $this->orderSum['companyName'],

"INVOICE_ADD_1" => $this->orderSum['add_1'],

"INVOICE_ADD_2" => $this->orderSum['add_2'],

"INVOICE_CITY" => $this->orderSum['town'],

"INVOICE_REGION" => $this->orderSum['county'],

"INVOICE_POSTCODE" => $this->orderSum['postcode'],

"INVOICE_COUNTRY" => getCountryFormat($this->orderSum['country'], 'id', 'printable_name'),

"DELIVERY_NAME" => $this->orderSum['name_d'],

"DELIVERY_COMPANY" => $this->orderSum['companyName_d'],

"DELIVERY_ADD_1" => $this->orderSum['add_1_d'],

"DELIVERY_ADD_2" => $this->orderSum['add_2_d'],

"DELIVERY_CITY" => $this->orderSum['town_d'],

"DELIVERY_REGION" => $this->orderSum['county_d'],

"DELIVERY_POSTCODE" => $this->orderSum['postcode_d'],

"DELIVERY_COUNTRY" => $this->orderSum['country_d'],

"PAYMENT_METHOD" => $this->orderSum['gateway'],

"DELIVERY_METHOD" => $this->orderSum['shipMethod']

);

$textAdmin = macroSub($langAdmin['email']['admin_order_breakdown_1'],$macroArray);

unset($macroArray);

if(!empty($this->orderSum['customer_comments'])) {

$macroArray = array(

"CUSTOMER_COMMENTS" => $this->orderSum['customer_comments']

);

$textAdmin .= macroSub($langAdmin['email']['order_breakdown_2'],$macroArray);

unset($macroArray);

}

$textAdmin .= $langAdmin['email']['order_breakdown_3'];

for ($i=0; $i<count($this->orderInv); $i++) {

$macroArray = array(

"PRODUCT_NAME" => html_entity_decode($this->orderInv[$i]['name'])

);

$textAdmin .= macroSub($langAdmin['email']['order_breakdown_4'],$macroArray);

unset($macroArray);

$macroArray = array(

"PRODUCT_OPTIONS" => $this->orderInv[$i]['product_options']

);

$textAdmin .= macroSub($langAdmin['email']['order_breakdown_5'],$macroArray);

unset($macroArray);

$macroArray = array(

"PRODUCT_QUANTITY" => $this->orderInv[$i]['quantity'],

"PRODUCT_CODE" => $this->orderInv[$i]['productCode'],

"PRODUCT_PRICE" => priceFormat($this->orderInv[$i]['price'],true)

);

$textAdmin .= macroSub($langAdmin['email']['order_breakdown_6'], $macroArray);

unset($macroArray);

}

if (!empty($_POST['extra_notes'])) {

$textAdmin .= "\n\n---\n".$_POST['extra_notes'];

}

## Send email

require_once CC_ROOT_DIR.CC_DS."classes".CC_DS."htmlMimeMail".CC_DS."htmlMimeMail.php";

$mailAdmin = new htmlMimeMail();

$mailAdmin->setText($textAdmin);

$mailAdmin->setReturnPath($config['masterEmail']);

$mailAdmin->setFrom($config['masterName'].' <'.$config['masterEmail'].'>');

$mailAdmin->setSubject(macroSub($langAdmin['email']['admin_payment_complete_subject'], array("ORDER_ID" => $this->orderSum['cart_order_id'])));

$mailAdmin->setHeader('X-Mailer', 'CubeCart Mailer');

$mailAdmin->send(array($config['masterEmail']), $config['mailMethod']);

}

}

break;

case 3: ## Order Complete (Payment Taken/Cleared)

Link to comment
Share on other sites

  • 2 weeks later...
Guest GospelLabs

It seems when I do this, that the customer gets 1000s of emails saying a payment has been made.

Can someone help me with this?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...