Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

comment bar mod


knifeman

Recommended Posts

Posted

I have been looking all over google, and it seems this cannot be done, but I thought I would ask here in case I missed a new way of doing things.

 

I am using the 'admin comments toolbar'

 

it pulls this define from the langauge file:

define('TEXT_COMMENT_07','\nThis order will ship on 9-16-09. A confirmation number will be assigned and forwarded to you at that time.\nThanks again for shopping with ...etc..');

 

It is called by this button using java:

<button class="cbutton" onClick="return updateComment('<?php echo(TEXT_COMMENT_07); ?>','1');"><?php echo TEXT_BUTTON_07; ?></button> 

 

Is there any way to automatically set the date to today, or even today +1?

I tried several php functions, but they would not work inside the java.

 

I think this is the coolest mod I have overlooked. Instead of copy/pasting all my text in orders.php, now I just click a button.

 

Tim

Posted

Try

define('TEXT_COMMENT_07','\nThis order will ship on %s. A confirmation number will be assigned and forwarded to you at that time.\nThanks again for shopping with ...etc..');

and

<button class="cbutton" onClick="return updateComment('<?php echo sprintf(TEXT_COMMENT_07, date(DATE_FORMAT)); ?>','1');"><?php echo TEXT_BUTTON_07; ?></button> 

or

<button class="cbutton" onClick="return updateComment('<?php echo sprintf(TEXT_COMMENT_07, date(DATE_FORMAT, time()+86400)); ?>','1');"><?php echo TEXT_BUTTON_07; ?></button> 

and see if one of those does what you want. I might change the 86400 to 43200, which would mean (absent a DST issue) that if it is before noon, you'll ship it the same day. If it is after noon, tell the customer that it will ship tomorrow (even if you still manage to squeak it out).

 

In this case, I don't think that you need it, but it is possible to get the results of PHP functions from Javascript via something like the AJAX RPC functions in osC 3. Note that you are essentially making a light weight page request each time you do that, but it may be better than doing a full page request.

 

You could also calculate the date in javascript. I think that jhande had code that was mostly working but showing the time in the user's timezone when he wanted it in his timezone. Since you are the only admin user, I don't think that issue would apply here.

Always back up before making changes.

Posted

Matt,

 

Thanks a million. You have come through again. Your code works perfectly. I used the first one for orders that ship today. Then I used the second code for an order that ships tomorrow. And I created a third button for orders that ship plus 3 days. This would be an order received on Friday, but ships Monday.

 

This contribution and your code will save me a ton of alt tabs and copy/paste.

 

I just happened across the contrib while searching for something else and I still think this has got to be the coolest timesaver for my admin.

 

Thanks again Matt :D

Posted

Just a few comments:

 

1) It's not java. It's Javascript. Big difference -- you confuse people when you refer to the browser (client) side scripting by the wrong name.

 

2) Javascript also has some date functions that you might use with the Document Object Model (DOM) on the browser, but if you've got it working with server-side PHP, perhaps you should leave well enough alone.

 

3) Javascript cannot directly access PHP functions. PHP lives back on the server, so a new page has to be requested, where PHP scripts are run. Javascript runs only on the browser (client side), independently of the server. With AJAX, you could make some light-weight requests of the server (not refresh the whole page), but that's a whole 'nuther ball of wax.

Posted
Just a few comments:

 

1) It's not java. It's Javascript. Big difference -- you confuse people when you refer to the browser (client) side scripting by the wrong name.

Sorry, I guess I was one of them.

 

2) Javascript also has some date functions that you might use with the Document Object Model (DOM) on the browser, but if you've got it working with server-side PHP, perhaps you should leave well enough alone.

Thanks to Matt, it is working great.

 

3) Javascript cannot directly access PHP functions.

That is what I gathered from my searching on google. It is tough searching the web for code help because all my problems are very specific and the tutorials I read are more generalized. I posted here because I figured if there was an alternate way, someone here would know it. I am truly indebted to the people on this forum. Without their help, my stores would not be as successful as they are. That is one reason I try to answer questions when I can. When I am certain of the answer, or I feel my perspective is valuable, you will see me reply to posts.

I am not sure how this code performs behind the scenes, but it updates my comments box instantaneously ( I don't see the page refresh) and saves me an immense amount of time updating orders.

 

Tim

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...