If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / General Questions / Where should i put this stray string function that i wrote, and is needed in several

Where should i put this stray string function that i wrote, and is needed in several

Started by tcarden on 7 Apr 2013, 1:00 AM · Views: 644

Results 1 to 2 of 2
7 Apr 2013, 1:00 AM
#1
tcarden avatar

tcarden

Zen Follower

Join Date:
Oct 2012
Posts:
282
Plugin Contributions:
0

Post #1 by tcarden

Advice on (where in the ZenCart universe) to put this stray function

For my client I've installed a UPS XML plugin. This plug-in works fine except my client like does like that fact it displays weight and package information to the customer. it displays it on the invoice, packing slip and on the check out page.

i've written a string function that turns this:
United Parcel Service (1 pkg, 7 lbs total) (UPS Ground):
into this:
UPS Ground.

I'd like advice on where to put this function so it can be called on the above mention pages.

OR, is there a better way to handle this? should it be put in a class file?

thanks!,

7 Apr 2013, 1:31 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,512
Plugin Contributions:
176

Post #2 by drbyte

If you don't want the long description to show anywhere, then why not just change the shipping module to output the very abbreviated version you're saying your long function alters it to?
Or is there some reason for wanting it to still display the long version even though you're trying to change its display most places where it would be used?

You can change the $this->quotes array built in the quote() "function" of your shipping module class.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.