Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Deleting date from shipping method text

Deleting date from shipping method text

Views: 1,023

Results 1 to 7 of 7
11 Jan 2014, 7:54 AM
#1
kevinman4404 avatar

kevinman4404

New Zenner

Join Date:
Jul 2013
Posts:
8
Plugin Contributions:
0

Deleting date from shipping method text

Hi,
I am making a mobile version of my website/cart. I have Canada Post module installed.

Currently, in the checkout_shipping page the shipping method looks like this: Expedited, 2014-01-20
Currently, in the checkout_payment page the shipping method looks like this: Canada Post (Expedited, 2014-01-20):

I want it to look like this on the checkout_shipping page: Expedited
I want it to look like this on the checkout_payment page: Canada Post (Expedited):
I'm only using expedited as an example

There are two reasons for this: a) the text on the checkout_payment page is way too long when viewed on a phone and b) the date shouldn't be there anyways since I don't know the exact day I ship stuff out

Unfortunately there is no easy way for me to change this. I can edit stuff pretty well but this involves globals and PHP stuff beyond simple editing. If someone could tell me how to change this I would really appreciate it!
best
Kevin

11 Jan 2014, 1:36 PM
#2
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Deleting date from shipping method text

kevinman4404:

Hi,
I am making a mobile version of my website/cart. I have Canada Post module installed.

Currently, in the checkout_shipping page the shipping method looks like this: Expedited, 2014-01-20
Currently, in the checkout_payment page the shipping method looks like this: Canada Post (Expedited, 2014-01-20):

I want it to look like this on the checkout_shipping page: Expedited
I want it to look like this on the checkout_payment page: Canada Post (Expedited):
I'm only using expedited as an example

There are two reasons for this: a) the text on the checkout_payment page is way too long when viewed on a phone and b) the date shouldn't be there anyways since I don't know the exact day I ship stuff out

Unfortunately there is no easy way for me to change this. I can edit stuff pretty well but this involves globals and PHP stuff beyond simple editing. If someone could tell me how to change this I would really appreciate it!
best
Kevin

I believe that you are making this seem more difficult than it probably is. Whatever text shows up in place of expedited, use that to start a search on your files to find the edit location. It looks like somewhere in the process, the date is concatenated with the text of the "method" using any one of many methods of concatenation. What you want to do is either find that line where the date gets added in and comment out the date addition part, or if there is CSS around the date, then you can hide it wwith CSS (maybe even add applicable CSS controls instead of removing the information entirely.)

So, the process would go something like this, from thhe admin panel, goto tools, developers tool kit, then search for the text that normally displays in place of expedited. Should find somewhere a define statement that has all capital letters on the left, and the statement on the right. Now use the capitalized word (constant) to search again. This will identify which file and at which line of that file the constant is used. If it is assigned to a variable it is probably worth following that variable from creation to use in that file. You would be looking for something that is also added in that may have a date associated with it. When found, my suggestion would be to comment the applicable code out, leave yourself a note that might be worthy of searching for in the future and to help know what was edited and why.

12 Jan 2014, 10:49 AM
#3
kevinman4404 avatar

kevinman4404

New Zenner

Join Date:
Jul 2013
Posts:
8
Plugin Contributions:
0

Re: Deleting date from shipping method text

That's the thing, I know how to use the Developer's Tool Kit and still cannot get anywhere. (There is no text to search, I have to search by the div and surrounding divs)

Following the shipping checkout page, I get this relevant code:

div id="checkoutShippingContentChoose" class="important"><?php echo TEXT_CHOOSE_SHIPPING_METHOD; ?></div>

<?php
    } elseif ($free_shipping == false) {
?>
<div id="checkoutShippingContentChoose" class="important"><?php echo TEXT_ENTER_SHIPPING_INFORMATION; ?></div>

<?php
    }
?>
<?php
    if ($free_shipping == true) {
?>
<div id="freeShip" class="important" ><?php echo FREE_SHIPPING_TITLE; ?> <?php echo $quotes[$i]['icon']; ?></div>
<div id="defaultSelected"><?php echo sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) . zen_draw_hidden_field('shipping', 'free_free'); ?></div>

<?php
    } else {
      $radio_buttons = 0;
      for ($i=0, $n=sizeof($quotes); $i<$n; $i++) {
      // bof: field set
// allows FedEx to work comment comment out Standard and Uncomment FedEx
//      if ($quotes[$i]['id'] != '' || $quotes[$i]['module'] != '') { // FedEx
      if ($quotes[$i]['module'] != '') { // Standard
?>
<fieldset>
<legend><?php echo $quotes[$i]['module']; ?> <?php if (isset($quotes[$i]['icon']) && zen_not_null($quotes[$i]['icon'])) { echo $quotes[$i]['icon']; } ?></legend>

<?php
        if (isset($quotes[$i]['error'])) {
?>
      <div><?php echo $quotes[$i]['error']; ?></div>
<?php
        } else {
          for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) {
// set the radio button to be checked if it is the method chosen
            $checked = (($quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] == $_SESSION['shipping']['id']) ? true : false);

            if ( ($checked == true) || ($n == 1 && $n2 == 1) ) {
              //echo '      <div id="defaultSelected" class="moduleRowSelected">' . "\n";
            //} else {
              //echo '      <div class="moduleRow">' . "\n";
            }
?>
<?php
            if ( ($n > 1) || ($n2 > 1) ) {
?>
<div class="important forward"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][$j]['cost'], (isset($quotes[$i]['tax']) ? $quotes[$i]['tax'] : 0))); ?></div>
<?php
            } else {
?>
<div class="important forward"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])) . zen_draw_hidden_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id']); ?></div>
<?php
            }
?>

<?php echo zen_draw_radio_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'], $checked, 'id="ship-'.$quotes[$i]['id'] . '-' . str_replace(' ', '-', $quotes[$i]['methods'][$j]['id']) .'"'); ?>
<label for="ship-<?php echo $quotes[$i]['id'] . '-' . str_replace(' ', '-', $quotes[$i]['methods'][$j]['id']); ?>" class="checkboxLabel" ><?php echo $quotes[$i]['methods'][$j]['title']; ?></label>
<!--</div>-->
<br class="clearBoth" />
<?php
            $radio_buttons++;
          }
        }
?>

</fieldset>
<?php
    }
// eof: field set
      }
    }
?>

<?php
  } else {
?>

From there, I look in classes/shipping.php, which is where those classes are located. Unfortunately I cannot understand it, or figure out what in that file could be the date. So from there I am totally lost.

Any ideas?
best
Kevin

12 Jan 2014, 8:17 PM
#4
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Deleting date from shipping method text

kevinman4404:

That's the thing, I know how to use the Developer's Tool Kit and still cannot get anywhere. (There is no text to search, I have to search by the div and surrounding divs)

Following the shipping checkout page, I get this relevant code:

div id="checkoutShippingContentChoose" class="important"><?php echo TEXT_CHOOSE_SHIPPING_METHOD; ?></div>

<?php } elseif ($free_shipping == false) { ?> <div id="checkoutShippingContentChoose" class="important"><?php echo TEXT_ENTER_SHIPPING_INFORMATION; ?></div> <?php } ?> <?php if ($free_shipping == true) { ?> <div id="freeShip" class="important" ><?php echo FREE_SHIPPING_TITLE; ?> <?php echo $quotes[$i]['icon']; ?></div> <div id="defaultSelected"><?php echo sprintf(FREE_SHIPPING_DESCRIPTION, $currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER)) . zen_draw_hidden_field('shipping', 'free_free'); ?></div> <?php } else { $radio_buttons = 0; for ($i=0, $n=sizeof($quotes); $i<$n; $i++) { // bof: field set // allows FedEx to work comment comment out Standard and Uncomment FedEx // if ($quotes[$i]['id'] != '' || $quotes[$i]['module'] != '') { // FedEx if ($quotes[$i]['module'] != '') { // Standard ?> <fieldset> <legend><?php echo $quotes[$i]['module']; ?> <?php if (isset($quotes[$i]['icon']) && zen_not_null($quotes[$i]['icon'])) { echo $quotes[$i]['icon']; } ?></legend> <?php if (isset($quotes[$i]['error'])) { ?>
  <div><?php echo $quotes[$i]['error']; ?></div>
<?php } else { for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) { // set the radio button to be checked if it is the method chosen $checked = (($quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] == $_SESSION['shipping']['id']) ? true : false); if ( ($checked == true) || ($n == 1 && $n2 == 1) ) { //echo ' <div id="defaultSelected" class="moduleRowSelected">' . "\n"; //} else { //echo ' <div class="moduleRow">' . "\n"; } ?> <?php if ( ($n > 1) || ($n2 > 1) ) { ?> <div class="important forward"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][$j]['cost'], (isset($quotes[$i]['tax']) ? $quotes[$i]['tax'] : 0))); ?></div> <?php } else { ?> <div class="important forward"><?php echo $currencies->format(zen_add_tax($quotes[$i]['methods'][$j]['cost'], $quotes[$i]['tax'])) . zen_draw_hidden_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id']); ?></div> <?php } ?> <?php echo zen_draw_radio_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'], $checked, 'id="ship-'.$quotes[$i]['id'] . '-' . str_replace(' ', '-', $quotes[$i]['methods'][$j]['id']) .'"'); ?>

<label for="ship-<?php echo $quotes[$i]['id'] . '-' . str_replace(' ', '-', $quotes[$i]['methods'][$j]['id']); ?>" class="checkboxLabel" ><?php echo $quotes[$i]['methods'][$j]['title']; ?></label>

<!--</div>--> <br class="clearBoth" /> <?php $radio_buttons++; } } ?> </fieldset> <?php } // eof: field set } } ?> <?php } else { ?>
> 
> From there, I look in classes/shipping.php, which is where those classes are located. Unfortunately I cannot understand it, or figure out what in that file could be the date. So from there I am totally lost.
> 
> Any ideas?
> best
> Kevin

Seems you are taking the approach of how do I have nothing and create what is to be seen.  This can be fine, but it also seems you are at a point where you have something created and need to figure out how it got that way. That's where I recommend using the screen output to back track where it came from. The same variable is being displayed on the two different screens, it's just one is in parenthesis the other is not.  The variable is created somewhere in the shipping object.  The easiest way to back track where or what variable is to identify where "expedited" comes from, into which variable it is added, and then follow that variable to see what else is added to it and what that something else is.  In a sense reverse engineer the situation rather than trying to step down through all of the code.
13 Jan 2014, 12:28 PM
#5
kevinman4404 avatar

kevinman4404

New Zenner

Join Date:
Jul 2013
Posts:
8
Plugin Contributions:
0

Re: Deleting date from shipping method text

mc12345678:

Seems you are taking the approach of how do I have nothing and create what is to be seen. This can be fine, but it also seems you are at a point where you have something created and need to figure out how it got that way. That's where I recommend using the screen output to back track where it came from. The same variable is being displayed on the two different screens, it's just one is in parenthesis the other is not. The variable is created somewhere in the shipping object. The easiest way to back track where or what variable is to identify where "expedited" comes from, into which variable it is added, and then follow that variable to see what else is added to it and what that something else is. In a sense reverse engineer the situation rather than trying to step down through all of the code.

Well, I figured out that the concatenated function is "title" in the classes file. But, I found three declarations in different files and none gave me any information on the function's components. They were:

'title' => $zf_ot_modules[$i]['title'], 
 'title' => $GLOBALS[$class]->output[$i]['title'],
'title' => $quotes['module'] . ' (' . $quotes['methods'][$i]['title'] . ')', 
```(editing this had no effect)

So I thought, if "title" isn't giving me any information, the Canada Post module must be quoting from its server and writing the information somewhere. And I found a concatenated string and was able to remove the date and comma. I still don't understand how it communicated it to the shipping/payment pages, but at least I solved the problem :) thanks for trying to help
13 Jan 2014, 10:22 PM
#6
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Deleting date from shipping method text

kevinman4404:

Well, I figured out that the concatenated function is "title" in the classes file. But, I found three declarations in different files and none gave me any information on the function's components. They were:

'title' => $zf_ot_modules[$i]['title'],

> ```
 'title' => $GLOBALS[$class]->output[$i]['title'],

'title' => $quotes['module'] . ' (' . $quotes['methods'][$i]['title'] . ')',

> 
> So I thought, if "title" isn't giving me any information, the Canada Post module must be quoting from its server and writing the information somewhere. And I found a concatenated string and was able to remove the date and comma. I still don't understand how it communicated it to the shipping/payment pages, but at least I solved the problem :) thanks for trying to help

Glad you figured out where to edit the results. As for "communicating" with Canada Post, the functionality of a plugin or utility is rarely solely in a class file only. And actually a class is typically just an object that holds it's own data and has functions and modules that interface with it. With results typically displayed through a template. So the communication probably occurs through one of those other two (function or module) or a combonation of the two, with my guess that the date and comma issue being found in a module file. 

If I'm wrong, well, is a best guess, but point was to trace the info, find somewhere that contained the text of concern and modify the code to suit, which you did. Congratulations! Good luck on the next endevor. Btw, it would help others if you posted where the line/code was that you either commmented out or deleted in case someone else has the same desire, they know where to go and not have to repeat the effort. :)
15 Jan 2014, 6:32 AM
#7
kevinman4404 avatar

kevinman4404

New Zenner

Join Date:
Jul 2013
Posts:
8
Plugin Contributions:
0

Re: Deleting date from shipping method text

mc12345678:

Glad you figured out where to edit the results. As for "communicating" with Canada Post, the functionality of a plugin or utility is rarely solely in a class file only. And actually a class is typically just an object that holds it's own data and has functions and modules that interface with it. With results typically displayed through a template. So the communication probably occurs through one of those other two (function or module) or a combonation of the two, with my guess that the date and comma issue being found in a module file.

If I'm wrong, well, is a best guess, but point was to trace the info, find somewhere that contained the text of concern and modify the code to suit, which you did. Congratulations! Good luck on the next endevor. Btw, it would help others if you posted where the line/code was that you either commmented out or deleted in case someone else has the same desire, they know where to go and not have to repeat the effort. :)

The line was:

$aryProducts[$index] = array($name . ', ' . $deliveryDate => $rate);

Deleting the comma and $deliveryDate and connectors prevents it being used.
best
Kevin