X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   Invoice notification (https://forum.x-cart.com/showthread.php?t=69829)

AAPLA 11-01-2014 05:35 AM

Re: Invoice notification
 
Shouldn't an email to the customer only be sent when the 'Notify customer' checkbox is selected? This is my first X-Cart project, so still learning but my initial assumption was an email would only be sent to the customer when that checkbox is selected.

Seems like the decision of when to notify the customer should always be made by the Admin making the update vs. having logic built in that automatically sends an email when certain actions/fields are updated. Plus it would eliminate work on the X-Cart team to keep this logic working or updated when new status need to be added. Sounds like a Win Win to me! :)

Any recommendation on how to modify this?


Also I'm going to submit this to the Ideas section, but would be great if there was a text field where the Admin can add in some specific text to add when they want to notify their customer of an update to their order.




So far really enjoying working on X-Cart! Great product!

minfinger 11-01-2014 06:12 AM

Re: Invoice notification
 
If you're responding to my post, my request has nothing to do with the customer. My client has the need to notify a few employees via text when a product is sold. It's a really long explanation. I think I'm going to put my topic in s new thread.

tony_sologubov 11-03-2014 03:12 AM

Re: Invoice notification
 
Quote:

Originally Posted by minfinger
How can I make a mod that will allow me to set the mobile email address or addresses?


In order to send notification to mobile email address, you should edit the Sales department e-mail option in Store setup > Contact information section in admin area:
http://awesomescreenshot.com/0b23rwx523

Please, let me know if it works for you.

Tony.

tony_sologubov 11-03-2014 03:18 AM

Re: Invoice notification
 
Quote:

Originally Posted by AAPLA
Shouldn't an email to the customer only be sent when the 'Notify customer' checkbox is selected? This is my first X-Cart project, so still learning but my initial assumption was an email would only be sent to the customer when that checkbox is selected.


Notifications about changed order status are always sent to customer. Although, we want to create options which will manage it.

I feel, you mean the "Send Order created notifications to customers" option. This option controls notifications after customer submits an order via off-line payment method (like phone ordering or check). It does not affect orders placed via payment gateways like Paypal or Authorize.Net.

Quote:

Seems like the decision of when to notify the customer should always be made by the Admin making the update vs. having logic built in that automatically sends an email when certain actions/fields are updated. Plus it would eliminate work on the X-Cart team to keep this logic working or updated when new status need to be added. Sounds like a Win Win to me! :)

Any recommendation on how to modify this?

What is the result you are trying to achieve?

Quote:

Also I'm going to submit this to the Ideas section, but would be great if there was a text field where the Admin can add in some specific text to add when they want to notify their customer of an update to their order.

This is already planned, but thanks for submitting idea anyway!

Quote:

So far really enjoying working on X-Cart! Great product!

Thank you for your kind words! :)

minfinger 11-03-2014 03:19 AM

Re: Invoice notification
 
Tony,

That won't do what I need because I don't need to send the whole Email like what would normally go to the sales department.

If you point me to the code that makes the actual email to the sales department, I'm sure I can figure it out. Because in XC4, I was able to mod the code and make it send both the normal Sales Department notice as well as the much shorter text version. Which for my purposes only needs to be Product Name - SKU - Price.

tony_sologubov 11-03-2014 04:31 AM

Re: Invoice notification
 
OK, then you need to look at sendProcessMail() method of the class described in the classes/XLite/Mode/Order.php file.

Please, let me know if it helps.

minfinger 11-03-2014 04:49 AM

Re: Invoice notification
 
Based on my limited, but educated understand of XC5, I'll give that a 50/50 on me figuring it out lol Thanks though...I'll give it go.

minfinger 11-03-2014 05:48 PM

Re: Invoice notification
 
So I believe I've narrowed it down to the right section of code as you suggested, but once again this is nothing like XC4. So I've hit that wall. I don't understand where I need to insert the new bit of code, perhaps after the first "$mail->send();" I need to build out the text notification? But again I have no idea how to call the 3 fields I'm looking for. I think it's go something to do with array()?

This is the Order.php I made thus far.
PHP Code:

<?php

namespace XLite\Module\FasterThanYours\InvoiceTextNotification\Model;

class 
Order extends \XLite\Model\Base\SurchargeOwner
{
    protected function 
sendProcessMail()
    {
        
$mail = new \XLite\View\Mailer();
        
$mail->order $this;
        
$mail->adminMail true;
        
$mail->compose(
            \
XLite\Core\Config::getInstance()->Company->site_administrator,
            \
XLite\Core\Config::getInstance()->Company->orders_department,
            
'order_processed',
            array(),
            
true,
            \
XLite::CUSTOMER_INTERFACE,
            static::
getMailer()->getLanguageCode(\XLite::ADMIN_INTERFACE)
        );
        
$mail->send();

        
$mail->adminMail false;
        
$mail->selectCustomerLayout();
        
$profile $this->getProfile();
        if (
$profile) {
            
$mail->compose(
                \
XLite\Core\Config::getInstance()->Company->orders_department,
                
$profile->getLogin(),
                
'order_processed',
                array(),
                
true,
                \
XLite::CUSTOMER_INTERFACE,
                static::
getMailer()->getLanguageCode(\XLite::CUSTOMER_INTERFACE$profile->getLanguage())
            );
            
$mail->send();
        }
    }
}


I'm just guessing here, but does the code need to be added like this after the first $mail->send(); ?

PHP Code:

$mail = new \XLite\View\Mailer();
        
$mail->order $this;
        
$mail->adminMail true;
        
$mail->compose(5551234567@vtext.com,
array(
$Name,$SKU,$Price),
            
true,
            \
XLite::CUSTOMER_INTERFACE,
            static::
getMailer()->getLanguageCode(\XLite::ADMIN_INTERFACE)
        );
        
$mail->send(); 


minfinger 11-08-2014 02:27 PM

Re: Invoice notification
 
Tony,

Just so we're on the same page. What I did in this thread for 4.3.2 is what I'm looking to do in XC5 and also have the ability to configure additional sms Email addresses.

http://forum.x-cart.com/showthread.php?p=336406

tony_sologubov 11-11-2014 07:19 AM

Re: Invoice notification
 
The simplest implementation would be something like this:

PHP Code:

<?php

namespace XLite\Module\FasterThanYours\InvoiceTextNotification\Model;

class 
Order extends \XLite\Model\Order implements \XLite\Base\IDecorator
{
    protected function 
sendProcessMail()
    {
        
parent::sendProcessMail();

        
$to '5551234567@vtext.com';
        
$subject 'There was a sale!';
        
$body '';

        foreach (
$this->getItems() as $item) {
            
$product $item->getProduct();
            
$body .= 'Product: ' $product->getName() . ' sku: ' $product->getSKU() . ' price: ' $product->getPrice() . PHP_EOL;
        }

        
mail($to$subject$body);
    }
}


I have not tested it, so please sorry if it does not work straight away. It shows you the idea though.


All times are GMT -8. The time now is 11:22 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.