Zen Cart Logo
Forums / Addon Shipping Modules / modify USPS module display text on checkout pages?

modify USPS module display text on checkout pages?

Views: 2,022

Results 1 to 11 of 11
29 May 2012, 11:32 PM
#1
mcqueeneycoins avatar

mcqueeneycoins

Zen Follower

Join Date:
Jan 2008
Posts:
156
Plugin Contributions:
0

modify USPS module display text on checkout pages?

I'm sure there is a way to do this, but I'm trying to launch an updated site in less than 3 days and frankly need to focus my attention elsewhere. What I'm trying to do is have the text on the checkout_payment page for the Shipping option selected say "Shipping:" no matter what option is selected. As it is now, if they select In-Store Pickup it says "Walk In" and if they pick USPS Priority Mail it says "United States Parcel Service (Parcel Post (4-7 days)):" which is really messing up the look I'm trying to achieve. I only want to modify this page, and leave the checkout_shipping page as is (where it would display the full text, delivery time, etc.). Does anyone have any suggestions on how I can achieve this?

Thanks in advance!

29 May 2012, 11:55 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: modify USPS module display text on checkout pages?

To change how this reads on the checkout_payment page only ... you can customize the code in:
/includes/modules/order_total/ot_shipping.php

with the code in RED:

    function process() {
      global $order, $currencies;

// bof: show different shipping title on checkout_payment
if ($_GET['main_page'] == 'checkout_payment') {
        $this->output[] = array('title' => 'Shipping' . ':',
                                'text' => $currencies->format($order->info['shipping_cost'], true, $order->info['currency'], $order->info['currency_value']),
                                'value' => $order->info['shipping_cost']);
} else {
        $this->output[] = array('title' => $order->info['shipping_method'] . ':',
                                'text' => $currencies->format($order->info['shipping_cost'], true, $order->info['currency'], $order->info['currency_value']),
                                'value' => $order->info['shipping_cost']);
}
// eof: show different shipping title on checkout_payment
    }
30 May 2012, 3:48 AM
#3
mcqueeneycoins avatar

mcqueeneycoins

Zen Follower

Join Date:
Jan 2008
Posts:
156
Plugin Contributions:
0

Re: modify USPS module display text on checkout pages?

Thank you--this worked great!

I found one more thing in the USPS module I have a question on: Is there a way to get rid of the ( ) around "Parcel Post" or "Priority Mail", etc? I only found the section with the ( ) around the transit time in modules/shipping/usps.php.

Thanks again!

Ajeh:

To change how this reads on the checkout_payment page only ... you can customize the code in:
/includes/modules/order_total/ot_shipping.php

with the code in RED:

function process() {
  global $order, $currencies;

// bof: show different shipping title on checkout_payment
if ($_GET['main_page'] == 'checkout_payment') {
$this->output[] = array('title' => 'Shipping' . ':',
'text' => $currencies->format($order->info['shipping_cost'], true, $order->info['currency'], $order->info['currency_value']),
'value' => $order->info['shipping_cost']);
} else {
$this->output[] = array('title' => $order->info['shipping_method'] . ':',
'text' => $currencies->format($order->info['shipping_cost'], true, $order->info['currency'], $order->info['currency_value']),
'value' => $order->info['shipping_cost']);
}
// eof: show different shipping title on checkout_payment
}

30 May 2012, 1:25 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: modify USPS module display text on checkout pages?

Look in the module:
/includes/modules/shipping/usps.php

and change the context of the two lines for:

            if ($time != '') $transittime[$service] = ' (' . $time . ')';
31 May 2012, 1:55 AM
#5
mcqueeneycoins avatar

mcqueeneycoins

Zen Follower

Join Date:
Jan 2008
Posts:
156
Plugin Contributions:
0

Re: modify USPS module display text on checkout pages?

Thanks, but that's not quite what I was looking for. I had already found that piece to adjust the ( ) around the transit days. I want to get rid of the ( ) around the whole shipping method:

Instead of "USPS (Parcel Post [4-7 days])"

I want "USPS Parcel Post [4-7 days]"

In the line of code you referenced, that's where I changed the ( ) to [ ], but it does not get rid of the ( ) around the bigger element.

Any thoughts?

Thanks again for your help.

Ajeh:

Look in the module:
/includes/modules/shipping/usps.php

and change the context of the two lines for:

        if ($time != '') $transittime[$service] = ' (' . $time . ')';
2 Jun 2012, 1:18 PM
#6
ajeh avatar

ajeh

Oba-san

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

Re: modify USPS module display text on checkout pages?

Look in the file:
/includes/modules/checkout_shipping/header_php.php

              $_SESSION['shipping'] = array('id' => $_SESSION['shipping'],
                                'title' => (($free_shipping == true) ?  $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][0]['title'] . ')'),
                                'cost' => $quote[0]['methods'][0]['cost']);
2 Jun 2012, 2:10 PM
#7
ajeh avatar

ajeh

Oba-san

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

Re: modify USPS module display text on checkout pages?

Also, for the Shipping Estimator you will want to look at:
/includes/templates/template_default/templates/tpl_modules_shipping_estimator.php

and using your templates and overrides customize the code for:

         <td class="bold"><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['methods'][$j]['title']; ?>)</td>
         <td class="cartTotalDisplay bold"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])); ?></td>
       </tr>
<?php
              }else{
?>
        <td><?php echo $quotes[$i]['module']; ?> (<?php echo $quotes[$i]['methods'][$j]['title']; ?>)</td>
        <td class="cartTotalDisplay"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])); ?></td>
2 Jun 2012, 3:54 PM
#8
mcqueeneycoins avatar

mcqueeneycoins

Zen Follower

Join Date:
Jan 2008
Posts:
156
Plugin Contributions:
0

Re: modify USPS module display text on checkout pages?

Thank you once again for your help! I just have one last question I'm hoping you can help me with:

I'm trying to make a conditional statement that will do one of two things...

(a) If order weight is 0, make the shipping charge $5.00 and ignore the USPS rate quotes. Ideally, it would still display as USPS Priority Mail [2-3 days] as the existing USPS module does, but not pull the rates from the USPS site.

(b) If what I've outlined in (a) can't be done, then is there a way to add a handling charge to First-Class Mail only? So, if you have a 0 weight order, offer First Class Mail at rate quote + $3.00 as well as Priority Mail at rate quote, with no handling charge?

Thank you!!!

2 Jun 2012, 4:32 PM
#9
ajeh avatar

ajeh

Oba-san

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

Re: modify USPS module display text on checkout pages?

You should be able to customize the code with:

    // disable only when entire cart is free shipping
    if (zen_get_shipping_enabled($this->code)) {
      $this->enabled = ((MODULE_SHIPPING_USPS_STATUS == 'True') ? true : false);
    }

// bof: turn off if weight is 0
if (!IS_ADMIN_FLAG) {
  if ($_SESSION['cart']->weight == 0) {
    $this->enabled = false;
  }
}
// eof: turn off if weight is 0

    if ($this->enabled) {

NOTE: ensure that in the Configuration ... Shipping/Packaging ... that the setting on:

Order Free Shipping 0 Weight Status
If there is no weight to the order, does the order have Free Shipping?
0= no
1= yes

Note: When using Free Shipping, Enable the Free Shipping Module this will only show when shipping is free.

is set to 0 for No ...

2 Jun 2012, 4:57 PM
#10
mcqueeneycoins avatar

mcqueeneycoins

Zen Follower

Join Date:
Jan 2008
Posts:
156
Plugin Contributions:
0

Re: modify USPS module display text on checkout pages?

Worked great! I used the same code on the flat-rate shipping module with a few tweaks and got it to switch between the two modules depending on weight. Thank you! You're a lifesaver

2 Jun 2012, 5:05 PM
#11
ajeh avatar

ajeh

Oba-san

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

Re: modify USPS module display text on checkout pages?

You are most welcome ... thanks for the update that this is working for you ...

Remember us when you are rich and famous! :cool: