changing checkout_shipping.php
I'm adding in a delivery date and time to the checkout process, and need to change modules/pages/checkout_shipping.php.
Can this be overridden with a template? or do I just have to replace the file?
If a template override works for this one, where do I put it? normally there is a 'classic' directory to indicate where overrides can be placed, but not in this case, so I am assuming it's backup followed by change (followed probably by tears before bedtime!)
thanks
Re: changing checkout_shipping.php
...and while I'm in there....
Is there an existing function within the system to display a popup message box, or do I have to go and drag some java in?
Re: changing checkout_shipping.php
G'day jmouse,
> I'm adding in a delivery date and time to the checkout process, and need to change
> modules/pages/checkout_shipping.php.
Curious. This file doesn't even exist with my installation. The closest matches are:
/languages/english/checkout_shipping.php
or
/modules/pages/checkout_shipping/header_php.php
Cheers
Rod
Re: changing checkout_shipping.php
ok. well spotted. I am clearly talking complete rubbish and had got 2 sets of files confused! Sorry.
The question about template override should indeed apply to /modules/pages/checkout_shipping/header_php.php
At present I've just made a backup copy of it.
Re: changing checkout_shipping.php
G'day,
> The question about template override should indeed apply
> to /modules/pages/checkout_shipping/header_php.php
Place the overide file into
/modules/CUSTOM/pages/checkout_shipping/header_php.php
I *think* that should work.
Cheers
Rod
Re: changing checkout_shipping.php
Thanks I'll give that a try. I hadn't thought of going so far bakc 'up' the directory structure.
Re: changing checkout_shipping.php
Jmouse, please keep us updated on this!! I know there are a number of people looking for a feature like this. :smile:
Quote:
Originally Posted by
jmouse
I'm adding in a delivery date and time to the checkout process, and need to change modules/pages/checkout_shipping.php.
Can this be overridden with a template? or do I just have to replace the file?
If a template override works for this one, where do I put it? normally there is a 'classic' directory to indicate where overrides can be placed, but not in this case, so I am assuming it's backup followed by change (followed probably by tears before bedtime!)
thanks
Re: changing checkout_shipping.php
I'm nearly done on this. I have managed to incorporate the spiffycal control to get a delivery date, and have it displayed on the emails, in the admin panel and stored in the database.
As soon as I am happy with it, I'll post how it was done (and then stand back and wait for the flames from people who say it should have been done differently!
Hopefully this will be quite soon, as I have a client waiting for it(!)
Re: changing checkout_shipping.php
I'm extremely excited to see your work! :smile:
Quote:
Originally Posted by
jmouse
I'm nearly done on this. I have managed to incorporate the spiffycal control to get a delivery date, and have it displayed on the emails, in the admin panel and stored in the database.
As soon as I am happy with it, I'll post how it was done (and then stand back and wait for the flames from people who say it should have been done differently!
Hopefully this will be quite soon, as I have a client waiting for it(!)
Re: changing checkout_shipping.php
I said a while ago I'd publish how I added some additional fields to the checkout process - in particular a delivery date using the JiffyCal applet used elsewhere in the site.
Here's how I did it. Note that these aren't exact instructions, you will have to use a bit of code eyeballing, but I did manage to get it all working. I'm sure the resident zencart gurus will also be throwing up their hands in horror, so apologies if there is a better way.
I am also assuming that you can find your way around a database and php code - this set of instructions really just points you at the files you need to change.
1. Back up your files and your database before starting. Really. Do it.
2. Add the extra fields to the database. I added them to the ORDERS table since they exist only once per order.
3. Change the following files and add in your new fields. I looked for either the comments field or the ip address field in each case and copied the code, changing it for the new fields.
includes/classes/order.php
includes/languages/english/xxx/checkout_shipping.php
includes/templates/xxx/templates/tpl_checkout_shipping_default.php
includes/modules/pages/checkout_shipping/header_php.php
You are looking to change any queries that mention the ORDERS table, and any forms. Bear in mind that although the IP address field is in the ORDERS table, the comments field isn't - however it is displayed in the right place, so use the two fields to guide you. In the above file names xxx is your template directory. Note that some of these files are not template-able, so you are changing the main shop processing.
4. If you are adding the spiffycal, create
includes/modules/pages/checkout_shipping/jscript_main.php file and insert the following code into it to declare the spiffycal
?>
<link rel="stylesheet" type="text/css" href="includes/javascript/spiffyCal/spiffyCal_v2_1.css">
<script language="javaScript" src="includes/javascript/spiffyCal/spiffyCal_v2_1.js"></script>
<script language="javascript" type="text/javascript"><!--
var TodaysDate=new Date()
var curr_date = TodaysDate.getDate();
var curr_month = TodaysDate.getMonth();
curr_month++;
var curr_year = TodaysDate.getFullYear();
var FullDate = curr_date + "/" + curr_month + "/" + curr_year;
var delivery_date_cal = new ctlSpiffyCalendarBox("delivery_date_cal", "checkout_address", "delivery_date", "btnDate1", FullDate, scBTNMODE_CUSTOMBLUE);
//--></script>
?>
If you get stuck with the calendar implementation, the spiffycal website was quite helpful. I ended up first implementing their example and then migrated it over to my needs.
5. Here's where it gets controversial. I copied the whole includes/javascript directory from my admin directory to the main store directory. I did this because I had deliberately obfuscated the name of the admin directory and didn't want to therefore refer to it explicitly in a define statement. So you will end up with 2 copies.
6. Change the includes/templates/xxx/common/tpl_main_page.php to include a definition for the spiffy calendar div (it needs this to work) only on the checkout shipping page. I inserted the following lines immediately under the <body> line.
<?php
//*****
//***** the first page of shipping now needs the spiffy calendar, so this div is required on that pagge only
if ($body_id == "checkoutshipping") {
echo "<div id='spiffycalendar' class='text'> </div>";
}
?>
That all takes care of the catalogue files. If you want to additionally display the new fields in the admin, there are more changes to make. You will need to change the following files.
admin/includes/classes/order.php
admin/includes/languages/english/orders.php
admin.orders.php
Again with these, look for something like the comment or ip fields and add your changes there.
If you run into problems, just put loads of 'echo' statements in around the place to identify where you have got to and the current contents of everything.
I think that's about it. If anyone wants to see how I did it in all it's unruly glory, let me know and I'll send them copies of the actual files from the site that I changed. If you want to see it in action, go to www.fatboys-catering.co.uk. You can use the test account to get through to the checkout email [email protected] password is s*w*0*r*d*f*1*s*h (without the * characters).