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.

#26 01-28-2005 12:28:27

Shawn
Member
Registered: 09-24-2004
Posts: 216

Re: List Cart Products During Checkout Process

Hi, I just looked at your code and I see a problem.   Look at your last three lines of code in the lineitem part.  Change this:

Code:

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

}
&initialize_sub_remove('ste_cart_lineitem');

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

To this:

Code:

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


&initialize_sub_remove('ste_cart_lineitem');

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

(Remove the extra bracket above &initialize_sub)

Also, It should not matter but here is what my ste_cart_headchk file looks like:

Code:

<BR>

<TABLE WIDTH="475" CELLPADDING="4" CELLSPACING="3">
  
(CGIGET TYPE="SUB" VALUE="ste_cart_lineitem")

Hope that works for you.  Shawn


Offline

 

#27 01-30-2005 19:37:09

myqee
Member
From: London - UK
Registered: 11-11-2004
Posts: 55
Website

Re: List Cart Products During Checkout Process

Thanks Shawn... although removing that } has caused a page error. I think that } is required because of the added if satement by Nick:



I tried removing the if statement Nick added along with the bracket you suggested I remove and now the list shows up in the checkout.  :-)

I understand from reading the posts that Nick added the if statement to make this item list only appear on the checkout pages yet I have removed this statement and the list only seems to be appearing on checkout pages anyway?!... any ideas what Nicks if statment actually does?

I have noticed the list appears on the first 4 checkout pages of the 5 in total. Is there a way to implement this if staement that Nick added so that it causes the item list to appear  on page one of the checkout process as I have noticed that the customers purchased items are listed from checkout page 2 onwards already by CCP.

Thanks.


myqee
_____________________________________________________________



  <-- My CCP Shop!
_____________________________________________________________

Offline

 

#28 02-08-2005 11:39:35

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

Re: List Cart Products During Checkout Process

This would be done with the following statement:

Code:


if ($fd_pg eq "ste_chkout_proc" && $fd_func eq "ste_chkout_intro") {


Nick Hendler

Offline

 

#29 02-22-2005 08:30:28

myqee
Member
From: London - UK
Registered: 11-11-2004
Posts: 55
Website

Re: List Cart Products During Checkout Process

Thanks Nick,

I tried adding your new if statement but it made the product item list disappear again.

I then tried it without the '' part which was in the original statement. So the statement now looks like:

Code:

if ($fd_func eq "ste_chkout_intro") {

The product list now appears again and only on the initial checkout page as I required. Cheers.  :-)

Is the '$fd_pg eq "ste_chkout_proc"' part of the if statement only required for older versions of CCP? (I'm using 5.1 tiki)


myqee
_____________________________________________________________



  <-- My CCP Shop!
_____________________________________________________________

Offline

 

#30 03-14-2005 05:28:00

ashdog24
Member
Registered: 10-05-2004
Posts: 44

Re: List Cart Products During Checkout Process

Hello Folks,

I modified the code a bit to get the items in the shopping cart to show up properly in the checkout process. This modification shows up in the entire checkout process, except the order confirmation page. Because of this mod, it also changes the look of the totals listed for the order under 'order totals' in the confirmation page, track your order, and order history. However, it does show the current items of the cart on the order confirmation, track your order, and order history pages as described in the previous posts. I also added the ability in clicking on the product names in the cart box, taking you to the actual product detail page of that item. I also added the unit price of the items too. I even added the totals such as tax, shipping, item subtotal, etc within the box as well in a nice format. However, I cannot get the spacing between the items in the cart and the totals. Please, webmaster and everyone else, check my work to see if this mod does not anything else with ClickCartPro.

Please, make a backup of your files before attempting this.

Okay, here we go:

First, put this subroutine below in the file 'ste_chkout.pl' file (not in the ste_cart.pl file) in the cgi-bin/library/modules directory:

Code:

#######################################################################
# Ste Cart lineitem                                                   #
#######################################################################

sub ste_cart_lineitem {

&initialize_sub_add('ste_cart_lineitem');



#########
######### This routine gets info from the cart for a mini-cart display.
#########
$lineitem_prodquantity = "...";
$lineitem_prodoptions = "...";
$lineitem_prodname = "...";
$lineitem_amtprod = "...";
$lineitem_prodnumber = "...";




if (-e "$data_temp_path/$fd_usr.$data_table_ext") {

my @lineitem = ();
my $row = "";

$sql_statement = "
SELECT cart_prodid,cart_prodquantity,cart_prodname,cart_prodoptions,cart_amtprod,cart_prodnumber
FROM cart
";

@lineitem = database_call('cart','SELECT',$sql_statement);

print <<ENDOFTEXT;
<TR BGCOLOR="#D4D4D4">

<TD WIDTH="10%" ALIGN="CENTER" VALIGN="CENTER"><FONT FACE="$html_small_font_face" SIZE="$html_small_font_size" COLOR="$html_small_font_color"><B>Quantity</B></TD>

<TD WIDTH="20%" ALIGN="CENTER" VALIGN="CENTER"><FONT FACE="$html_small_font_face" SIZE="$html_small_font_size" COLOR="$html_small_font_color"><B>Item Number</B></FONT></TD>

<TD WIDTH="50%" ALIGN="CENTER" VALIGN="CENTER"><FONT FACE="$html_small_font_face" SIZE="$html_small_font_size" COLOR="$html_small_font_color"><B>Item</B></FONT></TD>

<TD WIDTH="10%" ALIGN="CENTER" VALIGN="CENTER"><FONT FACE="$html_small_font_face" SIZE="$html_small_font_size" COLOR="$html_small_font_color"><B>Unit</B></FONT></TD>

<TD WIDTH="10%" ALIGN="CENTER" VALIGN="CENTER"><FONT FACE="$html_small_font_face" SIZE="$html_small_font_size" COLOR="$html_small_font_color"><B>Total</B></FONT></TD>

</TR>
ENDOFTEXT

foreach $row(@lineitem) {

($cart_prodid,$cart_prodquantity,$cart_prodname,$cart_prodoptions,$cart_amtprod,$cart_prodnumber) = @$row;

## ### added for line items 
$lineitem_prodquantity  =  $cart_prodquantity;
$lineitem_prodname      =  $cart_prodname;
$lineitem_prodoptions   =  $cart_prodoptions;
$lineitem_amtprod       =  $cart_amtprod;
$lineitem_prodnumber    =  $cart_prodnumber;

$cart_linkopen = "";
$cart_linkclose = "";

if ($store_cart_links eq "Y" && $cart_url ne "") {

$cart_linkopen = "<A HREF=\"$cart_url\">";
$cart_linkclose = "</A>";

} elsif ($store_cart_links eq "Y" && $cart_prodid ne "") {

$cart_prodid_encoded = vars_urlencode($cart_prodid);

$cart_cat_encoded = vars_urlencode($cart_cat);

$cart_catstr_encoded = vars_urlencode($cart_catstr);
$cart_catstr_encoded =~ s/\%3A/\:/gs;

$cart_linkopen = "<A HREF=\"$common_url&pg=prod&ref=$cart_prodid_encoded&cat=$cart_cat_encoded&catstr=$cart_catstr_encoded\" class=\"productnamecolor\">";
$cart_linkclose = "</A>";

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

$unit_price = ($lineitem_amtprod / $lineitem_prodquantity);
$unit_price = sprintf("%.2f", $unit_price);



print <<ENDOFTEXT;
<TR BGCOLOR="#ffffff">

<TD VALIGN="CENTER" ALIGN="CENTER" WIDTH="10%"><FONT FACE="$html_small_font_face" SIZE="$html_small_font_size" COLOR="$html_small_font_color"><span class="productname">$lineitem_prodquantity</span></FONT></TD>

<TD VALIGN="CENTER" ALIGN="CENTER" WIDTH="20%"><FONT FACE="$html_small_font_face" SIZE="$html_small_font_size" COLOR="$html_small_font_color">$lineitem_prodnumber</FONT></TD>

<TD VALIGN="CENTER" ALIGN="CENTER" WIDTH="50%"><FONT FACE="$html_small_font_face" SIZE="$html_small_font_size" COLOR="$html_small_font_color">$cart_linkopen$lineitem_prodname$cart_linkclose</FONT></TD>

<TD VALIGN="CENTER" ALIGN="CENTER" WIDTH="10%"><FONT FACE="$html_small_font_face" SIZE="$html_small_font_size" COLOR="$html_small_font_color"><span class="unitpricecolor">$currency_symbol$unit_price</span></FONT></TD>

<TD VALIGN="CENTER" ALIGN="CENTER" WIDTH="10%"><FONT FACE="$html_small_font_face" SIZE="$html_small_font_size" COLOR="$html_small_font_color">$currency_symbol$lineitem_amtprod</FONT></TD>

</TR>
ENDOFTEXT

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

@lineitem = ();

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


&initialize_sub_remove('ste_cart_lineitem');

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

Second, replace all of the contents of the 'ste_cart_headchk' file and replace it with the code below, noting that I put (CGIGET TYPE="SUB" VALUE="ste_cart_lineitem") within the code to call the subroutine:

Code:

<BR>

<CENTER>

<div style="border-top-width: 1px; border-top-color: #B4B4B4; border-top-style: solid; border-right-color: #B4B4B4; border-right-style: solid; border-right-width: 1px; border-bottom-color: #B4B4B4; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: #B4B4B4; border-left-style: solid; border-left-width: 1px; padding-left:1px; padding-right:1px; padding-top:1px; padding-bottom:1px">
<TABLE WIDTH="(CGIVAR)html_cart_table_size(/CGIVAR)" COLS="5" CELLPADDING="1" CELLSPACING="0">

(CGIGET TYPE="SUB" VALUE="ste_cart_lineitem")

Third, add these CSS styles to to your 'ste_layout' file:

Code:

.productnamecolor {
     color: #000000;
}
.unitpricecolor {color: #6046EE}

Fourth, change the code in the 'ste_cart_subtotal ' file from:

Code:

<TR BGCOLOR="(CGIVAR)cart_row_color(/CGIVAR)">

<TD VALIGN="TOP" WIDTH="75%"><FONT FACE="(CGIVAR)html_small_font_face(/CGIVAR)" SIZE="(CGIVAR)html_small_font_size(/CGIVAR)" COLOR="(CGIVAR)html_small_font_color(/CGIVAR)">Item Subtotal</B></FONT></TD>

<TD VALIGN="TOP" ALIGN="RIGHT" WIDTH="25%"><FONT FACE="(CGIVAR)html_small_font_face(/CGIVAR)" SIZE="(CGIVAR)html_small_font_size(/CGIVAR)" COLOR="(CGIVAR)html_small_font_color(/CGIVAR)">(CGIVAR)currency_symbol(/CGIVAR)(CGIVAR)tracking_subtotal(/CGIVAR)</FONT></TD>

</TR>

To this:

Code:

<TR BGCOLOR="#FFFFFF">

<TD WIDTH="10%" ALIGN="CENTER" VALIGN="CENTER"><FONT FACE="(CGIVAR)html_small_font_face(/CGIVAR)" SIZE="(CGIVAR)html_small_font_size(/CGIVAR)" COLOR="(CGIVAR)html_small_font_color(/CGIVAR)"></FONT></TD>

<TD WIDTH="20%" ALIGN="CENTER" VALIGN="CENTER"><FONT FACE="(CGIVAR)html_small_font_face(/CGIVAR)" SIZE="(CGIVAR)html_small_font_size(/CGIVAR)" COLOR="(CGIVAR)html_small_font_color(/CGIVAR)"></FONT></TD>

<TD WIDTH="50%" ALIGN="left" VALIGN="CENTER"><FONT FACE="(CGIVAR)html_small_font_face(/CGIVAR)" SIZE="(CGIVAR)html_small_font_size(/CGIVAR)" COLOR="(CGIVAR)html_small_font_color(/CGIVAR)">Item Subtotal</FONT></TD>

<TD WIDTH="10%" ALIGN="CENTER" VALIGN="CENTER"><FONT FACE="(CGIVAR)html_small_font_face(/CGIVAR)" SIZE="(CGIVAR)html_small_font_size(/CGIVAR)" COLOR="(CGIVAR)html_small_font_color(/CGIVAR)">(CGIVAR)currency_symbol(/CGIVAR)(CGIVAR)tracking_subtotal(/CGIVAR)</FONT></TD>

<TD WIDTH="10%" ALIGN="CENTER" VALIGN="CENTER"><FONT FACE="(CGIVAR)html_small_font_face(/CGIVAR)" SIZE="(CGIVAR)html_small_font_size(/CGIVAR)" COLOR="(CGIVAR)html_small_font_color(/CGIVAR)"></FONT></TD>

</TR>

Do the same above to the rest of these seven files: 'ste_cart_discount', 'ste_cart_total', 'ste_cart_recurtotal', 'ste_cart_sale', 'ste_cart_shipping', 'ste_cart_stateprovtax', and 'ste_cart_countrytax', making sure that you change the variables and text that is associated with those files.


Fifth,

Replace all of the contents of your 'ste_cart_footc' file with this:

Code:

</TABLE>
</div>

</CENTER>


<BR>

I think that's everything. Once you are done, you will have a professional looking cart box showing on your checkout page. I hope you can find a solution to add the spacing between the items and the totals. Let me know if you run into any problems, as I am still a newbie, so bear with me!!

Thanks!!

Offline

 

#31 03-14-2005 13:39:31

ashdog24
Member
Registered: 10-05-2004
Posts: 44

Re: List Cart Products During Checkout Process

Ooops, I meant to say, as a result of this mod, it DOES NOT (the last post, I put 'it does show' and it's not the case) show the current items of the cart on the order confirmation, track your order, and order history pages as described in the previous posts. Sorry for the confusion!!!

Offline

 

#32 10-16-2005 18:33:10

tifosi
Member
Registered: 07-28-2004
Posts: 29

Re: List Cart Products During Checkout Process

Here's a modified version which includes the product options (and variance pricing), and also deals with the spacing between items.

It uses 4 elements in place of the hardcoded html. Standardisation.

Main code as in above post with modifications:

Code:

#######################################################################
# Ste Cart lineitem                                                   #
#######################################################################

sub ste_cart_lineitem {

&initialize_sub_add('ste_cart_lineitem');


#########
######### This routine gets info from the cart for a mini-cart display.
#########
$lineitem_prodquantity = "0.00";
$lineitem_prodoptions = "0";
$lineitem_prodname = "";
$lineitem_amtprod = "0";
$lineitem_prodnumber = "0";


if (-e "$data_temp_path/$fd_usr.$data_table_ext") {

my @lineitem = ();
my $row = "";

$sql_statement = "
SELECT cart_prodid,cart_prodquantity,cart_prodname,cart_prodoptions,cart_amtprod,cart_prodnumber,cart_amtsinopt,cart_amtpmopt,cart_amtsinprd

FROM cart
";

@lineitem = database_call('cart','SELECT',$sql_statement);

#
# New head display element
#
&display_print('ste_cart_line_head');

foreach $row(@lineitem) {

($cart_prodid,$cart_prodquantity,$cart_prodname,$cart_prodoptions,$cart_amtprod,$cart_prodnumber,$cart_amtsinopt,$cart_amtpmopt,$cart_amtsinprd) = @$row;

### added for line items 
$lineitem_prodquantity  =  $cart_prodquantity;
$lineitem_prodname      =  $cart_prodname;
$lineitem_prodoptions   =  $cart_prodoptions;
$lineitem_amtprod       =  $cart_amtprod;
$lineitem_prodnumber    =  $cart_prodnumber;
$lineitem_amtsinopt     =  $cart_amtsinopt;
$lineitem_amtsinopt     =  $cart_amtpmopt,
$lineitem_amtsinopt     =  $cart_amtsinprd,
$lineitem_optbropen     =  "(";
$lineitem_optbrclose    =  ")";

$cart_linkopen = "";
$cart_linkclose = "";

if ($store_cart_links eq "Y" && $cart_url ne "") {

$cart_linkopen = "<A HREF=\"$cart_url\">";
$cart_linkclose = "</A>";

} elsif ($store_cart_links eq "Y" && $cart_prodid ne "") {

$cart_prodid_encoded = vars_urlencode($cart_prodid);

$cart_cat_encoded = vars_urlencode($cart_cat);

$cart_catstr_encoded = vars_urlencode($cart_catstr);
$cart_catstr_encoded =~ s/\%3A/\:/gs;

$cart_linkopen = "<A HREF=\"$common_url&pg=prod&ref=$cart_prodid_encoded&cat=$cart_cat_encoded&catstr=$cart_catstr_encoded\" class=\"productnamecolor\">";
$cart_linkclose = "</A>";

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

$unit_price = ($lineitem_amtprod / $lineitem_prodquantity);
$unit_price = sprintf("%.2f", $unit_price);

#
# New item display element
#
&display_print('ste_cart_line_item');
#
# New option display element
#
&display_print('ste_cart_line_option');
#
# Optional Line spacer
#
&display_print('ste_cart_line_spacer');

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

@lineitem = ();

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

&initialize_sub_remove('ste_cart_lineitem');

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

New Elements requiring creation in site admin:

ste_cart_line_head

Code:

<TR BGCOLOR="(CGIVAR)html_pri_tablerow_color(/CGIVAR)">

<TD WIDTH="10%" ALIGN="CENTER" VALIGN="CENTER"><FONT FACE="(CGIVAR)html_small_font_face(/CGIVAR)" SIZE="(CGIVAR)html_small_font_size(/CGIVAR)" COLOR="(CGIVAR)html_small_font_color(/CGIVAR)"><B>Quantity</B></TD>

<TD WIDTH="20%" ALIGN="CENTER" VALIGN="CENTER"><FONT FACE="(CGIVAR)html_small_font_face(/CGIVAR)" SIZE="(CGIVAR)html_small_font_size(/CGIVAR)" COLOR="(CGIVAR)html_small_font_color(/CGIVAR)"><B>Item Number</B></FONT></TD>

<TD WIDTH="50%" ALIGN="CENTER" VALIGN="CENTER"><FONT FACE="(CGIVAR)html_small_font_face(/CGIVAR)" SIZE="(CGIVAR)html_small_font_size(/CGIVAR)" COLOR="(CGIVAR)html_small_font_color(/CGIVAR)"><B>Item</B></FONT></TD>

<TD WIDTH="10%" ALIGN="CENTER" VALIGN="CENTER"><FONT FACE="(CGIVAR)html_small_font_face(/CGIVAR)" SIZE="(CGIVAR)html_small_font_size(/CGIVAR)" COLOR="(CGIVAR)html_small_font_color(/CGIVAR)"><B>Unit</B></FONT></TD>

<TD WIDTH="10%" ALIGN="CENTER" VALIGN="CENTER"><FONT FACE="(CGIVAR)html_small_font_face(/CGIVAR)" SIZE="(CGIVAR)html_small_font_size(/CGIVAR)" COLOR="(CGIVAR)html_small_font_color(/CGIVAR)"><B>Total</B></FONT></TD>

</TR>

ste_cart_line_item

Code:

<TR BGCOLOR="(CGIVAR)html_pri_tablerow_color(/CGIVAR)">

<TD VALIGN="CENTER" ALIGN="CENTER" WIDTH="10%"><FONT FACE="(CGIVAR)html_small_font_face(/CGIVAR)" SIZE="(CGIVAR)html_small_font_size(/CGIVAR)" COLOR="(CGIVAR)html_small_font_color(/CGIVAR)"><span class="productname"> (CGIVAR)lineitem_prodquantity(/CGIVAR)</span></FONT></TD>

<TD VALIGN="CENTER" ALIGN="CENTER" WIDTH="20%"><FONT FACE="(CGIVAR)html_small_font_face(/CGIVAR)" SIZE="(CGIVAR)html_small_font_size(/CGIVAR)" COLOR="(CGIVAR)html_small_font_color(/CGIVAR)"> (CGIVAR)lineitem_prodnumber(/CGIVAR)</FONT></TD>

<TD VALIGN="CENTER" ALIGN="LEFT" WIDTH="50%"><FONT FACE="(CGIVAR)html_small_font_face(/CGIVAR)" SIZE="(CGIVAR)html_small_font_size(/CGIVAR)" COLOR="(CGIVAR)html_small_font_color(/CGIVAR)"> (CGIVAR)cart_linkopen(/CGIVAR)(CGIVAR)lineitem_prodname(/CGIVAR)(CGIVAR)cart_linkclose(/CGIVAR)</FONT></TD>

<TD VALIGN="CENTER" ALIGN="CENTER" WIDTH="10%"><FONT FACE="(CGIVAR)html_small_font_face(/CGIVAR)" SIZE="(CGIVAR)html_small_font_size(/CGIVAR)" COLOR="(CGIVAR)html_small_font_color(/CGIVAR)"> <span class="unitpricecolor">(CGIVAR)currency_symbol(/CGIVAR)(CGIVAR)unit_price(/CGIVAR)</span></FONT></TD>

<TD VALIGN="CENTER" ALIGN="CENTER" WIDTH="10%"><FONT FACE="(CGIVAR)html_small_font_face(/CGIVAR)" SIZE="(CGIVAR)html_small_font_size(/CGIVAR)" COLOR="(CGIVAR)html_small_font_color(/CGIVAR)">(CGIVAR)currency_symbol(/CGIVAR)(CGIVAR)lineitem_amtprod(/CGIVAR)</FONT></TD>

</TR>

ste_cart_line_option

Code:

<TR BGCOLOR="(CGIVAR)html_pri_tablerow_color(/CGIVAR)">

<TD VALIGN="CENTER" ALIGN="LEFT" WIDTH="10%"><FONT FACE="(CGIVAR)html_small_font_face(/CGIVAR)" SIZE="(CGIVAR)html_small_font_size(/CGIVAR)" COLOR="(CGIVAR)html_small_font_color(/CGIVAR)"></FONT></TD>

<TD VALIGN="CENTER" ALIGN="CENTER" WIDTH="20%"><FONT FACE="(CGIVAR)html_small_font_face(/CGIVAR)" SIZE="(CGIVAR)html_small_font_size(/CGIVAR)" COLOR="(CGIVAR)html_small_font_color(/CGIVAR)"></FONT></TD>

<TD VALIGN="CENTER" ALIGN="LEFT" WIDTH="50%"><FONT FACE="(CGIVAR)html_small_font_face(/CGIVAR)" SIZE="(CGIVAR)html_small_font_size(/CGIVAR)" COLOR="(CGIVAR)html_small_font_color(/CGIVAR)">(CGIVAR)lineitem_prodoptions(/CGIVAR)</FONT></TD>

<TD VALIGN="CENTER" ALIGN="CENTER" WIDTH="10%"><FONT FACE="(CGIVAR)html_small_font_face(/CGIVAR)" SIZE="(CGIVAR)html_small_font_size(/CGIVAR)" COLOR="(CGIVAR)html_small_font_color(/CGIVAR)"> <span class="unitpricecolor">(CGIVAR)lineitem_optbropen(/CGIVAR)(CGIVAR)cart_amtpmopt(/CGIVAR)(CGIVAR)currency_symbol(/CGIVAR)(CGIVAR)cart_amtsinopt(/CGIVAR)(CGIVAR)lineitem_optbrclose(/CGIVAR)</span></FONT></TD>

<TD VALIGN="CENTER" ALIGN="CENTER" WIDTH="10%"><FONT FACE="(CGIVAR)html_small_font_face(/CGIVAR)" SIZE="(CGIVAR)html_small_font_size(/CGIVAR)" COLOR="(CGIVAR)html_small_font_color(/CGIVAR)"></FONT></TD>

</TR>

ste_cart_line_spacer

Code:

<TR BGCOLOR="(CGIVAR)html_pri_tablerow_color(/CGIVAR)">

<TD VALIGN="CENTER" ALIGN="CENTER" WIDTH="100%"> </TD>
<TD VALIGN="CENTER" ALIGN="CENTER" WIDTH="100%"> </TD>
<TD VALIGN="CENTER" ALIGN="CENTER" WIDTH="100%"> </TD>
<TD VALIGN="CENTER" ALIGN="CENTER" WIDTH="100%"> </TD>
<TD VALIGN="CENTER" ALIGN="CENTER" WIDTH="100%"> </TD>

</TR>

Note, this- as with above mod, only works with normal pricing and +/currency variance. Recurring & weight variance will need tweaking.

Stephen

Offline

 

Board footer