Jump to content

Warning: sprintf() - too few arguments orderSuccess.inc.php


Guest lolichka

Recommended Posts

Guest lolichka

Hello....

Well, after receiving my first enquiry today through my store. I went into the admin area and looked up the enquiry placed and then did the following:

changed status to processing

added staff comments

checked box inform customer

added comments to customer

clicked save enquiry

Then I clicked on the link to send a customer an email invoice from this link "/orders/order.php?cart_order_id=xxxxx&sendInvoice=1" and received the following error:

Warning: sprintf() [function.sprintf]: Too few arguments in xxx/store/includes/orderSuccess.inc.php on line 77

When I open up the orderSuccess file and view line 77, I have:

str_replace("_"," ",$order[0]['shipMethod']));

This file hasn't been edited at all and comes standard with v 3.0.18

I would dearly love some help in having resolved this one as I am at a loss to understand where else it may be coming from seeings the source file has not been altered at all...

Thanks for your help

Cheers

Link to comment
Share on other sites

You are working in the Admin side of the store and /orders/order.php is in the admin folder (/admin/orders/order.php). So, how CC is referencing a file in for visitor's side of the store (/includes/orderSuccess.inc.php) is a mystery.

Unless you've made modifications, maybe you should save your global.inc.php file, delete the store folder and any remnants of a store in the root folder, re-upload a full and complete, fresh copy of CC3.0.18, and restore the global.inc.php file.

Based on what you've described, files are getting mixed and mashed.

Link to comment
Share on other sites

Guest lolichka

Hi - I know I am working in the admin side of the store. Perhaps you may have misread what I mentioned about where I was accessing the file from.

I think the problem is the link in the admin area that points to me being able to email the customer an invoice. The globals.inc file is what was standard from my installation and has worked fine up until that error appeared.

RE-installing my store from a 'fresh' install isn't an option as it has been heavily modded and it's not always the best option :-)

It's not a show stopper however annoying none-the-less. It just means I will send my customer an invoice via alternate means.

I have nothing in my root directory relating to the store and my global.inc.php file is the same one from my initial install and hasn't been modified so I don't think they are the problem...

Link to comment
Share on other sites

Ok, heavily modded. I get that. That's something any respondent to queries needs to know.

There's nothing wrong with the link on the admin page:

/admin/orders/order.php?cart_order_id=xxx&sendInvoice=1

In order.php, line 49:

include("../../includes/orderSuccess.inc.php");

I didn't notice this before: the admin script includes a script from the visitor's side of the store.

In the file /includes/orderSuccess.inc.php, the relevant statement begins at about line 53:

sprintf(arg1, arg2, arg3, etc)

where arg 1 is the "template" string, into which all the other arguments are placed at the placeholders (%s).

Please look at your language file and determine if the "inv_email_body_1" string ($lang['front']['orderSuccess']['inv_email_body_1']) has had any %s added or removed. Since sprintf() is complaining about too few args, then I conclude that one or more %s has been added to this string (you said orderSuccess.inc.php has not been edited). Sprintf() at line 53 is expecting 24 %s.

Link to comment
Share on other sites

Guest lolichka

['orderSuccess']['inv_email_body_1']) has had any %s added or removed. Since sprintf() is complaining about too few args, then I conclude that one or more %s has been added to this string (you said orderSuccess.inc.php has not been edited). Sprintf() at line 53 is expecting 24 %s.

Thanks bsmither,

I know what I did wrong! Just to explain... I make cake toppers that are customised to an individuals requirements. As such, having the product as a 'tangible' product wouldn't work as I need to establish whether I have capacity within my schedule to create them which is why I chose 'digital' as no postage is calculated as once I've confirmed the details and my schedule etc I send them a customised quote which includes shipping based on weight and their postcode. I also products that are tangible so require shipping for those. (hope the above made sense).

I was at fault by removing the code as per below, thinking and I mean 'thinking' it would work!

------------this is what I removed from the language file --------------------------

Below are the links you need to access the digital products you have ordered.

IMPORTANT these links will expire on %s and you have %s attempts to download them. If you have any problems please contact us stating your order number.

~~~~~~~~~~~~~~~~~~~~~~~~~~\n",

'digi_email_body2' => "%s

DOWNLOAD LINK:

%s/download.php?pid=%s&oid=%s&ak=%s

~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n",

'digi_subject' => "Downloads Access: ",

);

$lang['misc'] = array(

'pages' => " pages ",

--------end this is what I removed from the language file ---------------------------------------

My intent was to disable the download link and download link email sent to the customer as the customer is not actually receiving a download as such...

Based on the above (and I hope it all makes sense)....

Are you, or anyone else able to help me out with how I can still offer digital products but not have the download link e-mail sent to them?

Perhaps I just need to edit a small amount of code from the language (or other) file?

As a side note, I also offer tangible products where I need to calculate shipping....

Appreciate the help....

Many Thanks

:-)

Link to comment
Share on other sites

To supress the delivery of the email that contains the digital download link, look in file:

\includes\orderSuccess.inc.php, at around line 139:

if($digitalProducts == TRUE){

Let's just render that inert by wrapping the digital notice mailer inside comment delimiters:

/* Begin comments section

if($digitalProducts == TRUE ){

...

}

End of comments section */

// empty basket

Link to comment
Share on other sites

Guest lolichka

Thank you sooooo very much for that - worked an absolute charm. I noticed through my search all the way back to 06 that there was only one person who requested such 'feature'... but never got a reply.... so again, your time has been much appreciated.

Cheers

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...