Zen Cart Logo
Forums / Customization from the Admin / One time charge to be combined with total

One time charge to be combined with total

Views: 3,145

Results 1 to 15 of 15
27 Aug 2013, 3:49 AM
#1
dalmen avatar

dalmen

New Zenner

Join Date:
Jan 2013
Location:
Utah
Posts:
20
Plugin Contributions:
0

One time charge to be combined with total

I've been looking for this coding for a while, but no answer yet. My products are yard signs, and I have attributes to auto calculate and update total at the bottom. My attribute prices are hidden because they are not relevent (such as double sided +0.80 etc.)
Total price will update depending on what attributes they select, and quantity they pick. People will select single or double sided, size, wire sticks or none... all those are standard attribute prices that have quantity discounts coded, and reflect the total, but design proof is a "one time" charge. So after they select all the features they need, they get the total, but on the next screen, in the shpooing cart they see 2 prices. That will confuse them. The secont price is the one time charge, and it only shows up if they select the proof. Is there a way to combine that so that it's just one price? I'm attaching an image Attachment 12970

27 Aug 2013, 2:04 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: One time charge to be combined with total

Are you wanting to combine the Unit Price? Total Price? Or both for each Product?

27 Aug 2013, 2:22 PM
#3
dalmen avatar

dalmen

New Zenner

Join Date:
Jan 2013
Location:
Utah
Posts:
20
Plugin Contributions:
0

Re: One time charge to be combined with total

I would hope for both if at all possible. I also wonder would invoices and emails show it separate or together? I'd need it to be together on all of it.

If combining it is not an option, would there be a way to label the one time fee to show the attribute name next to it or something. Maybe have attribute name to the left of the $ amount

27 Aug 2013, 3:10 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: One time charge to be combined with total

It might make more sense to show the two seperate under the Unit Price then the combination under the Total Price ...

You can edit the file:
/includes/modules/pages/shopping_cart/header_php.php

with these changes or fool with them and see what you get changing from:

  $productsPriceEach = $currencies->format($ppe) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : '');
  $productsPriceTotal = $currencies->format($ppt) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : '');
  $buttonUpdate = ((SHOW_SHOPPING_CART_UPDATE == 1 or SHOW_SHOPPING_CART_UPDATE == 3) ? zen_image_submit(ICON_IMAGE_UPDATE, ICON_UPDATE_ALT) : '') . zen_draw_hidden_field('products_id[]', $products[$i]['id']);

to be:

  $productsPriceEach = $currencies->format($ppe) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : '');
[B]  $pp_onetime = zen_round(zen_add_tax($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id'])), $currencies->get_decimal_places($_SESSION['currency']));
  $pp_total_all = $pp_onetime + $ppt;
//  $productsPriceTotal = $currencies->format($ppt) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : '');
  $productsPriceTotal = $currencies->format($pp_total_all);
[/B]  $buttonUpdate = ((SHOW_SHOPPING_CART_UPDATE == 1 or SHOW_SHOPPING_CART_UPDATE == 3) ? zen_image_submit(ICON_IMAGE_UPDATE, ICON_UPDATE_ALT) : '') . zen_draw_hidden_field('products_id[]', $products[$i]['id']);
27 Aug 2013, 5:01 PM
#5
dalmen avatar

dalmen

New Zenner

Join Date:
Jan 2013
Location:
Utah
Posts:
20
Plugin Contributions:
0

Re: One time charge to be combined with total

Thank so much. That works great. For future readers of this post, the code above combined the right hand column, total and one time charge into one.

That still leaves 2 lines under the column on the left called unit, and I can live with that. However it would be ideal to possibly label it somehow so it shows what that bottom price is all about. For example, there are 2 instances that I have one time charge. One charge is if they request a proof, and other is if they request us to create the design. If possibly, is there a way to show on the left of the onetime charge what that charge is. (maybe insert an attributes name)

27 Aug 2013, 5:15 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: One time charge to be combined with total

As a guess, what if you change:

  $productsPriceEach = $currencies->format($ppe) . ($products[$i]['onetime_charges'] != 0 ? '<br />' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : '');

to read:

  $productsPriceEach = $currencies->format($ppe) . ($products[$i]['onetime_charges'] != 0 ? '[B]<br />one time:<br />[/B]' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : '');
27 Aug 2013, 6:46 PM
#7
dalmen avatar

dalmen

New Zenner

Join Date:
Jan 2013
Location:
Utah
Posts:
20
Plugin Contributions:
0

Re: One time charge to be combined with total

Perfect! Ajeh you are awesome.

Here's a solution for future Zeners...
I've made 1 minor change to the code. Existing code listed above inserts text between the two lines. To make the text appear as a label, and to position it on the left (in front) of the dollar amount simply remove "br" code that comes after your text, and it will keep it in the same line. In the image attached I've customized the text to apply for both design services, and for proofs since those are my only "one time" charges per product. Depending on your products, just change it to whatever you like.
Attachment 12975

27 Aug 2013, 6:52 PM
#8
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: One time charge to be combined with total

Thanks for the update that this is now working for you as you needed it ... :smile:

27 Aug 2013, 7:23 PM
#9
dalmen avatar

dalmen

New Zenner

Join Date:
Jan 2013
Location:
Utah
Posts:
20
Plugin Contributions:
0

Re: One time charge to be combined with total

I'm trying to plug in "each:" in front of the top line, but wherever i insert it, I'm getting an error. Any suggestion where would i insert that? Thanks.
(Example on image attached)
Attachment 12976

27 Aug 2013, 10:10 PM
#10
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: One time charge to be combined with total

Try adding:

$productsPriceEach = [B]'each:' . [/B]$currencies->format($ppe) . ($products[$i]['onetime_charges'] != 0 ? '[B]<br />one time:<br />[/B]' . $currencies->display_price($products[$i]['onetime_charges'], zen_get_tax_rate($products[$i]['tax_class_id']), 1) : '');
27 Aug 2013, 10:31 PM
#11
dalmen avatar

dalmen

New Zenner

Join Date:
Jan 2013
Location:
Utah
Posts:
20
Plugin Contributions:
0

Re: One time charge to be combined with total

Yes! That's it! Thanks so much. It works.

27 Aug 2013, 10:36 PM
#12
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: One time charge to be combined with total

You are most welcome ... remember the Zen Cart Team when you are rich and famous! :cool:

28 Aug 2013, 5:17 AM
#13
dalmen avatar

dalmen

New Zenner

Join Date:
Jan 2013
Location:
Utah
Posts:
20
Plugin Contributions:
0

Re: One time charge to be combined with total

To further customize the one time charges in the "review order" stage I've changed
includes\templates\template_default\templates\tpl_checkout_confirmation_default.php

around line 318 I've changed the code from:

<?php echo $currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']); if ($order->products[$i]['onetime_charges'] != 0 ) echo '<br /> ' . $currencies->display_price($order->products[$i]['onetime_charges'], $order->products[$i]['tax'], 1); ?>

changed to

<?php echo 'line total: ' .$currencies->display_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']); if ($order->products[$i]['onetime_charges'] != 0 ) echo '<br />design and/or proof: ' . $currencies->display_price($order->products[$i]['onetime_charges'], $order->products[$i]['tax'], 1); ?>
28 Aug 2013, 6:17 PM
#14
dalmen avatar

dalmen

New Zenner

Join Date:
Jan 2013
Location:
Utah
Posts:
20
Plugin Contributions:
0

Re: One time charge to be combined with total

If you have a popup_print_invoice installed, the "onetime charge" does not show up on pop up invoice. It adds it up, but on the bottom, but that's all there is. Is there a way to add that, anyone?

Here's the order history page from users account screen, and that is correct.
Attachment 12979

Here's a page that i get after clicking [Print Order Invoice]
Attachment 12980

As you can see, it adds up correctly, but the one time charges are not showing on pop up.

20 May 2014, 3:20 PM
#15
dalmen avatar

dalmen

New Zenner

Join Date:
Jan 2013
Location:
Utah
Posts:
20
Plugin Contributions:
0

Re: One time charge to be combined with total

Does anyone know if/how this could be done? Thanks