If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / General Questions / Help me track down where to find this in the code please: <div id="otshipping">

Help me track down where to find this in the code please: <div id="otshipping">

Started by s_mack on 16 Oct 2015, 10:33 PM · Views: 1,001

Results 1 to 9 of 9
16 Oct 2015, 10:33 PM
#1
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Post #1 by s_mack

Step 2 of checkout it shows "Your Total" and presents the subtotal, shipping, total, etc. I am trying to customize this area but I can't for the life of me find where it is!

Its a <div> with id="otshipping". I've extensively searched the files and I can't find what is generating this. Help appreciated.

16 Oct 2015, 10:47 PM
#2
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Location:
mostly harmless
Posts:
1,816
Plugin Contributions:
4

Post #2 by lhungil

Text shown to visitors in the Order Total listings come from the Order Total modules. In the case of the "shipping" (ot_shipping) order total module, the text will come from the shipping module (configured title and customer selected method).

The HTML structure is generated by the theme's template file "tpl_modules_order_totals.php".

What exactly are you trying to change?

The glass is not half full. The glass is not half empty. The glass is simply too big!
Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

16 Oct 2015, 10:51 PM
#3
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Post #3 by s_mack

Exactly what I'm trying to change is the display of the name of the shipping method with something more generic, such as simply "Shipping: "

So right now it looks like this:

Sub-Total: €78.63
Flat Rate (Best Way): €9.16
Total: €87.80

I want that to show:

Sub-Total: €78.63
Shipping: €9.16
Total: €87.80
16 Oct 2015, 10:54 PM
#4
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Post #4 by s_mack

I should mention that I don't want to mess with the titles for the module itself, because I still want it to display the same in the back end and recorded the same way to the database. I just want to change how it is displayed to the user during checkout.

16 Oct 2015, 11:04 PM
#5
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Post #5 by s_mack

Probably a better way, but I altered tpl_modules_order_totals.php like so:

<?php 

/**
 * Displays order-totals modules' output
 */
  for ($i=0; $i<$size; $i++) { ?>
<div id="<?php echo str_replace('_', '', $GLOBALS[$class]->code); ?>">
    <div class="totalBox larger forward"><?php echo $GLOBALS[$class]->output[$i]['text']; ?></div>
    <?php if ( strpos( $GLOBALS[$class]->output[$i]['title'], '(' )){ ?>
      <div class="lineTitle larger forward"><?php echo TEXT_SHIPPING_SUBTITLE; ?></div>
    <?php } else { ?>
    <div class="lineTitle larger forward"><?php echo $GLOBALS[$class]->output[$i]['title']; ?></div>
    <?php } ?>
</div>
<br class="clearBoth" />
<?php } ?>

Since the shipping line always (I think) has a parenthesis in it, I just check for that and output my defined text instead. It works, but I'm concerned if there is ever a case where my parenthesis test doesn't hold. Small concern though.

Thanks for pointing me in the direction. If you have a better solution, I'm all ears.

16 Oct 2015, 11:07 PM
#6
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Location:
mostly harmless
Posts:
1,816
Plugin Contributions:
4

Post #6 by lhungil

Create a new file in the currently selected theme's template folder named
"/includes/templates/<theme_name>/templates/tpl_modules_order_totals.php"

Try the following contents for the file:

<?php
/**
 * Module Template
 *
 * @package templateSystem
 * @copyright Copyright 2003-2005 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: tpl_modules_order_totals.php 2993 2006-02-08 07:14:52Z birdbrain $
 */
 ?>
<?php
/**
 * Displays order-totals modules' output
 */
  for ($i=0; $i<$size; $i++) { ?>
<div id="<?php echo str_replace('_', '', $GLOBALS[$class]->code); ?>">
    <div class="totalBox larger forward"><?php echo $GLOBALS[$class]->output[$i]['text']; ?></div>
    <div class="lineTitle larger forward"><?php
    	if($GLOBALS[$class]->code === 'ot_shipping') {
    		echo MODULE_ORDER_TOTAL_SHIPPING_TITLE . ':';
    	}
    	else {
    		echo $GLOBALS[$class]->output[$i]['title'];
    	}
    ?></div>
</div>
<br class="clearBoth" />
<?php } ?>

Only major downside I can think of off the top of my head would be if the site ever offers different shipping options on a per product basis (such as one item via UPS another in the order via USPS, etc), it may not be clear to the customer how things are being shipped (and they would see multiple shipping lines prefixed by "Shipping:").

Could do the check earlier (outside the loop and add the values for shipping together)... But then, very few Zen Cart shipping modules exist at this time with support for the above (so probably not needed in your store).

NOTE: Gotta love cross posting. Was typing the above when you posted your example :D

The glass is not half full. The glass is not half empty. The glass is simply too big!
Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

16 Oct 2015, 11:10 PM
#7
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Post #7 by s_mack

Same general idea, but yours is more generic. I'll use that, thanks!

16 Oct 2015, 11:16 PM
#8
lhungil avatar

lhungil

Totally Zenned

Join Date:
Feb 2012
Location:
mostly harmless
Posts:
1,816
Plugin Contributions:
4

Post #8 by lhungil

Clarification about the downside listed above. Should read something closer to: if the site offers different shipping carriers (or options) on a per product basis (such as one item via UPS and another item via USPS, etc) and allows mixed shipping carriers in the same order.

The glass is not half full. The glass is not half empty. The glass is simply too big!
Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

17 Oct 2015, 12:13 AM
#9
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Post #9 by s_mack

lhungil:

Clarification about the downside listed above. Should read something closer to: if the site offers different shipping carriers (or options) on a per product basis (such as one item via UPS and another item via USPS, etc) and allows mixed shipping carriers in the same order.

Thanks for that. If I were offering such shipping, I probably wouldn't want it generic. The only reason I want to change it is to save realestate on a small mobile screen. I'm trying to trim down unnecessary wording.