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)

minfinger 11-11-2014 07:20 PM

Re: Invoice notification
 
I'm working on testing this now, but lets just say this does work.

How do I go about putting in a "Settings" link on the Module to allow me to configure the Email address and subject?

minfinger 11-11-2014 07:59 PM

Re: Invoice notification
 
Well I went to Rebuild the Cache after enabling the Module and I'm getting the following error:
Code:

    Deploying store [step 1 of 11], please wait...

Cleaning up the cache... [0.00sec, 3.2MB (-56b)]
Building classes tree... [2.06sec, 9.1MB (6.0MB)]
Run the "Doctrine_Plugin_Cache" plugin... [0.00sec, 9.2MB (104kB)]
Run the "Doctrine_Plugin_DocBlock_FakeEntities" plugin...
Fatal error: Namespace declaration statement has to be the very first statement in the script in /home/myyamaha/public_html/lpo/classes/XLite/Module/FasterThanYours/InvoiceTextNotification/Model/Order.php on line 2


minfinger 11-11-2014 08:01 PM

Re: Invoice notification
 
aaah nevermind, I figured it out, your code had a space before the <?php

minfinger 11-11-2014 08:10 PM

Re: Invoice notification
 
Ok so I put in my personal cell number and didn't get the notice. I went and changed the status to Paid and Processed, I didn't get a notice.

minfinger 11-11-2014 08:18 PM

Re: Invoice notification
 
So I realized I had the wrong text email address in the Order.php I fixed that, but it still doesn't work. I did verify that email my text address does work.

tony_sologubov 11-12-2014 04:38 AM

Re: Invoice notification
 
Hi Michael!

1) In order to create settings for address and subject, please use this article:
http://kb.x-cart.com/display/XDD/Step+4+-+working+with+settings

2) Could you please send me a pack of your module, so I could test it on my installation?

Tony.

minfinger 11-12-2014 06:03 PM

Re: Invoice notification
 
Tony,

https://www.dropbox.com/s/7x0lv6soz9tec8q/FasterThanYours-InvoiceTextNotification-v5_1_8.tar?dl=0

tony_sologubov 11-13-2014 06:03 AM

Re: Invoice notification
 
Hi Michael!

I was wrong about what method you had to decorate. You should decorate the sendProcessOrderCustomer() method of the \XLite\Core\Mailer object.

This implementation would be something like this:

PHP Code:

<?php

namespace XLite\Module\FasterThanYours\InvoiceTextNotification\Core;

class 
Mailer extends \XLite\Core\Mailer implements \XLite\Base\IDecorator
{
    public static function 
sendProcessOrderCustomer(\XLite\Model\Order $order)
    {
        
parent::sendProcessOrderCustomer($order);

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

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

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


Surely, it should be located in the Core/Mailer.php file in your module directory.

Tony.

minfinger 11-14-2014 08:34 PM

Re: Invoice notification
 
So I made the Core Folder, put the Mailer.php inside it, added the code above. Rebuilt the Cache after removing the original Order Folder. When I went to checkout and hit Place order, it went to /cart.php?target=checkout and it was completely blank.

tony_sologubov 11-17-2014 05:36 AM

Re: Invoice notification
 
Did you get any PHP error messages in the <X-Cart 5>/var/log/ folder? Check xlite.log and php_errors.log files.


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

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