X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Adding membership type to order invoices (https://forum.x-cart.com/showthread.php?t=67998)

keystone 10-23-2013 09:03 AM

Adding membership type to order invoices
 
Hi, I am working on my 4.6.0 store and trying to add a line to order_invoice.tpl to show if an order is "wholesale" or "retail". I tried adding the same lines I did in my 4.4.5 store which work great but they don't seem to be working in my 4.6.0 store, or if it does, it is sporadic. Here is what I have...

/common_files/mail/html/order_invoice.tpl
Code:

<strong>Membership:</strong> {if $userinfo.membership eq 'Wholesale'}Wholesale
                  {else}Retail
                  {/if}


and in /ideal_responsive/mail/html/order_invoice.tpl
Code:

<strong>Membership:</strong> {if $userinfo.membership eq 'Wholesale'}Wholesale
                  {else}Retail
                  {/if}


I am thinking of changing
Code:

$userinfo.membership eq 'Wholesale'

to

Code:

$userinfo.membershipid eq '2'

and see if that works but I have my doubts. I have also tried double quotes instead of single quotes around Wholesale but that didn't seem to work either. Am I missing something? I just logged in and placed an order and it said WHOLESALE but last night I got one that was wholesale and it said RETAIL even though the prices were wholesale.

keystone 02-12-2014 08:39 AM

Re: Adding membership type to order invoices
 
I really need a fix for this issue. Can anyone help figure out what is going on? The changes I made work fine as long as a customer is not paying with a credit card (not sure about paypal yet). If I place an order and use "phone order" or "purchase order" as the payment method the invoice will show "Wholesale" as the membership level but with credit card it stays as "Retail". I am using Authorize.Net DPM and am not sure if that is causing the problem or not.

The goal is to just have the emailed invoice state whether the order was placed was a retail or wholesale order.

herber@wirehub.nl 02-13-2014 06:54 AM

Re: Adding membership type to order invoices
 
Are you sure $userinfo.membership is passed on to the page interpreting the TPL in every situation? because if not, it will always use the ELSE.

You could check it by making it something like:

Code:

<strong>Membership:</strong> {if $userinfo.membership eq 'Wholesale'}Wholesale
                  {elseif $userinfo.membership eq 'Retail'}Retail
                  {else}
                  NO MEMBERSHIP
                  {/if}

It will give you a bit of insight into what's going on.
You could also echo the $userinfo.membership to see what's in the variable itself.

keystone 02-13-2014 08:04 AM

Re: Adding membership type to order invoices
 
Thanks herber,
I'll give that a shot to see if it works. I guess I expected my code to work because it works perfectly on my 4.4.5 site but I'm not using DPM to accept credit cards on that site though so I thought that could be the issue.

I'll post back when I know how it works out.

keystone 02-13-2014 10:15 AM

Re: Adding membership type to order invoices
 
After looking over your suggested code again, i noticed that you have
Code:

{elseif $userinfo.membership eq 'Retail'}Retail

I don't actually have a membership called Retail so that line will not ever actually work. Any customer not logged in as a wholesale account would get the No Membership in that case, correct?

I think I will also add the echo line too to see what is in there if anything like you suggested.

would I add that line like this in the spot I want it?

echo {$userinfo.membership}

herber@wirehub.nl 02-13-2014 11:09 AM

Re: Adding membership type to order invoices
 
Quote:

Originally Posted by keystone
After looking over your suggested code again, i noticed that you have
Code:

{elseif $userinfo.membership eq 'Retail'}Retail

I don't actually have a membership called Retail so that line will not ever actually work. Any customer not logged in as a wholesale account would get the No Membership in that case, correct?

I think I will also add the echo line too to see what is in there if anything like you suggested.

would I add that line like this in the spot I want it?

echo {$userinfo.membership}

Alright I assumed you had one called retail, but no worries, just viewing whatever is inside the variable should also do nicely.

I have no clue how this template system works so I don't know how to just echo the variable, I imagine it would perhaps be something like

Code:

{$userinfo.membership}
Without the echo.

(based on this)

So try this:
Code:

<strong>Membership:</strong> {if $userinfo.membership eq 'Wholesale'}Wholesale
                  {else}
                  {$userinfo.membership}
                  {/if}

And if you just want to see what is in the variable directly:
Code:

<strong>Membership:</strong> {$userinfo.membership}

keystone 02-14-2014 07:19 AM

Re: Adding membership type to order invoices
 
Nice, I'll give that shot and see what happens.

keystone 02-14-2014 12:24 PM

Re: Adding membership type to order invoices
 
So when I changed my code to this

Code:

<strong>Membership:</strong> {if $userinfo.membership eq 'Wholesale'}Wholesale
                  {else}
                  {$userinfo.membership}
                  {/if}


When customers place their orders the field is blank and when I placed an order as a wholesale customer it was also blank.

Any ideas how to make this work? I just need a way to identify if an order was placed by a wholesale account or not.

keystone 02-18-2014 06:43 PM

Re: Adding membership type to order invoices
 
Just wondering if I am being confusing as to what I'm try to do or if it is really this difficult? I can't imagine I'm the only person who needs this feature.

herber@wirehub.nl 02-21-2014 04:11 AM

Re: Adding membership type to order invoices
 
Sorry, if that doesn't work then you'll need someone who can work with the template engine.

I can write it in PHP but I haven't got a clue how the template engine interprets it.

keystone 02-21-2014 05:56 AM

Re: Adding membership type to order invoices
 
Hi Herber,
I appreciate your effort in trying to help me out.

I'm wondering if the issue lies with the fact I have the Authorize.Net DPM mod on this site. The code works perfectly on my 4.4.5 store but NOT on this 4.6.0 store with the DPM mod.

cflsystems 02-21-2014 09:54 AM

Re: Adding membership type to order invoices
 
You are probably trying to use something that doesn't exist in the userinfo array.

Try to echo the whole array so you can see all the info in there. Something like this in the invoice template should work (if the array with the customer info is $userinfo)

{foreach from=$userinfo item=user key=k}
{$k}: {$user}<br/>
{/foreach}

This should give you clue what the variable that hold membership is and how to call it, if it exists in this array

keystone 02-21-2014 11:05 AM

Re: Adding membership type to order invoices
 
Hi Steve,
I pasted your code in the template but don't get any output.

Here is some code that is already in there to pull the customers first name...

Code:

{if $_userinfo.default_fields.firstname}

The thing is, if I log in as a WHOLESALE account and keep my initial code (post #1)
Quote:

<strong>Membership:</strong> {if $userinfo.membership eq 'Wholesale'}Wholesale
{else}Retail
{/if}

in the template I get Membership: Wholesale to output on the invoice as long as I use Phone Order or Purchase Order as the payment method. Even works when I pay with Paypal. As soon as I use Credit Card (Authorize.net DPM mod) as the payment method, it doesn't work any more.

cflsystems 02-21-2014 02:16 PM

Re: Adding membership type to order invoices
 
Then the userinfo array is not called $userinfo, you need to use the proper name. In your example above us
$_userinfo - underscore

keystone 02-21-2014 02:56 PM

Re: Adding membership type to order invoices
 
Hi Steve,
I got it to work. I had tried using the $_userinfo but it didn't work. Realized I needed to change the
Code:

{/if}
to
Code:

{/foreach}
in the snippet you suggested. Here is what it output...
It shows both membership: Wholesale and membershipid: 2 so shouldn't it out put that? I guess it would if I adjusted my original code to have the UNDERSCORE...

And yes that seems to have taken care of it.

Still doesn't explain why it worked with the wrong code before for different payment methods...

Thanks a ton for the help in trouble shooting this guys.

cflsystems 02-22-2014 12:51 AM

Re: Adding membership type to order invoices
 
ops sorry... I corrected my post...

siddharth.puri@wheelandba 01-19-2020 05:52 PM

Re: Adding membership type to order invoices
 
Hi Can you please suggest a solution for xcart 5 as to how can I display the membership in the invoice?

Thanks and Regards,
Siddharth Puri


All times are GMT -8. The time now is 03:06 PM.

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