Community Forum

Please read the intro before joining/posting. Thank you.

If you have questions about our software, chances are this forum has the answers.

You'll need to register before you can post on the forum to ask your question or to answer another one. A reply will be posted to each and every question that is asked so there is no need to double post or bump your post. We'll do our best to answer promptly, but in some cases it may take a day or two. If you bump your post, it may be removed. Bear with us and we'll get your question answered quickly.

Here are a few tips to help you to get your questions answered more rapidly.

IMPORTANT: Posts in English only. We don't employ translators and we'll be unable to understand your message properly and will probably delete it.
SOFTWARE: Each software has it's own forum. Software here is NOT supported. Posts about this software will be deleted. Supported software questions ONLY please.
SEARCH: Use the search option to see if your question has been answered on the forum before now or if there is an answer in the documentation of your software.
PERSONAL SUPPORT: If you have purchased a commercial version of any software, using the contact option at the licence centre ensures a faster response.
AUTO DELETION: Accounts older than 5 days, with no posts or topics, are automatically deleted. Only register if you are thinking of posting.
LINKS: Any links posted are not clickable (to deter spammers) and must be copied / pasted into your browser address bar.

            

You are not logged in.

Using the cart total for another purposePosts in the Maian Music forum by jjjjeczalik
jjjjeczalik
24-01-2017 23:00:06

I am betraying my ignorance of PHP here; nevertheless...

While modifying Maianmusic over the past few months, I have often made certain things conditional upon other things, e.g.,

 if ($this->COLLECTION->catnumber<100) 

then do such-and-such (making certain products display sheet music or lyrics, etc.), or

 if (LOGGED_IN=='yes') 

then do so-and-so (making certain products display sheet music or lyrics, making certain products only visible when you're logged in, etc.).

Applying the same logic to

 if ($this->CHARGES['total']>0) 

fails every time. The value is always zero, even though the correct amount will always display if I

 echo $this->CHARGES['total'] 

What I am trying to do is this: IF the cart total is $0.00 then X but if the cart total is greater than $0.00 then Y. This isn't a MaianMusic bug, because the correct total still always displays in the basket, but rather, it's something obvious that I'm missing. (Every question that I post here ends up being something obvious that I'm missing. So I post here instead of in priority support because these are things that are not problems with the software, but questions that are being answered out of kindness.)

To clarify, everything that I'm doing in this instance is on the basket.tpl.php page.

jjjjeczalik
27-01-2017 15:27:17

maiandavid wrote:
The reason it`s failing is because the $this->CHARGES['total']  variable isn`t numeric or a float, it also contains the currency symbol.

I had a feeling that that was it, as I had started fooling around with

mswFormatPrice

but I travelled beyond my skill level. Thanks for your help!

100% Free SoftwareSoftware Versions, Development, Docs & UpgradesHostingNewsletter
Made with in the U.K & Hong Kong

Free PHP Scripts / Responsive PHP Scripts / Lightweight PHP Scripts / White Label PHP Scripts