Kryptronic Software Support Forum

You are viewing this forum as a guest. Login to an existing account, or create a new account, to reply to topics and to create new topics.

#1 11-26-2004 09:32:35

hubbiida
Member
Registered: 07-13-2004
Posts: 101

Sub-total On Cart Page

Is there a way to easily display the sub-total on the shopping cart page? I tried calling 'ste_cart_checkout', which displays the total cost of all items in the cart, but it does not include any sale discounts (as it seems to on the checkout page, in ste_chkout_intro). Any ideas?
Thanks

Offline

 

#2 11-26-2004 22:49:00

hubbiida
Member
Registered: 07-13-2004
Posts: 101

Re: Sub-total On Cart Page

Could someone who knows about these things tell me if I'm completely nuts. I managed to achieve what I wanted to by taking the sub-routine "ste_chkout_intro", duplicating and renaming it as "ste_chkout_intro_cart_page", then removing everything after the printing of the sub-total with sales info, as follows:

Code:

#######################################################################
# Ste ChkOut Intro Cart Page                                          #
#######################################################################

sub ste_chkout_intro_cart_page {

&initialize_sub_add('ste_chkout_intro_cart_page');

#########
######### This routine checks displays the billing, discount, shipping
######### and custom info in a form.
#########

my @disp = ();
my $row = "";
my $export = "";
my @export = ();
my $found_count = "0";
my $param = "";
my $type = "";

#########
######### Get important information out of the shopping cart.
#########

&initialize_sub_require('ste_cart_get_info_proc');

&ste_cart_get_info_proc;

#########
######### If we have a minimum order set, however do not
######### meet the requirement, we need to present a message
######### and leave it at that.
#########

$minorder_reqmet = "Y";

if ($store_minorder_use eq "Y" && $tracking_subtotal < "$store_minorder_amt" && $cart_items_found > "0") {

&display_print('ste_chkout_minorder');

$minorder_reqmet = "N";

} ######### End of if statement.

#########
######### If we have at least one item in the cart, we can
######### checkout.
#########

if ($cart_items_found > "0" && $minorder_reqmet eq "Y") {

#########
######### In case the user bailed out of the order process
######### previously, we set all of the shipping methods and prices
######### back to their original values for catalog items.
#########

if ($ship_methods_found > "0") {

$dbins_cart_shipmethod = database_quote('cart','');
$dbins_cart_shipid = database_quote('cart','');
$dbins_cart_amtshipping = database_quote('cart','0.00');

$sql_statement = "

UPDATE cart SET
cart_shipmethod=$dbins_cart_shipmethod,
cart_shipid=$dbins_cart_shipid,
cart_amtshipping=$dbins_cart_amtshipping
WHERE cart_prodid<>''

";

&database_call('cart','UPDATE',$sql_statement);

@cart_contents = ();

} ######### End of if statement.

#########
######### If we have taxes in the cart, we need to delete those too.
#########

if ($tracking_stateprovtax > "0" || $tracking_countrytax > "0") {

$dbins_cart_amtstateprovtax = database_quote('cart','0.00');
$dbins_cart_amtcountrytax = database_quote('cart','0.00');

$sql_statement = "

UPDATE cart SET
cart_amtstateprovtax=$dbins_cart_amtstateprovtax,
cart_amtcountrytax=$dbins_cart_amtcountrytax
WHERE cart_id<>''

";

&database_call('cart','UPDATE',$sql_statement);

@cart_contents = ();

} ######### End of if statement.

#########
######### Figure out our sale amount.
#########

if ($salescript_use eq "Y" && $salescript_active ne "" && (-e "$data_elements_path/$salescript_active.$data_text_ext")) {

my @custom_script_code = ();
my $code_line = "";

$custom_script_code = "";

open (FILE, "$data_elements_path/$salescript_active.$data_text_ext");

@custom_script_code = <FILE>;

close (FILE);

foreach $code_line(@custom_script_code) {

$custom_script_code .= "$code_line";

} ######### End of foreach statement.

#########
######### Remove backtics, pipes, system, die and exec to reduce
######### the possibility of a hazardous effect on the server as
######### a result of running this code.  Luckily the webserver
######### can usually only affect world writable and in some cases
######### user owned files.  There should be no danger to the
######### filesystem, but it's good to do a little preventive
######### counterhacking.
#########

$custom_script_code =~ s/\`/\'/gs;
$custom_script_code =~ s/\|\|/%7C%7C/g;
$custom_script_code =~ s/\|/ /gs;
$custom_script_code =~ s/%7C%7C/\|\|/g;
$custom_script_code =~ s/system/System/gs;
$custom_script_code =~ s/exec/Exec/gs;
$custom_script_code =~ s/die/Die/gs;

#########
######### Eval just in case we have bad code...
#########

eval $custom_script_code;

} ######### End of if statement.

if ($tracking_saletotal <= "0") {

$tracking_saletotal = "0.00";
$tracking_saledesc = "";

} else {

$tracking_saletotal = "$tracking_saletotal";

} ######### End of if statement.


#########
######### Print the checkout cart display.
#########

&initialize_sub_require('ste_cart_checkout');
&ste_cart_checkout();

} ######### End of if statement.

&initialize_sub_remove('ste_chkout_intro_cart_page');

} ######### End of subroutine.

I called this sub-routine from the shopping cart footer, and low-and-behold, got what I wanted. Is this a reasonable approach, or am I causing myself all kinds of unseen problems?
Thanks for any help

Offline

 

#3 12-07-2004 10:56:29

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Sub-total On Cart Page

You're on a GOOD path here with some very BAD code.  You've duplicated the setup code for checkout which does all sort of nasty stuff if you're not in checkout (ie. deleting tax & shipping info, presenting minimum order errors, etc.).  Here's what you are looking for (I think):

Code:


#######################################################################
# Ste ChkOut Intro Cart Page                                          #
#######################################################################

sub ste_chkout_intro_cart_page {

&initialize_sub_add('ste_chkout_intro_cart_page');

#########
######### Get important information out of the shopping cart.
#########

&initialize_sub_require('ste_cart_get_info_proc');

&ste_cart_get_info_proc;

#########
######### Figure out our sale amount.
#########

if ($salescript_use eq "Y" && $salescript_active ne "" && (-e "$data_elements_path/$salescript_active.$data_text_ext")) {

my @custom_script_code = ();
my $code_line = "";

$custom_script_code = "";

open (FILE, "$data_elements_path/$salescript_active.$data_text_ext");

@custom_script_code = <FILE>;

close (FILE);

foreach $code_line(@custom_script_code) {

$custom_script_code .= "$code_line";

} ######### End of foreach statement.

#########
######### Remove backtics, pipes, system, die and exec to reduce
######### the possibility of a hazardous effect on the server as
######### a result of running this code.  Luckily the webserver
######### can usually only affect world writable and in some cases
######### user owned files.  There should be no danger to the
######### filesystem, but it's good to do a little preventive
######### counterhacking.
#########

$custom_script_code =~ s/\`/\'/gs;
$custom_script_code =~ s/\|\|/%7C%7C/g;
$custom_script_code =~ s/\|/ /gs;
$custom_script_code =~ s/%7C%7C/\|\|/g;
$custom_script_code =~ s/system/System/gs;
$custom_script_code =~ s/exec/Exec/gs;
$custom_script_code =~ s/die/Die/gs;

#########
######### Eval just in case we have bad code...
#########

eval $custom_script_code;

} ######### End of if statement.

if ($tracking_saletotal <= "0") {

$tracking_saletotal = "0.00";
$tracking_saledesc = "";

} else {

$tracking_saletotal = "$tracking_saletotal";

} ######### End of if statement.

#########
######### Print the checkout cart display.
#########

&initialize_sub_require('ste_cart_checkout');
&ste_cart_checkout();

&initialize_sub_remove('ste_chkout_intro_cart_page');

} ######### End of subroutine.


Nick Hendler

Offline

 

#4 12-09-2004 07:19:28

hubbiida
Member
Registered: 07-13-2004
Posts: 101

Re: Sub-total On Cart Page

Thanks Nick,
That does exactly what I wanted it to do. Don't know if other folks might like to have a preliminary sub-total on the cart page, but if so this works as a nice mod to do so.

Offline

 

#5 12-09-2004 09:25:12

thedon122
Member
Registered: 01-21-2004
Posts: 155

Re: Sub-total On Cart Page

hi,

i tried this

but i end up the two carts on the page - could this to do with that i have added the delet icon mod to the cart?

any thoughts?

Charlie

Offline

 

#6 12-10-2004 10:46:37

webmaster
Administrator
From: York, PA
Registered: 04-20-2001
Posts: 19798
Website

Re: Sub-total On Cart Page

On the checkout page?


Nick Hendler

Offline

 

#7 12-21-2004 07:56:53

thedon122
Member
Registered: 01-21-2004
Posts: 155

Re: Sub-total On Cart Page

Hi, Nick

It ends up with two displays on the checkout page and view cart page.

Offline

 

#8 12-21-2004 08:28:24

thedon122
Member
Registered: 01-21-2004
Posts: 155

Re: Sub-total On Cart Page

Hi,

Sorted!

I had put 2 call lines in and in the wrong place.

just deleted one line - now ok

thanks
Charlie

Offline

 

#9 04-17-2006 23:31:53

carasmo
Member
From: Florida
Registered: 10-07-2002
Posts: 147
Website

Re: Sub-total On Cart Page

Hello,

I have two questions about this mod:

Which file does it go in to ste_cart.pl?

And what do put in the element -- the code to make the subtotal is found where? -- and what do I name the element called?

Code:

&initialize_sub_require('ste_cart_checkout');
&ste_cart_checkout();

&initialize_sub_remove('ste_chkout_intro_cart_page');

} ######### End of subroutine.

Thanks!!!

Offline

 

#10 04-18-2006 09:46:24

steveblueradio
Member
From: Belfast, Northern Ireland
Registered: 06-28-2004
Posts: 755
Website

Re: Sub-total On Cart Page

I'm not to sure if anyone has installed this mod properly, as none of the ccp5.1 site's i've come accross dont have this, even the ones who try this mod......


I'm Gene Hunt, Your DCI, And it's 1973, Nearly Dinner Time, I'm havin hoops........

Cheers,
Steve
-------------------

Offline

 

#11 04-19-2006 13:43:41

hubbiida
Member
Registered: 07-13-2004
Posts: 101

Re: Sub-total On Cart Page

Take the code that Nick provides above, (which is basically an entire new sub-routine: "ste_chkout_intro_cart_page") and put it in ste_chkout.pl right after "ste_chkout_intro_table_proc". Now call the sub-routine from the following element: Shopping Cart - Footer - Update (found under Manage Site Elements). That's all I did, and it works like a charm.
Please see:
The site is entirely in Japanese, but you should be able to figure out how to add something to the cart and check out the subtotal.
Cheers,
Andrew

Offline

 

#12 04-19-2006 16:46:55

carasmo
Member
From: Florida
Registered: 10-07-2002
Posts: 147
Website

Re: Sub-total On Cart Page

Thank YOU!!!

Offline

 

#13 04-19-2006 18:44:20

steveblueradio
Member
From: Belfast, Northern Ireland
Registered: 06-28-2004
Posts: 755
Website

Re: Sub-total On Cart Page

thanks hubbiida

will give it another try, and see if I can get it to work this time round, last time i ended up with a half shopping cart/half checkout.... ;-)


I'm Gene Hunt, Your DCI, And it's 1973, Nearly Dinner Time, I'm havin hoops........

Cheers,
Steve
-------------------

Offline

 

#14 04-19-2006 19:32:33

steveblueradio
Member
From: Belfast, Northern Ireland
Registered: 06-28-2004
Posts: 755
Website

Re: Sub-total On Cart Page

hi hubbiida,
how did you get rid of the check out image?

cheers
steve


I'm Gene Hunt, Your DCI, And it's 1973, Nearly Dinner Time, I'm havin hoops........

Cheers,
Steve
-------------------

Offline

 

#15 04-19-2006 21:02:10

carasmo
Member
From: Florida
Registered: 10-07-2002
Posts: 147
Website

Re: Sub-total On Cart Page

Yes, please share how you got that nice formatting of the subtotal and get rid of the check out header on this page, but keep it for the other page.  I can only get a check out header and the table, it looks odd with the check out header.

Thank you again!

Offline

 

#16 04-20-2006 13:50:45

hubbiida
Member
Registered: 07-13-2004
Posts: 101

Re: Sub-total On Cart Page

Are you referring to the banner for the cart, which appears on the cart page but not on the checkout-cart page? If so, that is a matter of creating a new element for the cart header (a second version of ste_cart_headupd) specifically for the cart on the checkout page, and calling to that instead of the original from ste_cart_disp_proc_checkout. I have the banner inserted as by an image tag in one element (the original) and not the second.

As for the formatting, it's just a table constructed by several elements. The first element (which contains the table header) I created to display the first line, (which says "free shipping" in Japanese); the remaining elements are as follows:

ste_cart_subtotal
ste_cart_sale
ste_cart_discount
ste_cart_shipping
ste_cart_total

Since all my customers are in Japan I do not charge tax, but you may want/need to include: ste_cart_countrytax (comes before ste_cart_sale).

HTH,
Andrew

Offline

 

#17 04-21-2006 15:18:54

carasmo
Member
From: Florida
Registered: 10-07-2002
Posts: 147
Website

Re: Sub-total On Cart Page

Hello,

I'm dense or sumthin, but I can't follow what you're saying.

In the script posted the print command is this:


Code:

#########
######### Print the checkout cart display.
#########

&initialize_sub_require('ste_cart_checkout');
&ste_cart_checkout();

&initialize_sub_remove('ste_chkout_intro_cart_page');

} ######### End of subroutine.

It just goes and grabs the subroutine:

Code:

#######################################################################
# Ste Cart Checkout                                                   #
#######################################################################

sub ste_cart_checkout {

&initialize_sub_add('ste_cart_checkout');

#########
######### This routine displays the shopping cart to users on the
######### 'ste_checkout' page.
#########

&display_print('ste_strhd_checkout');

&ste_cart_disp_proc('C');

&initialize_sub_remove('ste_cart_checkout');

} ######### End of subroutine.

Which has the storehead built in. Do I create another subroutine without the store header?

I can't figure this out.

I ask this because I need to have the subtotal on the cart page, but when a person goes to the one click check out, they need to see different information under the store header because the one click check out page requires two clicks on the browser back button to return to the previous page, sometimes it doesn't let you leave the page at all with the browser menu, you actually have to click on a link to the page you want to return to, so I have to put a back button with hard code for going back twice in the browser history on the check out page, but not on the cart page.

I'm boggled.

Thanks for all your help!!!!



Offline

 

#18 04-22-2006 13:22:18

hubbiida
Member
Registered: 07-13-2004
Posts: 101

Re: Sub-total On Cart Page

Please excuse me, but I did this mod some time ago and I can't quite remembera all the details, but this may help: Here is my version of ste_cart_checkout:

Code:

#######################################################################
# Ste Cart Checkout                                                   #
#######################################################################

sub ste_cart_checkout {

&initialize_sub_add('ste_cart_checkout');

#########
######### This routine displays the shopping cart to users on the
######### 'ste_checkout' page.
#########



&ste_cart_disp_proc('C');

&initialize_sub_remove('ste_cart_checkout');

} ######### End of subroutine.

All it looks like I've done is to remove:

Code:

&display_print('ste_strhd_checkout');

Would that not do the trick?

Offline

 

#19 04-23-2006 00:33:52

carasmo
Member
From: Florida
Registered: 10-07-2002
Posts: 147
Website

Re: Sub-total On Cart Page

Yes it would remove it, but it would remove it on the actual check out page too. How do I add it on the "real" check out page now that I've removed it from the subroutine to display it?

Thank you so much for sharing.

I'll be gone for a while during a move, but I'll check back in a couple weeks.

Thanks!

Offline

 

#20 07-26-2008 13:25:13

Blitzen
Member
From: USA
Registered: 01-01-2005
Posts: 936

Re: Sub-total On Cart Page

Better way to remove CHECKOUT header image on the cart:
In ste_cart.pl, look for

Code:

#######################################################################
# Ste Cart Checkout
#######################################################################

sub ste_cart_checkout {

&initialize_sub_add('ste_cart_checkout');

######### This routine displays the shopping cart to users on the 'ste_checkout' page.

&ste_cart_disp_proc('C');

&initialize_sub_remove('ste_cart_checkout');

} ######### End of subroutine.

Change to

Code:

#######################################################################
# Ste Cart Checkout
#######################################################################

sub ste_cart_checkout {

&initialize_sub_add('ste_cart_checkout');

######### This routine displays the shopping cart to users on the 'ste_checkout' page.

if ($fd_pg =~ /chkout/) {
     &display_print('ste_strhd_checkout');
}

&ste_cart_disp_proc('C');

&initialize_sub_remove('ste_cart_checkout');

} ######### End of subroutine.

Offline

 

Board footer