Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Invoice notification

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #21  
Old 11-01-2014, 05:35 AM
 
AAPLA AAPLA is offline
 

Newbie
  
Join Date: Jul 2014
Location: US
Posts: 6
 

Default 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!
__________________
X-Cart 5.1.9 (win)
Reply With Quote

The following user thanks AAPLA for this useful post:
tony_sologubov (11-03-2014)
  #22  
Old 11-01-2014, 06:12 AM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default 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.
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #23  
Old 11-03-2014, 03:12 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default 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.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #24  
Old 11-03-2014, 03:18 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default 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!
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #25  
Old 11-03-2014, 03:19 AM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default 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.
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #26  
Old 11-03-2014, 04:31 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default 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.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #27  
Old 11-03-2014, 04:49 AM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default 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.
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #28  
Old 11-03-2014, 05:48 PM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default 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(); 
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #29  
Old 11-08-2014, 02:27 PM
 
minfinger minfinger is offline
 

X-Adept
  
Join Date: Apr 2009
Posts: 678
 

Default 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
__________________
X-Cart 4.3
Joomla
Among other things
Reply With Quote
  #30  
Old 11-11-2014, 07:19 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default 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.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 07:45 AM.

   

 
X-Cart forums © 2001-2020