Author Topic: payment method renderMailLayout() < finded bug and solution>  (Read 6101 times)

revo1

  • Beginner
  • *
  • Posts: 10
payment method renderMailLayout() < finded bug and solution>
« on: January 12, 2012, 18:45:37 pm »
If you make a gateway for vmpayment example bank transfer  and use

if ($order_id) {
                               // send the email only if payment has been accepted
                               if (!class_exists('VirtueMartModelOrders'))
                                require( JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'orders.php' );
                               $modelOrder = new VirtueMartModelOrders();
                               $order['order_status'] = $method->status_success;
                               $order['virtuemart_order_id'] = $order_id;
                               $order['customer_notified'] = 1;
                               $order['comments'] = JTExt::sprintf('VMPAYMENT_BANK_PAYMENT_CONFIRMED', $order_id);
                               $modelOrder->updateStatusForOneOrder($order_id, $order, true);
                               // remove vmcart
                           }

you get error like this :
Fatal error: Call to undefined method VirtuemartViewOrders::renderMailLayout() in /home/xxxxxxx/public_html/joomla17/components/com_virtuemart/helpers/shopfunctionsf.php on line 339.

is $order defined with this:
$cart = VirtueMartCart::getCart();
$order= new VirtueMartModelOrders();
$order=$order->getOrder($order_id);
 or I just make a new array or what?
$order=new array(); -
Anyone help?


ruudjonk

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 106
Re: payment method
« Reply #1 on: January 12, 2012, 21:55:32 pm »
I can confirm this, I also run into this problem.

Hope someone know a fix for this one.

ruudjonk

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 106
payment method renderMailLayout()
« Reply #2 on: January 13, 2012, 20:45:01 pm »
Just for the info, I use VM 2 with Joomla 1.7.3


---
I am here: http://maps.google.com/maps?ll=52.498060,5.054185

revo1

  • Beginner
  • *
  • Posts: 10
Re: payment method renderMailLayout()
« Reply #3 on: January 13, 2012, 20:53:00 pm »
Same here.
 
if you get it working , please let me know it:)
if i, then i send to you pm and post somewhere

ruudjonk

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 106
payment method renderMailLayout()
« Reply #4 on: January 13, 2012, 20:58:14 pm »
Will do that. If we dont get an answer from someone that can help us before sunday then I will take a look at the latest svn or start looking at the vm core functions that are used to send mail. Maybe I could write up a patch.



---
I am here: http://maps.google.com/maps?ll=52.498100,5.053895

revo1

  • Beginner
  • *
  • Posts: 10
Re: payment method renderMailLayout()
« Reply #5 on: January 13, 2012, 21:08:52 pm »
i have watched those mail's cores already
I think it's a problem with data
it's not with right format or something.da
Anyone can print $order out and send it to me? anyone, who has a paypal(i dont have it). then we can compare a data
 before
 this row
$order['order_status'] = $new_status;


Thanks folks.
sorry my bad english

ruudjonk

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 106
payment method renderMailLayout()
« Reply #6 on: January 13, 2012, 21:44:34 pm »
I just noticed that in the current svn version they set the $order['customer_notified'] to 0. Probably to temporarily fix this issue to not send the payment confirmation emails...

revo1

  • Beginner
  • *
  • Posts: 10
Re: payment method renderMailLayout()
« Reply #7 on: January 14, 2012, 07:53:59 am »
ok.
open
~/components/com_virtuemart/helpers/shopfunctionsf.php
FInd renderMail


Modify function start like this:


public function renderMail ($viewName, $recipient, $vars=array(),$controllerName = null,$noVendorMail = false) {
      if(!class_exists('VirtueMartControllerVirtuemart')) require(JPATH_VM_SITE.DS.'controllers'.DS.'virtuemart.php');
      $format = (VmConfig::get('order_html_email',1)) ? 'html' : 'raw';
       
      $controller = new VirtueMartControllerVirtuemart();
      $controller->addModelPath(JPATH_VM_SITE.DS.'models');
      $controller->addModelPath(JPATH_VM_ADMINISTRATOR.DS.'models');
        $controller->addViewPath(JPATH_VM_ADMINISTRATOR.DS.'views');
      $view = $controller->getView($viewName, $format);
        $view->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR.'/views/orders/tmpl');

all this need to be befor if()....


long version:
find rendermail function

find
$controller = new VirtueMartControllerVirtuemart();
         $controller->addModelPath(JPATH_VM_ADMINISTRATOR.DS.'models');
         $controller->addModelPath(JPATH_VM_SITE.DS.'models');

add after that
        $controller->addViewPath(JPATH_VM_ADMINISTRATOR.DS.'views');

find
  $view = $controller->getView($viewName, $format);
add after that
  $view->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR.'/views/orders/tmpl');

ruudjonk

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 106
Re: payment method renderMailLayout() < finded bug and solution>
« Reply #8 on: January 14, 2012, 17:50:44 pm »
Hello Revo1,

I will test this tomorrow. I hope this can be added to the core to fix that problem so we don't need to get worried whenever we will update our Virtuemart 2 Installation.

Thanks for the update and fix.

Ruud

ruudjonk

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 106
Re: payment method renderMailLayout() < finded bug and solution>
« Reply #9 on: January 15, 2012, 20:48:19 pm »
Hello Revo1,

I can confirme that it also works overhere.

You can also notice now that this one has never worked before with VM 2 as all the language strings used in the confirmation email are'nt available yet.

I hope a Virtuemart developer read this one and checks it out.

revo1

  • Beginner
  • *
  • Posts: 10
Re: payment method renderMailLayout() < finded bug and solution>
« Reply #10 on: January 16, 2012, 22:35:17 pm »
Problem explane:

We have two VirtuemartViewOrders. One for Admin and one for site.

On admin VirtuemartviewORDERs class have renderMaillayout function but site VirtuemartviewOrders doesn't.

To resolve this problem we need to add controller view and template to view.
1) find ~/components/com_virtuemart/helpers/shopfunctionsf.php and open it
2)find renderMail function and add after
$controller = new VirtueMartControllerVirtuemart();
         $controller->addModelPath(JPATH_VM_ADMINISTRATOR.DS.'models');
         $controller->addModelPath(JPATH_VM_SITE.DS.'models');

this:
$controller->addViewPath(JPATH_VM_ADMINISTRATOR.DS.'views');

3) Now find  $view = $controller->getView($viewName, $format);
and add after this
$view->addTemplatePath(JPATH_COMPONENT_ADMINISTRATOR.'/views/orders/tmpl');

this modification load VM administrator template and view.



Please notify me, when this bug is fixed.

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 10018
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: payment method renderMailLayout() < finded bug and solution>
« Reply #11 on: January 18, 2012, 00:35:09 am »
Thanks
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

bunglehaze

  • Jr. Member
  • **
  • Posts: 487
Re: payment method renderMailLayout() < finded bug and solution>
« Reply #12 on: January 18, 2012, 14:13:52 pm »
Would this be to start sending admin confirmation emails? I have added the code but am still not receiving admin confirmation emails as described here:
http://forum.virtuemart.net/index.php?topic=95733.0

I am also getting a lot of missing language on payment confirmations which are also mentioned in the other thread.

werian

  • 3rd party VirtueMart Developer
  • Beginner
  • *
  • Posts: 34
Re: payment method renderMailLayout() < finded bug and solution>
« Reply #13 on: February 15, 2012, 10:08:26 am »
This one added after
$format = (VmConfig::get('order_html_email',1)) ? 'html' : 'raw';
will translate new order status template:

$lang = &JFactory::getLanguage();      
$lang->load('com_virtuemart',JPATH_ADMINISTRATOR);