Anyone know how I could add an option on checkout to allow the customer to choose whether they want to "ship complete" or accept a partial shipment if some items are backordered?
theCableStation
Printable View
Anyone know how I could add an option on checkout to allow the customer to choose whether they want to "ship complete" or accept a partial shipment if some items are backordered?
theCableStation
Bump... Anyone?
Any ideas on this? Anyone? Hello?
You could use the comments for that or setup an additional comment/checkbox to be processed on the checkout ...
What method do you want to custom code for?
Ajeh, thanks for responding. I was hoping for a yes/no checkbox during checkout that would default to no.
I am kinda surprised that this has not been asked for by more ZC users.
Thanks
Well ... to customize this you can follow along with where the comment is managed and included in the order ...
You then want to add a checkbox vs the text area which is similar to the Confirmation for the checkout, which uses the constant:
DISPLAY_CONDITIONS_ON_CHECKOUT
But you want to store the results ... hence the tracing of the comment to get an idea of how to do that ...
I'm trying to do something exactly like this. Any idea where I might get started?
Go to the Tools ... Developers Tool Kit ... and in the bottom input box enter:
comment
and search the Catalog to see how the comment is managed ...
Then, search the Admin to see how it is managed there ...
I gave it a whirl, and I'm just not a php programmer. After about the hundredth blank page, I decided to give up on trying to program it myself. Any other ideas?
:lamo:
You can always hire someone to code this for you ... :cool:
So, I've continued to kick this issue around, and I have a couple of questions.
Into what file would I put this form? Would I code it like a normal HTML form, or is there some kind of "handler" for this? Something like theI realize that I would, of course, not need a text field, but a checkbox, so the verbiage would be different, but I was wondering if there already was something created for this. This is probably a dumb question, and I'm definitely showing my ineptitude with PHP, but I reckon a dumb question asked is better than a dumb question unasked.PHP Code:
<?php echo zen_draw_textarea_field('comments', '45', '3'); ?>
If I could just get the blasted checkbox to show up I think I'd be good from there. I'm at least familiar with thecommand that prepares the following data for database insertion.PHP Code:
zen_db_prepare_input
Finally...would I need to store this data into the $_SESSION superglobal? I'm inclined to say yes, but I'm not sure. Any help is appreciated.
I totally know that I'm in over my head. Please be merciful.
What exactly are you trying to collect and where do you want to collect it?
AH HA! PROGRESS! I figured out which file I needed to edit for my form to appear! /template_default/tpl_checkout_shipping.php was the file I was looking for. Once I figured that out it was as simple as creating my form. Now.,..I gotta get the radio button data to insert into the database, and then be output again in the admin...it's gonna be tricky, I think, but I very well may make it happen. Once I figure it all out I'll post my full solution.
Hmm...the struggle goes on.
I guess now I'm at the part where I should really be paying attention to the way the comments are handled. I've got my form to appear, but now I'm having a difficult time figuring out how to insert the data collected via these two radio buttons into the 'zen_orders' table.
Basically...here's what I've got. I know it's way way wrong (otherwise it would be working, lol) but I reckon my best bet is to post my pathetic code and hope:
This is what I've added to tpl_checkout_shipping.php
PHP Code:
<fieldset>
<legend>Ship Complete</legend>
To keep shipping costs to a minimum, we ship orders complete unless otherwise requested. If you would like to accept a partial shipment in the event your order contains some in-stock and some non-stock products, please choose "yes" below: <br/><br/>
<form id="splitshipment" name="splitshipment" method="post" input type="submit" action="submit">
<label>
<input name="ship_complete_yes" type="radio" value="Yes" />
Yes</label><label>
<input name="ship_complete_no" type="radio" value="No" />No</label>
</form>
<?php $sql="INSERT INTO zen_orders ".
"(ship_complete) ".
"VALUES ".
"('$splitshipment')";?>
</fieldset>
Yeah...crap. That's all kinds of wrong. I'm embarrassed to even have that posting there. I still haven't figured out how to do it yet, but I'm workin' on it.
You are trying to insert a new field into the orders table ...
But, you are trying to do this at the wrong point ...
Gather the information to a $_SESSION variable such as $_SESSION['ship_complete'] where the value is 0 or 1 ...
Then in the order.php if you were to follow everywhere the ip_address is managed ... that is where you need to add your ship_complete ...
Now so that the data is managed in all the other files of the checkout right ... look how the comment is handled ... and you would use your ship_complete in the same manner so that it carries from page to page ...
So "collecting" the information for the new field ship_complete follows the comment ... and "adding" the new field ship_complete follows the ip_address ...
Easy smeazy ... eh?! :lamo:
Screw it. I give up. I went to /includes/languages/english/checkout_shipping.php and addedHow about that for a simple solution, eh?PHP Code:
define('TABLE_HEADING_COMMENTS', 'Special Instructions or Comments About Your Order:<br/><br/>All orders will ship complete unless otherwise noted here:');
Crap. Sorry Ajeh...I didn't see your post before I wrote my last one! My bad! I'll totally give it another whirl now that I've gotten a little guidance! Thank you so much!
Ok...so...the files I need to edit are:
/includes/classes/order.php
/includes/modules/pages/checkout_shipping/header_php.php
/includes/modules/pages/checkout_process/header_php.php
/includes/includes/modules/pages/checkout_payment/header_php.php
/includes/modules/pages/checkout_confirmation/header_php.php
The header.php files are the ones that carry the $_SESSION data from one page to the other...right?
That is correct ... look in the header_php files for how the $_SESSION['comments'] is managed and used so not to lose the comments from page to page between the variable $comments and $_SESSION['comments'] ...
Then do a search in the order.php class for how the ip_address is put into the orders table ...
Just follow the bouncing balls ... :cool:
Yes, ma'am. Thanks so much for your help!
Let us know how you get along on this one ... :smile:
I too realised the need for this option today and started searching for a ready module.
This seems to be an interesting discussion.
JDW, have you been able to get this right.
ANy help will be greatly appreciated.
Thanks!
I haven't had a chance to work on it yet since the couple of days that I was kicking it around. As soon as I get it done I'll totally post a step by step guide.
How can I configure Zen Cart to show the PHP errors? Is that a Zen thing or a php.ini thing...or both? I know I'm getting close to solving this problem (the ship complete problem, I mean) and having the errors output would help me find where my problems are residing.
If you are not using v1.3.9 ... you can get the Debug Tool in the Free Software Add Ons to help you see the error messages ...