Gossamer Forum
Home : Products : DBMan : Customization :

Shopping cart

Quote Reply
Shopping cart
I'm not found the right way insert this code.
What is between ?

# Add the following to db.cgi in sub main() between some of the other
# elseif statments:

elsif ($in{'create_order'}) { &html_create_order; }
elsif ($in{'verify_address'}) { &html_create_order; }
elsif ($in{'rectify_address'}) { &html_create_order; }
elsif ($in{'address_OK'}) { &html_create_order; }
elsif ($in{'add_order'}) { &html_add_order; }
elsif ($in{'more_order'}) { &html_view_search; }
elsif ($in{'check_order'}) { &html_check_order; }
elsif ($in{'edit_order'}) { &html_edit_order; }
elsif ($in{'change_order'}) { &html_change_order; }
elsif ($in{'send_order'}) { &html_send_order; }
elsif ($in{'cancel_order'}) { &html_cancel_order; }



Quote Reply
Re: Shopping cart In reply to
 
Hi Werner,

In sub main some 15 lines from the top you find this:
Code:

# Main Menu. Check to see what the user requested, then, if he has permission for that
# request, do it. Otherwise send the user off to an unauthorized request page.
if ($in{'add_form'}) { if ($per_add) { &html_add_form; } else { &html_unauth; } }
elsif ($in{'add_record'}) { if ($per_add) { &add_record; } else { &html_unauth; } }
elsif ($in{'view_search'}) { if ($per_view) { &html_view_search; } else { &html_unauth; } }
elsif ($in{'view_records'}) { if ($per_view) { &view_records; } else { &html_unauth; } }
elsif ($in{'delete_search'}) { if ($per_del) { &html_delete_search; } else { &html_unauth; } }
elsif ($in{'delete_form'}) { if ($per_del) { &html_delete_form; } else { &html_unauth; } }
elsif ($in{'delete_records'}) { if ($per_del) { &delete_records; } else { &html_unauth; } }
elsif ($in{'modify_search'}) { if ($per_mod) { &html_modify_search; } else { &html_unauth; } }
elsif ($in{'modify_form'}) { if ($per_mod) { &html_modify_form; } else { &html_unauth; } }
elsif ($in{'modify_form_record'}) { if ($per_mod) { &html_modify_form_record; } else { &html_unauth; } }
elsif ($in{'modify_record'}) { if ($per_mod) { &modify_record; } else { &html_unauth; } }
elsif ($in{'admin_display'}) { if ($per_admin) { &admin_display; } else { &html_unauth; } }
elsif ($in{'logoff'}) { &auth_logging('logged off') if ($auth_logging);
$auth_logoff ? (print "Location: $auth_logoff\n\n") : (print "Location: $db_script_url\n\n"); }
elsif ((keys(%in) <= 2) || ($in{'login'})) { &html_home; }
Add your lines between the above and
Code:
else { &html_unkown_action; }
Quote Reply
Re: Shopping cart In reply to
Thank you for the help. I have insert this and it is work.

Now I have another question:

I would like a link to a function ( call ),
but I found not the right call.

<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Bestellnummer:</FONT></TD>
<TD WIDTH="80%"> <$font><A HREF="$db_script_link_url&create_order_form=1&ID=*">$rec{'Bestellnummer'}</Font></TD></TR>

Is this right ?

Werner


Quote Reply
Re: Shopping cart In reply to
Hi Werner,

I think there is a </A> missing in your statement:

<TD WIDTH="80%"> <$font><A HREF="$db_script_link_url&create_order_form=1&ID=*">$rec{'Bestellnummer'}</A></Font></TD></TR>

However, this link will only work if you have a new action create_order_form in the main menu in db.cgi. (See the previous posts). This action is not included in the mod. May be you mean &create_order?

I'm not sure I understand what it is that you want to do... Wink

Quote Reply
Re: Shopping cart In reply to
Thank you !
I have found another Way, but now I have another
problem:

CGI ERROR
==========================================
Error Message : Can't open /Info@cranpac.de.txt.
Script Location : /homepages/44/d13355047/htdocs/asp/alandi/db.pl
Perl Version : 5.00502
Setup File : default.cfg
User ID : Weisrock
Session ID : Weisrock.97721722726661

The Script can not save a eMailadress

I'm beginner in CGI and I must lot of learning.
I go step for step.


Werner



Quote Reply
Re: Shopping cart, $orders_dir In reply to
Hi Werner,

It seems that there is something missing with your $orders_dir (where the orders are saved)

Check in default.cfg that you have
# the path to the directory where the order files are stored
$orders_dir = "/home/yourdomain/www/cgi-bin/dbman/orders";
or someting similar.

Also check that you have the directory named orders in the directory where you have your db.cgi (the path above) and that this directory has the permissions rw-rw-rw.




Quote Reply
Re: Shopping cart, $orders_dir In reply to
Thank you. I have tested this - this is the error.
I have changed and changed and then wars in the default
no standing the path.

No I'm a step later. The next problem:

The script work to the screen

Now you can start adding CD to your order:


When I take a button the script work not. I see http 500 error.

Then I see this message:
The prepared order seems to have disappeared.
Maybe you have already sent or cancelled the order and by mistake used the browsers back button?

Werner





Quote Reply
Re: Shopping cart, $orders_dir In reply to
Do you have a DBMan with Shopping cart in Action ?
You tell me the url, please ?

Thank you from germany.

Werner

Quote Reply
Re: Shopping cart, 500 error In reply to
Hi Werner,

It seems that there is a some kind of syntax error in the code.

Check sub html_add_order.

Also check that once you have prepared the order that you actually have a corresponding file in your $orders_dir.



Quote Reply
Re: Shopping cart, in action In reply to
Hi Werner,

There is of course the demo at http://tangokites.org/dbman/.

You have the source code for this at
http://tangokites.org/dbman/db_cgi.txt,
http://tangokites.org/dbman/ordernary_pl.txt and
http://tangokites.org/dbman/ordernary_cfg.txt

These files contain also mods and hacks other than the shopping cart mod, so don't be alarmed if there are things you don't recognize.



Quote Reply
Re: Shopping cart, in action In reply to
Thank you very much, I will installed this and tested.



Quote Reply
Re: Shopping cart, 500 error In reply to
Check sub html_add_order.
Yes I have this.

Also check that once you have prepared the order that you actually have a corresponding file in your $orders_dir.

Yes, I have the directory and files mit email-name

This call I have #
&html_page_bottom;
&html_page_top;

I have this routine not found in the html.pl
When I this not # I have a lot of error.


I think my problem is in

sub html_record_long



<input type="submit" name="add_order" value="$submit_add">

<P>
<HR>
<P>
<input type="submit" name="check_order" value="$submit_check">
<input type="submit" name="send_order" value="$submit_send">

<input type="submit" name="cancel_order" value="$submit_cancel">

When I call only one button then I see the error 500 and no information in debug info. The script will on this point not work to the next stept.

Werner

Quote Reply
Re: Shopping cart, in action In reply to
This is my function.
When the script add a file in \orders then the
pointer is in this function ?

sub html_add_order {
# --------------------------------------------------------
# The user has tried to a record, and if successfulthis page will
# display the complete order so far as a confirmation.

my (%rec) = @_;

$rec{$db_key} =~ s/<?.B>//g;


$submit_more = "Order more $merchandise";
$submit_check = "Show Order";
$submit_send = "Bestellung abschicken";
$submit_cancel = "Cancel Order";

# Check that the order file is still there ....

if (!open(FILE, "<$orders_dir/$in{'order_mail'}.txt")){
$page_title = "Unfortunately the order could not be added.";

#&html_page_top;
&html_home;

print qq|
<$font>The prepared order seems to have disappeared.

Maybe you have already sent or cancelled the order and by mistake used the
browsers back button?
<p><CENTER>
<A HREF=$home_url>Home</A></p>
</CENTER>
</font>

|;

}
else {

&add_to_order;

if ($add_error) {
$page_title = "$merchandise not added to order.";
#&html_page_top;
# < -- Start page text -- >
print qq|
<$font>$message</font></p>
|;
# < -- End page text -->

&html_record_long;
&html_footer;
#&html_page_bottom;
}
elsif ($duplicate) {
$page_title = "Duplicate $in{'add_item'}.";
#&html_page_top;
# < -- Start page text -- >
print qq|
<$font>$message</font><p>
|;
# < -- End page text -->

}

else {
$page_title = "The $merchandise $in{'add_item'} has been added to the order";
# &html_page_top;
}

if (!$add_error) {

# < -- Start page text -- >
print qq|
<$font>Your order so far:</font></p>
|;
# < -- End page text -->

open (FILE, "<$orders_dir/$in{'order_mail'}.txt") || &fatal_error("Can't open $orders_dir/$in{'order_mail'}.txt.");
@lines = <FILE>;

close (FILE);

foreach $line (@lines) {
if ($line =~ /^\*/) {
print $line;
print "
"
}

}


print qq|
<CENTER>
<form action="$db_script_url" method="get" name="form1">
<input type=hidden name="db" value="$db_setup">
<input type=hidden name="uid" value="$db_uid">


<input type=hidden name="order_mail" value="$in{'order_mail'}">

<input type="submit" name="more_order" value="$submit_more">

<P>
<HR>
<P>
<input type="submit" name="check_order" value="$submit_check">
<input type="submit" name="send_order" value="$submit_send">

<input type="submit" name="cancel_order" value="$submit_cancel">
</FORM>
</CENTER>
|;

}
&html_footer;
#&html_page_bottom;
} # end else order_file found

}


I have e error in this function ?

Werner

Quote Reply
Re: Shopping cart, in action In reply to
Hi Werner,

I'm still travelling so unfortunately I cannot give you detailed support on the source code. It's strange that you don't get the error when you #-comment &html_page_top, usually it is the other way round: you get the 500 error if that particular line has been omitted. So it seems there is an html error somewhere

In your previous post: I dont understand what you mean with "When I call only one button then I see the error 500 and no information in debug info. The script will on this point not work to the next stept."

What is the URL to your DBman?


Quote Reply
Re: Shopping cart, in action In reply to
The URL ist http://www.weisrock.de/asp/alandi/db.pl

Quote Reply
Not muchs works In reply to
Hi Werner,

Have checked the site and not much of the shopping cart mod seems to work.

I think it would have been much better if you have installed the mod as it is and got that working before making your own customisation. Now the fault tracing is difficult.

Maybe tilmes (a user in this forum), who also is from Germany can help you out now? Try to send a private message to user "tilmes".


Quote Reply
Re: Not muchs works In reply to
Thank you !

I installed now the original mod and look who is the error.
I have to see in the original mod (default.cfg) is more then in the txt-mod. SUB-Routine I have not found.

I tell you when I have found the error.
I lokk for the user "times".

Werner