Page 1 of 2

[SOLVED] - Warning: sprintf() [function.sprintf]: Too few arguments in

Posted: Sun Jul 31, 2011 9:23 am
by claudinizsp
When completed the sale, the error above mencionad.
Would anyone can help me, saying what it is?

Re: Warning: sprintf() [function.sprintf]: Too few arguments

Posted: Sun Jul 31, 2011 2:33 pm
by uksitebuilder
Need more details

what Version ?

What page ?

Exact error message ?

Re: Warning: sprintf() [function.sprintf]: Too few arguments

Posted: Mon Aug 01, 2011 6:00 am
by claudinizsp
Sorry ;D .

version 1.5.1.1

When we completed the sales get an error ...

Warning: sprintf() [function.sprintf]: Too few arguments in /home/cheiroec/public_html/catalog/controller/checkout/success.php on line 52

as well as in the image below

Image

When I click the link order, apresenda the following error ...

Image

Image

Someone could help me?

Re: Warning: sprintf() [function.sprintf]: Too few arguments

Posted: Mon Aug 01, 2011 4:28 pm
by uksitebuilder
looks like a template issue, as it is not the standard template, you should maybe try checking with the tempalte developer.

Re: Warning: sprintf() [function.sprintf]: Too few arguments

Posted: Tue Aug 02, 2011 12:39 pm
by claudinizsp
Sorry, but not a question of the standard template for the same thing happens.
store image looks standard Brazilian forum.

Image

I would like help from someone please because nobody answers the Brazilian forum.

Re: Warning: sprintf() [function.sprintf]: Too few arguments

Posted: Tue Aug 02, 2011 3:01 pm
by uksitebuilder
Do you have any non-default payment modules installed ?

Re: Warning: sprintf() [function.sprintf]: Too few arguments

Posted: Wed Aug 03, 2011 12:09 am
by claudinizsp
Yes.

Re: Warning: sprintf() [function.sprintf]: Too few arguments

Posted: Wed Aug 03, 2011 12:15 am
by uksitebuilder
Try disabling that for a test and choose a default payment method.

If that works fine, then it is the payment method causing the problem, in which case you will need to contact the payment module developer.

Re: Warning: sprintf() [function.sprintf]: Too few arguments

Posted: Wed Aug 03, 2011 12:22 pm
by claudinizsp
I've done it, and for example the Brazilian forum shop with this payment method is standard and also in error.
I believe that there is method of payment.
Please go to ...
www.opencartbrasil.com.br/loja

Re: Warning: sprintf() [function.sprintf]: Too few arguments

Posted: Wed Aug 03, 2011 2:37 pm
by rph
The problem is your language pack. Make sure this is present:

/catalog/language/[language]/checkout/success.php

Code: Select all

$_['text_customer'] = '<p>Your order has been successfully processed!</p><p>You can view your order history by going to the <a href="%s">my account</a> page and by clicking on <a href="%s">history</a>.</p>If your purchase has an associated download, you can goto the account <a href="%s">downloads</a> page to view them.</p><p>Please direct any questions you have to the <a href="%s">store owner</a>.</p><p>Thanks for shopping with us online!</p>';

Re: Warning: sprintf() [function.sprintf]: Too few arguments

Posted: Thu Aug 04, 2011 6:39 am
by claudinizsp
thanks, was just that.
thank you, problem fixed

Re: Warning: sprintf() [function.sprintf]: Too few arguments

Posted: Fri Jan 27, 2012 4:32 pm
by Snufkin
Hi
I have the same problem, but in another line. It seems that missing language tag, but i can't understand which
Warning: sprintf() [function.sprintf]: Too few arguments in catalog/controller/account/success.php on line 31

Re: Warning: sprintf() [function.sprintf]: Too few arguments

Posted: Sat Mar 10, 2012 10:21 pm
by albsim81
Snufkin wrote:Hi
I have the same problem, but in another line. It seems that missing language tag, but i can't understand which
Warning: sprintf() [function.sprintf]: Too few arguments in catalog/controller/account/success.php on line 31
I have the same problem in the same line that is

Code: Select all

	$this->data['text_message'] = sprintf($this->language->get('text_message'), $this->url->link('information/contact'));

Re: Warning: sprintf() [function.sprintf]: Too few arguments

Posted: Sun Mar 11, 2012 12:18 am
by straightlight
I never was a huge fan of sprintf as it can be full of surprises sometimes.

If you replace:

Code: Select all

$this->data['text_message'] = sprintf($this->language->get('text_message'), $this->url->link('information/contact'));
to read:

Code: Select all

 $this->data['text_message'] = str_replace(array("{contact_url}"), array($this->url->link('information/contact')), $this->language->get('text_message'));
Then, in your catalog/language/english/account/success.php file,

if you replace:

Code: Select all

$_['text_message']  = '<p>Congratulations! Your new account has been successfully created!</p> <p>You can now take advantage of member privileges to enhance your online shopping experience with us.</p> <p>If you have ANY questions about the operation of this online shop, please email the store owner.</p> <p>A confirmation has been sent to the provided email address. If you have not received it within the hour, please <a href="%s">contact us</a>.</p>';
to read:

Code: Select all

$_['text_message']  = '<p>Congratulations! Your new account has been successfully created!</p> <p>You can now take advantage of member privileges to enhance your online shopping experience with us.</p> <p>If you have ANY questions about the operation of this online shop, please email the store owner.</p> <p>A confirmation has been sent to the provided email address. If you have not received it within the hour, please <a href="{contact_url}">contact us</a>.</p>';
Will the error message still persists ?

Re: Warning: sprintf() [function.sprintf]: Too few arguments

Posted: Sun Mar 11, 2012 4:09 am
by rph
Straightlight, man, you've gotta stop doing this. Rewriting the cart is not how you debug.

albsim81, your language file isn't current for the version of OpenCart you're using. Yes, it is that simple.

Re: Warning: sprintf() [function.sprintf]: Too few arguments

Posted: Sun Mar 11, 2012 4:11 am
by straightlight
rph wrote:Straightlight, man, you've gotta stop doing this. Rewriting the cart is not how you debug.

albsim81, your language file isn't current for the version of OpenCart you're using. Yes, it is that simple.
And stating that it's simple without providing an alternative solution is a better way ?

Re: Warning: sprintf() [function.sprintf]: Too few arguments

Posted: Sun Mar 11, 2012 4:39 am
by rph
Your "alternative solution" only works because it forces the user to update the language file anyway. Does it fix other places in the cart where language breaks because it's out-of-date? No. Is it compatible with VQMod scripts which may try to make changes to language? No.

You have a hole in your skill set Straightlight. I'm not pointing it out to tear you down or to pretend I'm better. I'm pointing it out so you can be better at what you do.

Re: Warning: sprintf() [function.sprintf]: Too few arguments

Posted: Sun Mar 11, 2012 4:45 am
by straightlight
This topic only specifies on one location to where the problem needed to be fixed. There is no such case from my previous posts where it stated to modify this code towards other location in OC nor knowing where you see this information but you're obviously misinformed of what the code really does above even though it may force to update the language but at least without showing the errors to customers who are visiting the site so only appearing in the logs as it should. If you think this methodology is flaw while the logs keeps tracking those errors, then I can only say I do appreciate the input here but I more believe that in fact I'm more skilled than you think I am when it comes to PHP and from my own point of vue to what others may believe, I don't need to specify the mount of years of experience to demonstrate all the topics I have troubleshooted so far since it is already demonstrated and if I had to post this kind of fix 10000 more times towards other locations just so the customer doesn't have and doesn't need to see those error messages when they're shopping, I would definitely do it.

I appreciate your concern rph but I can definitely handle this.

Re: Warning: sprintf() [function.sprintf]: Too few arguments

Posted: Sun Mar 11, 2012 5:00 am
by rph
straightlight wrote:This topic only specifies on one location to where the problem needed to be fixed.
Yes, because you didn't understand the problem and didn't take the time to try to understand it. You just made an assumption and started coding.

Remember, it's not that good programmers don't make mistakes. It's that they acknowledge those mistakes and learn from them. All you do is get argumentative.

Re: Warning: sprintf() [function.sprintf]: Too few arguments

Posted: Sun Mar 11, 2012 5:06 am
by straightlight
My assumption above is not about mistake, it is simply about re-writing the into the way it should of been so for this error to vanish without removing the output even though the language variable didn't existed which the merchant doesn't actually have to remove from the controller but rather to hide the error message while this variable can still be added into the language file anyhow. The way I see it, this is a good solution during while only in the logs from the admin / filesystem the logs are showing those errors rather than on screen so that customers doesn't have to question merchants and in fact the best solution so far until the variable does get added into the language pack.

A mistake you say ? I would rather call it a cure since there are absolutely no reasons whatsoever on why a customer should notice / see an error on screen during while they're shopping online.