Is there a particular reason why this needs to be the FIRST comment in the order, instead of being an additional comment?
Is there a particular reason why this needs to be the FIRST comment in the order, instead of being an additional comment?
.
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.
Not to derail this train of thought, but if you can successfully create a new session variable, could you not instead concatenate its value to the $_SESSION['comments'] variable just before the processing goes off to order.php? It seems that this is the effect you want, that the delivery info is part of the comments.
Yes, that's my plan. The only thing is that I'm not quite sure where this processing takes place. I tried doing this on the order.php page, and it added the comment every time I changed the page on the checkout screen. What I wanted was to add it once, and that's upon checkout success. Where would I be able to do this?
Again, I'm fine with PHP and MySQL, but this area of Zen Cart is new to me.
And no, it does not need to be the first detail, but I figured it's just as easy to put it at the front as it is the end.
Thanks for the help so far.
Two options:
a) edit core code by adding your extra variable's content to the existing $_SESSION[comment] value before inserting. Simply do your append or prepend in the same block of code I mentioned earlier.
b) add an observer class that watches for the specified notifier point and have it repeat the same code that I quoted, but putting your custom variable in place of the $_SESSION['comment'] variable. This would add a second entry, basically like a status-update comment. The info will show in the order details screen like other comments do.
While you could technically just duplicate that block of code in the order class file to accomplish the same thing, that requires you to re-do that same edit everytime you upgrade or otherwise touch that file. Using an observer class puts your custom code outside the core code, making it much easier to do upgrades.
.
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.
Ok, I've added a piece of text to the array:
'comments' => (isset($_SESSION['comments']) ? "HELLO".$_SESSION['comments'] : ''),
It's still a little 'slapped together', but it should do for now. All I need to do is replace the "HELLO" with my session information.
Actually, you will want to insert your info whether or not $_SESSION['comments'] is set. You would need to rework that to always populate the 'comments' with your info, and add $_SESSION['comments'] if it exists. Something likePHP Code:
'comments' => (isset($_SESSION['comments']) ? "HELLO".$_SESSION['comments'] : ''),
PHP Code:
'comments' => "HELLO".(isset($_SESSION['comments']) ? $_SESSION['comments'] : ''),
Bookmarks