Excuse me for replay delay.
In my shop I use simpe shopping method.
When client push "Checkout" button, he will see the page with "total coast" and comments.
So, I redesign "shipping" page. It will be better to rename this page to my_purchase, but
I am lazy :)
So, our shop will do: shopping_cart -> sheckout_shipping -> checkout_process -> checkout_success
First of all let's design a new chechout_shipping page.
/includes/templates/template_default/templates/tpl_checkout_shipping_default.php
Add this lines:
if (!$_SESSION['customer_id']) {
echo '<br><strong>You are not registered user</strong>';
.....
echo '<br>Name:<br>';
echo zen_draw_input_field('noname_name', '', 'size="24"');
echo '<br>Phone:<br>';
echo zen_draw_input_field('noname_phone', '', 'size="24"');
}
And add the table with product list in the top of file.
Modified tpl_checkout_shipping_default.php file attached to the post.
Now we should write handler.
I created "Noname Noname" user with fake e-mail adress. In my shop the "id" of this user is 8.
I think, It will be best to attach unregistered customer's name and phone to momments. It will
look like:
.....comment ... .. .NAME:LALALA PHONE:LALALA
Let's modify
/includes/modules/pages/checkout_shipping/header_php.php
See attached file, because next lines I add from chechout_payment and other files :)
require(DIR_WS_CLASSES . 'order.php');
$order = new order;
require(DIR_WS_CLASSES . 'order_total.php');
$order_total_modules = new order_total;
$order_total_modules->collect_posts();
$order_total_modules->pre_confirmation_check();
I han comented lines where not logged on cusromer redirected to the login page.
And at last add lines to attach name and phone to the comments:
if ( isset($_POST['action']) && ($_POST['action'] == 'process') ) {
// If user is nor registered, change his Id
if (!$_SESSION['customer_id']) { $_SESSION['customer_id']=8;
//Check is the name and phone filled
if ($_POST['noname_name']=="" || $_POST['noname_phone']=="" )
{ $anon_fields=false ;} else { $anon_fields=true ;}
$_SESSION['comments'] = zen_db_prepare_input($_POST['comments']."\nName:".$_POST['noname_name']."\nPhone:".$_POST['noname_phone']);
} else {
//normal comment to registered users
$_SESSION['comments'] = zen_db_prepare_input($_POST['comments']);
Destroy section in /includes/modules/pages/checkout_success/header_php.php
if ($_SESSION['customer_id']==8) {
zen_session_destroy();
$_SESSION['customer_id']=0;
}
Hope, I forgot nothing.
If it will be some questions - write them here or for_letters [at] urk [dot] net
Real shop with patched zen-cart is http://gofree.com.ua. Unfortunately in russian language :)
PS: sorry, comments in files are also in russian.
Patched files:
http://stern.org.ua/notes/zc_noname.rar