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.
I would like to get a mod so that the built in mini cart in 5.1 can show the items (either product number or name) in the cart. with the price of that item next to it:
I.E.
Cart Items
Item A $xx.xx
Item B $xx.xx
Total $xx.xx
View Cart | Checkout
I have the basic mini cart on a customer site I am working on
Offline
In the file ./cgi-bin/library/modules/ste_cart.pl in the routine 'ste_cart_mini' right below:
$mini_quantity = "0"; $mini_total = "0.00"; $mini_totalrecur = "0.00";
Add:
$mini_items = "";
Then change:
$sql_statement = " SELECT cart_prodquantity,cart_amtprod,cart_amtrecur FROM cart "; @mini = database_call('cart','SELECT',$sql_statement); foreach $row(@mini) { ($cart_prodquantity,$cart_amtprod,$cart_amtrecur) = @$row; $mini_quantity = ($mini_quantity + $cart_prodquantity); $mini_total = ($mini_total + $cart_amtprod); $mini_totalrecur = ($mini_totalrecur + $cart_amtrecur); } ######### End of foreach statement.
To:
$sql_statement = " SELECT cart_prodquantity,cart_prodname,cart_prodnumber,cart_amtprod,cart_amtrecur FROM cart "; @mini = database_call('cart','SELECT',$sql_statement); foreach $row(@mini) { ($cart_prodquantity,$cart_prodname,$cart_prodnumber,$cart_amtprod,$cart_amtrecur) = @$row; $mini_items .= "Item: $cart_prodnumber - $cart_prodname<BR>"; $mini_quantity = ($mini_quantity + $cart_prodquantity); $mini_total = ($mini_total + $cart_amtprod); $mini_totalrecur = ($mini_totalrecur + $cart_amtrecur); } ######### End of foreach statement. if ($mini_items =~ /\<BR\>$/) { chop($mini_items); chop($mini_items); chop($mini_items); chop($mini_items); } ######### End of if statement.
This will get the items available as (CGIVAR)mini_items(/CGIVAR).
Offline
Chris,
I know this is off the subject, but I was browsing the site and noticed that under the category of Eastwood Furniture, under each category, the menu along the top breaks and there are spaces between them. Not sure if you had noticed this, but I wanted to give you a heads up.
Offline
superhero2000 - thanks I did not see that, the images are to large is why it is pushing that out.
Sometimes you look at something so long you miss the obvious :-(
Offline
Nick,
I just made these change but they cart items still do not show up. Any ideas?
Offline
here it is:
<table border="0" cellspacing="0" cellpadding="4" width="100%" bgcolor="#E1E1E1" style="border-collapse: collapse; border: 1px dotted #C0C0C0"> <tr> <td width="100%" align="center"><b><a href="(CGIVAR)common_url(/CGIVAR)&pg=cart">Cart Summary</a></b> </td> </tr> <tr> <td width="100%" class="content2"> <b>Cart Items:</b><BR> <a href="(CGIVAR)common_url(/CGIVAR)&pg=cart">(CGIGET TYPE="SUB" VALUE="ste_cart_mini")</a> <br><br> <b>Cart Items in Cart:</b> (CGIVAR)mini_quantity(/CGIVAR)<br> <b>Total:</b> (CGIVAR)currency_symbol(/CGIVAR)(CGIVAR)mini_total(/CGIVAR) <BR><br><center> <A class="blue" HREF="(CGIVAR)common_url(/CGIVAR)&pg=cart">View Cart</A> :: <A class="blue" HREF="(CGIVAR)common_url_checkout(/CGIVAR)">Checkout</A> </center></td> </tr> <tr> <td width="100%" class="content2" bgcolor="#FFFFFF"> <center><img border="0" src="(CGIVAR)images_path(/CGIVAR)/site/reps.jpg" width="143" height="228"><br><br><img border="0" src="(CGIVAR)images_path(/CGIVAR)/site/secure.jpg" width="167" height="103"></center></td> </tr> </table>
Offline
You have a total of 3 items in your cart.
The total one-time charge is $32.97.
The total weight is 10.500 Pounds.
Item: Blue Wigit - Blue Wigit
Item: Green Wigit - Green Wigit
You have a total of 3 items in your cart.
The total one-time charge is $32.97.
The total weight is 10.500 Pounds.
Item: Blue Wigit - Blue Wigit - (Qty. 2)
Item: Green Wigit - Green Wigit - (Qty. 1)
Can you please tell me how to make this happen?
Below is the code from my ste_cart.pl and also from my site layout file.
Thank you.
####################################################################### # Ste Cart Mini # ####################################################################### sub ste_cart_mini { &initialize_sub_add('ste_cart_mini'); ######### ######### This routine gets info from the cart for a mini-cart display. ######### $mini_quantity = "0"; $mini_total = "0.00"; $mini_totalrecur = "0.00"; $mini_weight = "0.000"; $mini_items = ""; if (-e "$data_temp_path/$fd_usr.$data_table_ext") { my @mini = (); my $row = ""; $sql_statement = " SELECT cart_prodquantity,cart_prodname,cart_prodnumber,cart_amtprod,cart_amtrecur,cart_prodshipweight FROM cart "; @mini = database_call('cart','SELECT',$sql_statement); foreach $row(@mini) { ($cart_prodquantity,$cart_prodname,$cart_prodnumber,$cart_amtprod,$cart_amtrecur) = @$row; $mini_items .= "Item: $cart_prodnumber - $cart_prodname<BR>"; $mini_quantity = ($mini_quantity + $cart_prodquantity); $mini_total = ($mini_total + $cart_amtprod); $mini_totalrecur = ($mini_totalrecur + $cart_amtrecur); $mini_weight = ($mini_weight + ($cart_prodshipweight * $cart_prodquantity)); } ######### End of foreach statement. if ($mini_items =~ /\<BR\>$/) { chop($mini_items); chop($mini_items); chop($mini_items); chop($mini_items); } ######### End of if statement. $mini_total = sprintf("%.2f", $mini_total); $mini_totalrecur = sprintf("%.2f", $mini_totalrecur); $mini_weight = sprintf("%.3f", $mini_weight); @mini = (); } ######### End of if statement. &initialize_sub_remove('ste_cart_mini'); } ######### End of subroutine.
(CGIGET TYPE="SUB" VALUE="ste_cart_mini") You have a total of (CGIVAR)mini_quantity(/CGIVAR) items in your cart.<BR> The total one-time charge is (CGIVAR)currency_symbol(/CGIVAR)(CGIVAR)mini_total(/CGIVAR). <br> The total weight is (CGIVAR)mini_weight(/CGIVAR) Pounds. <br><br> (CGIVAR)mini_items(/CGIVAR) <br><br>
Offline
Change:
$mini_items .= "Item: $cart_prodnumber - $cart_prodname<BR>";
To:
$mini_items .= "Item: $cart_prodnumber - $cart_prodname - (Qty: $cart_prodquantity)<BR>";
Offline
Thank you Nick, but I have one other question.
Below is how it shows:
You have a total of 8 items in your cart.
The total one-time charge is $87.92.
The total weight is 28.000 Pounds.
Item: Blue Wigit - Blue Wigit - (Qty: 1)
Item: Red Wigit - Blue Wigit - (Qty: 2)
Item: Green Wigit - Green Wigit - (Qty: 5) - 5
Please note the
It puts the number after which ever the last item added is, and is equal to the quantity of the last item added.
How do we get rid of that?
Thank you again.
Offline
Thank you again!
Offline
How do I add the price for each item instead of just the subtotal? I want like a $mini_price variable, but when I look for a regular product price field to call from SQL, I couldn't find it.
For example, I want
You have a total of # items in your cart.
Item: ID - Name - Item Price
Item: ID - Name - Item Price
Item: ID - Name - Item Price
Your subtotal is $SubtotalPrice.
Offline
HI,
Is there anyway to make the item display in to clickable url to the products that are in the mini cart?
cheers
Charlie
Offline
acetracer,04/08/2004 04:01:35 PM wrote:
How do I add the price for each item instead of just the subtotal? I want like a $mini_price variable, but when I look for a regular product price field to call from SQL, I couldn't find it.
For example, I want
You have a total of # items in your cart.
Item: ID - Name - Item Price
Item: ID - Name - Item Price
Item: ID - Name - Item Price
Your subtotal is?$SubtotalPrice.
a quick fix
below
$mini_quantity  = "0"; $mini_total    = "0.00"; $mini_totalrecur = "0.00"; $mini_items    = "";
add
$cart_prodprice = "0.00";
in the foreach $row(@mini) loop add
$cart_prodprice = ($cart_amtprod / $cart_prodnumber); $cart_prodprice = sprintf("%.2f", $cart_prodprice);
and change mini_items to:
$mini_items .= "Item: $cart_prodnumber - $cart_prodname - (Price: $cart_prodprice)<BR>";
and if you want the item price to be the product of price*qty then ignore the above and just change the mini_items to
$mini_items .= "Item: $cart_prodnumber - $cart_prodname - (Price: $cart_amtprod)<BR>";
Offline