| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Displaying Membership of the User in Invoice | ||||
|
|
Thread Tools | Search this Thread |
#11
|
|||||||
|
|||||||
Re: Displaying Membership of the User in Invoice
Hi, Thanks for you help. I was able to display the membership when the order is completed and the invoice is generated (please see image attached).
However, I am still not able to display it in the email that is sent. I even changed the list name an weight to list="invoice.items.head", weight="9" to display them above 'item list' in the invoice. Is it possible to showcase it in the email sent to admin? Thanks and Regards.
__________________
Version 5.3.6.6 |
|||||||
#12
|
|||||||||
|
|||||||||
Re: Displaying Membership of the User in Invoice
Quote:
You can. You have to look at the mail class(es) for this particular case and see if whatever is made available to the mail template includes membership. If not you need to make it available to the mail template in order to include it within the email send from cart to admin and/or customer. Mail classes are separate from the rest f the logic/views.
__________________
Steve Stoyanov CFLSystems.com Web Development |
|||||||||
#13
|
|||||||
|
|||||||
Re: Displaying Membership of the User in Invoice
Hi, So I suppose I have to make changes to the classes/xlite/view/mailer.php?
And how can I make membership available to this class? Do I declare the function this.order.profile.membership.name here? Thanks
__________________
Version 5.3.6.6 |
|||||||
#14
|
|||||||
|
|||||||
Re: Displaying Membership of the User in Invoice
Quote:
Basically you would need to extend it to modify the function sendOrderWhatever(Order $order) and add to static::register() method the membership. )c.f. https://devs.x-cart.com/changing_store_logic/creating_custom_email_notifications.html so that membership becomes available in appropriate twig files. However, probably you may get away with playing with the constructor in Core/Mail/AMail.php or Core/Mail/Order/AOrder.php
__________________
X-cart 5.2.12, php 5.6 Ed from Grenoble, France |
|||||||
|
#15
|
|||||||
|
|||||||
Re: Displaying Membership of the User in Invoice
Hi,
Looking at the example, I have an understanding that: So If I am changing the function public static function sendOrderProcessedAdmin(\XLite\Model\Order $order) { static::register([ CODE TO REGISTER MEMBERSHIP HERE ]); $result = static::composeOrderDepartmentMail('order_processe d', $order); if ($result && !static::hasScheduledJob()) { \XLite\Core\OrderHistory::getInstance()->registerAdminEmailSent( $order->getOrderId(), 'Order is processed' ); } elseif (static::$errorMessage) { \XLite\Core\OrderHistory::getInstance()->registerAdminEmailFailed( $order->getOrderId(), static::$errorMessage ); } } What needs to be entered to register membership function to make it available. Thanks and Regards.
__________________
Version 5.3.6.6 |
|||||||
#16
|
|||||||
|
|||||||
Re: Displaying Membership of the User in Invoice
Something like
Code:
Code:
__________________
X-cart 5.2.12, php 5.6 Ed from Grenoble, France |
|||||||
#17
|
|||||||
|
|||||||
Re: Displaying Membership of the User in Invoice
Hi,
Thanks for your assistance. Really appreciate it. I changed the function to public static function sendOrderProcessedAdmin(\XLite\Model\Order $order) { static::register([ 'membership' =>\XLite\Core\Auth::getInstance()->getProfile()->membership, ]); $result = static::composeOrderDepartmentMail('order_processe d', $order); if ($result && !static::hasScheduledJob()) { \XLite\Core\OrderHistory::getInstance()->registerAdminEmailSent( $order->getOrderId(), 'Order is processed' ); } elseif (static::$errorMessage) { \XLite\Core\OrderHistory::getInstance()->registerAdminEmailFailed( $order->getOrderId(), static::$errorMessage ); } } "$this" doesn't have the property called membership so that won't work as well. However, I still don't see the membership name in the email sent to admin when order is processed. I am using {{ this.order.profile.membership.name }} in the view to showcase the membership name. Does that define the way we register the membership in the sendOrderProcessed Function? Kind Regrads, Siddharth Puri
__________________
Version 5.3.6.6 |
|||||||
#18
|
|||||||
|
|||||||
Re: Displaying Membership of the User in Invoice
Since you have registered membership for the class, {{this.membership.name}} should do, if I understand correctly xc documentation (and its content is up to date/correct).
__________________
X-cart 5.2.12, php 5.6 Ed from Grenoble, France |
|||||||
#19
|
|||||||
|
|||||||
Re: Displaying Membership of the User in Invoice
Hi finally, I could do it. I went back to the simple solution and added
<div>{{ this.order.profile.membership.name }}</div> to the skins/common/order/invoice/parts/head.twig and it displays. i don't know why did did not work in the note.twig. Thank you everyone for their awesome support. {## # Invoice head # # @ListChild (list="invoice.base", weight="10") #} <table cellspacing="0" class="header"> <tr> {{ widget_list('invoice.head') }} </tr> <tr> <div>{{ this.order.profile.membership.name }}</div> </tr> </table> Kind Regards
__________________
Version 5.3.6.6 |
|||||||
|
|||
X-Cart forums © 2001-2020
|