Media Mail Option

Locked

Started by ozgirl57 on 27 Apr 2009, 12:38 PM · Views: 8,002

Results 21 to 40 of 46
This thread is locked. New replies are disabled.
1 Feb 2010, 5:25 AM
#21
ajeh avatar

ajeh

Oba-san

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

Media Mail Option

You also added the rest of the code from post #10 correct?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

1 Feb 2010, 5:33 AM
#22
debtag avatar

debtag

Zen Follower

Join Date:
Sep 2006
Location:
Oregon
Posts:
207
Plugin Contributions:
0

Re: Media Mail Option

Ok...this is what I've done (and boy did I really do something, because now NO SHIPPING ESTIMATIONS show up!): :oops:

      */

// test contents for Media Mail
$skip_media = false;
$chk_media = 0;
$chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','4');
$chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','19');
$chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','20');
$chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','22');
$chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','24');
$chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','25');
if ($chk_media != $_SESSION['cart']->count_contents()) {
$skip_media = true;
}
$methods = array();
$size = sizeof($uspsQuote);
for ($i=0; $i<$size; $i++) {
list($type, $cost) = each($uspsQuote[$i]);
// BOF: UPS USPS
$title = ((isset($this->types[$type])) ? $this->types[$type] : $type);
if(in_array('Display transit time', explode(', ', MODULE_SHIPPING_USPS_OPTIONS))) $title .= $transittime[$type];
/*
$methods[] = array('id' => $type,
'title' => ((isset($this->types[$type])) ? $this->types[$type] : $type),
'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
*/
if ($type == 'MEDIA' && $skip_media) {
// skip Media Mail
} else {
$methods[] = array('id' => $type,
'title' => $title,
'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
}

1 Feb 2010, 5:55 AM
#23
debtag avatar

debtag

Zen Follower

Join Date:
Sep 2006
Location:
Oregon
Posts:
207
Plugin Contributions:
0

Re: Media Mail Option

Interesting...in my admin I have no usps shipping option. At the top of the page it says:

Parse error: syntax error, unexpected T_ELSEIF in /home//public_html//includes/modules/shipping/usps.php on line 242

1 Feb 2010, 6:01 AM
#24
debtag avatar

debtag

Zen Follower

Join Date:
Sep 2006
Location:
Oregon
Posts:
207
Plugin Contributions:
0

Re: Media Mail Option

Luckily I saved the file before I made the changes, so I re-uploaded the original file. Have any ideas what I did wrong? (I saved the edited file as well if you need to see it)

1 Feb 2010, 2:53 PM
#25
ajeh avatar

ajeh

Oba-san

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

Re: Media Mail Option

This is the code with a few lines before and after it showing ...

        // BOF: UPS USPS
        $this->quotes = array('id' => $this->code,
        'module' => $this->title . $show_box_weight);
        // EOF: UPS USPS

// bof: Media Check
// test contents for Media Mail
        $skip_media = false;
        $chk_media = 0;
        $chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','4');
        $chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','19');
        $chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','20');
        $chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','22');
        $chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','24');
        $chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','25');
        if ($chk_media != $_SESSION['cart']->count_contents()) {
          $skip_media = true;
        }
//echo '<br>IN USPS I SEE ' . $chk_media . ' count: ' . $_SESSION['cart']->count_contents() . ' Skip Media: ' . ($skip_media == true ? 'YES' : 'NO') . '<br>';
        $methods = array();
        $size = sizeof($uspsQuote);
        for ($i=0; $i<$size; $i++) {
          list($type, $cost) = each($uspsQuote[$i]);

          // BOF: UPS USPS
          $title = ((isset($this->types[$type])) ? $this->types[$type] : $type);
          if(in_array('Display transit time', explode(', ', MODULE_SHIPPING_USPS_OPTIONS)))    $title .= $transittime[$type];
          /*
          $methods[] = array('id' => $type,
          'title' => ((isset($this->types[$type])) ? $this->types[$type] : $type),
          'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
          */

          if ($type == 'MEDIA' && $skip_media) {
// skip Media Mail
          } else {
            $cost = preg_replace('/[^0-9.]/', '',  $cost);
            $methods[] = array('id' => $type,
                               'title' => $title,
                               'cost' => ($cost * $shipping_num_boxes) + (MODULE_SHIPPING_USPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_USPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_USPS_HANDLING) );
          }
        }
// bof: Media Check

        $this->quotes['methods'] = $methods;

See if this works for you ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

2 Feb 2010, 7:04 AM
#26
debtag avatar

debtag

Zen Follower

Join Date:
Sep 2006
Location:
Oregon
Posts:
207
Plugin Contributions:
0

Re: Media Mail Option

Well, I still have my postage estimator, but media mail still shows up in every circumstance. I put a book in the shopping cart, which is from cat 4...media mail was an option and it should have been. Great so far...then I put an electronic in the shopping cart from cat 6...media mail was still an option and was not supposed to be. Here is my code, again like you, I have posted some code before and after:

// BOF: UPS USPS
if (in_array('Display weight', explode(', ', MODULE_SHIPPING_USPS_OPTIONS))) {
switch (SHIPPING_BOX_WEIGHT_DISPLAY) {
case (0):
$show_box_weight = '';
break;
case (1):
$show_box_weight = ' (' . $shipping_num_boxes . ' ' . TEXT_SHIPPING_BOXES . ')';
break;
case (2):
$show_box_weight = ' (' . number_format($usps_shipping_weight * $shipping_num_boxes,2) . TEXT_SHIPPING_WEIGHT . ')';
break;
default:
$show_box_weight = ' (' . $shipping_num_boxes . ' x ' . number_format($usps_shipping_weight,2) . TEXT_SHIPPING_WEIGHT . ')';
break;
}
}
// EOF: UPS USPS
// BOF: UPS USPS
$this->quotes = array('id' => $this->code,
'module' => $this->title . $show_box_weight);
// EOF: UPS USPS
// bof: Media Check
// test contents for Media Mail
$skip_media = false;
$chk_media = 0;
$chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','4');
$chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','19');
$chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','20');
$chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','22');
$chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','24');
$chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','25');
if ($chk_media != $_SESSION['cart']->count_contents()) {
$skip_media = true;
}
//echo '<br>IN USPS I SEE ' . $chk_media . ' count: ' . $_SESSION['cart']->count_contents() . ' Skip Media: ' . ($skip_media == true ? 'YES' : 'NO') . '<br>';
$methods = array();
$size = sizeof($uspsQuote);
for ($i=0; $i<$size; $i++) {
list($type, $cost) = each($uspsQuote[$i]);
// BOF: UPS USPS
$title = ((isset($this->types[$type])) ? $this->types[$type] : $type);
if(in_array('Display transit time', explode(', ', MODULE_SHIPPING_USPS_OPTIONS))) $title .= $transittime[$type];
/*
$methods[] = array('id' => $type,
'title' => ((isset($this->types[$type])) ? $this->types[$type] : $type),
'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
*/
$methods[] = array('id' => $type,
'title' => $title,
'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
}
$this->quotes['methods'] = $methods;

(I am editing file: /home//public_html//includes/modules/shipping/usps.php...right?)

:(

2 Feb 2010, 7:29 AM
#27
debtag avatar

debtag

Zen Follower

Join Date:
Sep 2006
Location:
Oregon
Posts:
207
Plugin Contributions:
0

Re: Media Mail Option

Ugh Ajeh...I have looking over your code comparing it to mine...I'm not sure, I think I might have left something out. I feel so stupid when it comes to this code stuff. I'm sorry if I am frustrating...believe me, I am frustrated. Is it a possibility to send you my file via PM? :blush:

2 Feb 2010, 2:33 PM
#28
ajeh avatar

ajeh

Oba-san

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

Re: Media Mail Option

You are missing the final part of the code:

          if ($type == 'MEDIA' && $skip_media) {
// skip Media Mail
          } else {
            $cost = preg_replace('/[^0-9.]/', '',  $cost);
            $methods[] = array('id' => $type,
                               'title' => $title,
                               'cost' => ($cost * $shipping_num_boxes) + (MODULE_SHIPPING_USPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_USPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_USPS_HANDLING) );
          }
        }
// bof: Media Check

Look at the code that I posted and I included the code above the changes and some code below the changes ...

Start with a clean copy of usps.php so you can just copy in the code I gave you in place of that part of the code in the file ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

3 Feb 2010, 11:17 PM
#29
debtag avatar

debtag

Zen Follower

Join Date:
Sep 2006
Location:
Oregon
Posts:
207
Plugin Contributions:
0

Re: Media Mail Option

:( Hello again! (sadly)

Ok....below is my code, (with a little before and after), and also a screen shot of what I get to this point

AllI did was add one book from cat 4

TEXT_SHIPPING_WEIGHT . ')';
break;
default:
$show_box_weight = ' (' . $shipping_num_boxes . ' x ' . number_format($usps_shipping_weight,2) . TEXT_SHIPPING_WEIGHT . ')';
break;
}
}
// EOF: UPS USPS
// BOF: UPS USPS
$this->quotes = array('id' => $this->code,
'module' => $this->title . $show_box_weight);
// EOF: UPS USPS
// bof: Media Check
// test contents for Media Mail
$skip_media = false;
$chk_media = 0;
$chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','4');
$chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','19');
$chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','20');
$chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','22');
$chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','24');
$chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','25');
if ($chk_media != $_SESSION['cart']->count_contents()) {
$skip_media = true;
}
//echo '<br>IN USPS I SEE ' . $chk_media . ' count: ' . $_SESSION['cart']->count_contents() . ' Skip Media: ' . ($skip_media == true ? 'YES' : 'NO') . '<br>';
$methods = array();
$size = sizeof($uspsQuote);
for ($i=0; $i<$size; $i++) {
list($type, $cost) = each($uspsQuote[$i]);
// BOF: UPS USPS
$title = ((isset($this->types[$type])) ? $this->types[$type] : $type);
if(in_array('Display transit time', explode(', ', MODULE_SHIPPING_USPS_OPTIONS))) $title .= $transittime[$type];
/*
$methods[] = array('id' => $type,
'title' => ((isset($this->types[$type])) ? $this->types[$type] : $type),
'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
*/
if ($type == 'MEDIA' && $skip_media) {
// skip Media Mail
} else {
$cost = preg_replace('/[^0-9.]/', '', $cost);
$methods[] = array('id' => $type,
'title' => $title,
'cost' => ($cost * $shipping_num_boxes) + (MODULE_SHIPPING_USPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_USPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_USPS_HANDLING) );
}
}
// bof: Media Check

    $methods = array();
    $size = sizeof($uspsQuote);
    for ($i=0; $i<$size; $i++) {
      list($type, $cost) = each($uspsQuote[$i]);
      // BOF: UPS USPS
      $title = ((isset($this->types[$type])) ? $this->types[$type] : $type);
      if(in_array('Display transit time', explode(', ', MODULE_SHIPPING_USPS_OPTIONS)))    $title .= $transittime[$type];
4 Feb 2010, 12:22 AM
#30
ajeh avatar

ajeh

Oba-san

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

Re: Media Mail Option

Okay ... here is the whole function quote ...

  /**
   * Get quote from shipping provider's API:
   *
   * @param string $method
   * @return array of quotation results
   */
  function quote($method = '') {
    // BOF: UPS USPS
    global $order, $shipping_weight, $shipping_num_boxes, $transittime;

    if ( zen_not_null($method) && (isset($this->types[$method]) || in_array($method, $this->intl_types)) ) {
      $this->_setService($method);
    }


    // usps doesnt accept zero weight send 1 ounce (0.0625) minimum
    $usps_shipping_weight = ($shipping_weight <= 0.0 ? 0.0625 : $shipping_weight);
    $shipping_pounds = floor ($usps_shipping_weight);
    $shipping_ounces = (16 * ($usps_shipping_weight - floor($usps_shipping_weight)));
    // usps currently cannot handle more than 5 digits on international
    $shipping_ounces = zen_round($shipping_ounces, 3);
    // weight must be less than 35lbs and greater than 6 ounces or it is not machinable
    switch(true) {
      case ($shipping_pounds == 0 and $shipping_ounces < 6):
      // override admin choice too light
      $is_machinable = 'False';
      break;

      case ($usps_shipping_weight > 35):
      // override admin choice too heavy
      $is_machinable = 'False';
      break;

      default:
      // admin choice on what to use
      $is_machinable = MODULE_SHIPPING_USPS_MACHINABLE;
    }

    $this->_setMachinable($is_machinable);
    $this->_setContainer('None');
    $this->_setSize('REGULAR');
    $this->_setFirstClassType('FLAT');

    $this->_setWeight($shipping_pounds, $shipping_ounces);
    $uspsQuote = $this->_getQuote();

    if (is_array($uspsQuote)) {
      if (isset($uspsQuote['error'])) {
        $this->quotes = array('module' => $this->title,
                              'error' => $uspsQuote['error']);
      } else {

        // BOF: UPS USPS
        if (in_array('Display weight', explode(', ', MODULE_SHIPPING_USPS_OPTIONS))) {
          switch (SHIPPING_BOX_WEIGHT_DISPLAY) {
            case (0):
            $show_box_weight = '';
            break;
            case (1):
            $show_box_weight = ' (' . $shipping_num_boxes . ' ' . TEXT_SHIPPING_BOXES . ')';
            break;
            case (2):
            $show_box_weight = ' (' . number_format($usps_shipping_weight * $shipping_num_boxes,2) . TEXT_SHIPPING_WEIGHT . ')';
            break;
            default:
            $show_box_weight = ' (' . $shipping_num_boxes . ' x ' . number_format($usps_shipping_weight,2) . TEXT_SHIPPING_WEIGHT . ')';
            break;
          }
        }
        // EOF: UPS USPS

        // BOF: UPS USPS
        $this->quotes = array('id' => $this->code,
        'module' => $this->title . $show_box_weight);
        // EOF: UPS USPS

// bof: Media Check
// test contents for Media Mail
        $skip_media = false;
        $chk_media = 0;
        $chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','4');
        $chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','19');
        $chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','20');
        $chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','22');
        $chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','24');
        $chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','25');
        if ($chk_media != $_SESSION['cart']->count_contents()) {
          $skip_media = true;
        }
//echo '<br>IN USPS I SEE ' . $chk_media . ' count: ' . $_SESSION['cart']->count_contents() . ' Skip Media: ' . ($skip_media == true ? 'YES' : 'NO') . '<br>';
        $methods = array();
        $size = sizeof($uspsQuote);
        for ($i=0; $i<$size; $i++) {
          list($type, $cost) = each($uspsQuote[$i]);

          // BOF: UPS USPS
          $title = ((isset($this->types[$type])) ? $this->types[$type] : $type);
          if(in_array('Display transit time', explode(', ', MODULE_SHIPPING_USPS_OPTIONS)))    $title .= $transittime[$type];
          /*
          $methods[] = array('id' => $type,
          'title' => ((isset($this->types[$type])) ? $this->types[$type] : $type),
          'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
          */

          if ($type == 'MEDIA' && $skip_media) {
// skip Media Mail
          } else {
            $cost = preg_replace('/[^0-9.]/', '',  $cost);
            $methods[] = array('id' => $type,
                               'title' => $title,
                               'cost' => ($cost * $shipping_num_boxes) + (MODULE_SHIPPING_USPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_USPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_USPS_HANDLING) );
          }
        }
// bof: Media Check

        $this->quotes['methods'] = $methods;

        if ($this->tax_class > 0) {
          $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
        }
      }
    } elseif ($uspsQuote == -1) {
      $this->quotes = array('module' => $this->title,
                            'error' => MODULE_SHIPPING_USPS_TEXT_SERVER_ERROR . (MODULE_SHIPPING_USPS_SERVER=='test' ? MODULE_SHIPPING_USPS_TEXT_TEST_MODE_NOTICE : ''));
    } else {
      $this->quotes = array('module' => $this->title,
                            'error' => MODULE_SHIPPING_USPS_TEXT_ERROR . (MODULE_SHIPPING_USPS_SERVER=='test' ? MODULE_SHIPPING_USPS_TEXT_TEST_MODE_NOTICE : ''));
    }

    if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title);

    return $this->quotes;
  }
  /**
   * check status of module
   *
   * @return boolean
   */

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

5 Feb 2010, 7:25 PM
#31
debtag avatar

debtag

Zen Follower

Join Date:
Sep 2006
Location:
Oregon
Posts:
207
Plugin Contributions:
0

Re: Media Mail Option

Now I have NO shipping estimator....could I PLEASE send you my WHOLE php file via PM? I am really trying to put the code EXACTLY where it is supposed to go and I really believe that I am...but obviously, something is wrong! :frusty:

6 Feb 2010, 5:56 AM
#32
ajeh avatar

ajeh

Oba-san

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

Re: Media Mail Option

Try this file and see if it works when copied to the:
/includes/modules/shipping

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

6 Feb 2010, 8:03 PM
#33
debtag avatar

debtag

Zen Follower

Join Date:
Sep 2006
Location:
Oregon
Posts:
207
Plugin Contributions:
0

Re: Media Mail Option

HALLELUJAH!!!!!! It works now! So do you think I just wasn't pasting the code exactly where it should have gone? I tried so hard to get it right! :blush: Thank you for sticking it out with me and I'm sorry if I was frustrating....I certainly didn't mean to be! This is all so above and beyond my abilities!

You're my hero! :hug:

Thanks again!

6 Feb 2010, 10:27 PM
#34
ajeh avatar

ajeh

Oba-san

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

Re: Media Mail Option

From the code I did see you post you kept leaving out the IF around the final cost build:

          if ($type == 'MEDIA' && $skip_media) {
// skip Media Mail
          } else {
            $cost = preg_replace('/[^0-9.]/', '',  $cost);
            $methods[] = array('id' => $type,
                               'title' => $title,
                               'cost' => ($cost * $shipping_num_boxes) + (MODULE_SHIPPING_USPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_USPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_USPS_HANDLING) );
          }

That was to skip the media when it was suppose to be skipped and add the methods when it wasn't ... :cool:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

7 Feb 2010, 3:05 AM
#35
debtag avatar

debtag

Zen Follower

Join Date:
Sep 2006
Location:
Oregon
Posts:
207
Plugin Contributions:
0

Re: Media Mail Option

Well, thank you again! I am very grateful for your help! :yes:

7 Feb 2010, 5:58 AM
#36
ajeh avatar

ajeh

Oba-san

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

Re: Media Mail Option

Not a problem ... good luck with your shop! :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

29 Mar 2010, 1:32 AM
#37
craft_magick avatar

craft_magick

Zen Follower

Join Date:
Nov 2007
Posts:
166
Plugin Contributions:
0

Re: Media Mail Option

Ajeh:

Try this file and see if it works when copied to the:
/includes/modules/shipping

I used the zip file from the post above and it works in the cart for checkout purposes, however the shipping estimator now displays only blank boxes where the rates are supposed to be.

Running v1.3.8 and here's a copy of the modified section of my usps.php file

        // BOF: UPS USPS
        $this->quotes = array('id' => $this->code,
        'module' => $this->title . $show_box_weight);
        // EOF: UPS USPS

// bof: Media Check
// test contents for Media Mail
        $skip_media = false;
        $chk_media = 0;
        $chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','107');
        $chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','110');
        $chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','130');
        $chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','301');
        $chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','116');
        $chk_media += $_SESSION['cart']->in_cart_check('master_categories_id','103');
        if ($chk_media != $_SESSION['cart']->count_contents()) {
          $skip_media = true;
        }
//echo '<br>IN USPS I SEE ' . $chk_media . ' count: ' . $_SESSION['cart']->count_contents() . ' Skip Media: ' . ($skip_media == true ? 'YES' : 'NO') . '<br>';
        $methods = array();
        $size = sizeof($uspsQuote);
        for ($i=0; $i<$size; $i++) {
          list($type, $cost) = each($uspsQuote[$i]);

          // BOF: UPS USPS
          $title = ((isset($this->types[$type])) ? $this->types[$type] : $type);
          if(in_array('Display transit time', explode(', ', MODULE_SHIPPING_USPS_OPTIONS)))    $title .= $transittime[$type];
          /*
          $methods[] = array('id' => $type,
          'title' => ((isset($this->types[$type])) ? $this->types[$type] : $type),
          'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);
          */
		  
		  if ($type == 'MEDIA' && $skip_media) {
// skip Media Mail
          } else {
            $cost = preg_replace('/[^0-9.]/', '',  $cost);
            $methods[] = array('id' => $type,
                               'title' => $title,
                               'cost' => ($cost * $shipping_num_boxes) + (MODULE_SHIPPING_USPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_USPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_USPS_HANDLING) );
          }
        }
// bof: Media Check

        $this->quotes['methods'] = $methods;

        if ($this->tax_class > 0) {
          $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
        }

Any suggestions are welcomed and appreciated.

Zencart ROCKS!

www.ZenCrystals.com
www.CraftMagick.com
Magickal & Metaphysical supplies/services

29 Mar 2010, 2:00 AM
#38
ajeh avatar

ajeh

Oba-san

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

Re: Media Mail Option

Have you an URL to where you are using this ... I am not able to reproduce an issue such as what you are describing and it might help if we could peek at the problem ... :smile:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

29 Mar 2010, 2:40 AM
#40
ajeh avatar

ajeh

Oba-san

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

Re: Media Mail Option

Give me a hint ... who is a media mail product you are using SEO junk and I get lost ... :blink:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!