Results 1 to 5 of 5
  1. #1

    Default USPS Media Mail problem.

    I've been adding in the USPS change to allow the USPS shipping module to exclude the Media Mail option for shipping but with a change so that it is controlled by a flag in the products table of the database. The default value for 'product_is_media_mail' is '0' .

    I've run into a problem with the collect_info.php changes. Instead of the radio button for NO being set the Yes radio Button is set.

    I made changes based of of the code for "Product is Free:" on the product page (lines 319 to 323) and here is the code I used for Product is Media Mail is
    Code:
              <tr>
                <td colspan="2"><?php echo zen_draw_separator('pixel_trans.gif', '1', '10'); ?></td>
              </tr>
    
              <tr>
                <td class="main"><?php echo TEXT_PRODUCT_IS_MEDIA_MAIL; ?></td>
                <td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . zen_draw_radio_field('product_is_media_mail', '1', ($product_is_media_mail==1)) . '&nbsp;' . TEXT_YES . '&nbsp;&nbsp;' . zen_draw_radio_field('product_is_media_mail', '0', ($product_is_media_mail==0)) . '&nbsp;' . TEXT_NO . ' ' . ($pInfo->product_is_media_mail == 1 ? '<span class="errorText">' . TEXT_PRODUCTS_IS_MEDIA_MAIL_EDIT . '</span>' : ''); ?></td>
              </tr>
    Beau

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: USPS Media Mail problem.

    There are a number of files to touch ...

    For collect_info.php I used:
    Code:
                           'master_categories_id' => '',
                     'product_is_media_mail' => '0'
                           );
    Code:
                                          p.products_price_sorter, p.master_categories_id,
                            p.product_is_media_mail
                                  from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
    Code:
    // Product is Media Mail
        if (!isset($pInfo->product_is_media_mail)) $pInfo->product_is_media_mail = '0';
        switch ($pInfo->product_is_media_mail) {
          case '0': $in_product_is_media_mail = false; $out_product_is_media_mail = true; break;
          case '1': $in_product_is_media_mail = true; $out_product_is_media_mail = false; break;
          default: $in_product_is_media_mail = false; $out_product_is_media_mail = true;
        }
    Code:
              <tr>
                <td class="main"><?php echo TEXT_PRODUCT_IS_MEDIA_MAIL; ?></td>
                <td class="main"><?php echo zen_draw_separator('pixel_trans.gif', '24', '15') . '&nbsp;' . zen_draw_radio_field('product_is_media_mail', '1', ($in_product_is_media_mail==1)) . '&nbsp;' . TEXT_YES . '&nbsp;&nbsp;' . zen_draw_radio_field('product_is_media_mail', '0', ($in_product_is_media_mail==0)) . '&nbsp;' . TEXT_NO . ' ' . ($pInfo->product_is_media_mail == 1 ? '<span class="errorText">' . TEXT_PRODUCT_IS_MEDIA_MAIL_EDIT . '</span>' : ''); ?></td>
              </tr>
    in preview_info.php I used:
    Code:
                        p.products_sort_order,
                        p.product_is_media_mail
                                   from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
    Code:
                <td class="pageHeading" align="right"><?php echo $currencies->format($pInfo->products_price) . ($pInfo->products_virtual == 1 ? '<span class="errorText">' . '<br />' . TEXT_VIRTUAL_PREVIEW . '</span>' : '') . ($pInfo->product_is_always_free_shipping == 1 ? '<span class="errorText">' . '<br />' . TEXT_FREE_SHIPPING_PREVIEW . '</span>' : '') . ($pInfo->products_priced_by_attribute == 1 ? '<span class="errorText">' . '<br />' . TEXT_PRODUCTS_PRICED_BY_ATTRIBUTES_PREVIEW . '</span>' : '') . ($pInfo->product_is_free == 1 ? '<span class="errorText">' . '<br />' . TEXT_PRODUCTS_IS_FREE_PREVIEW . '</span>' : '') . ($pInfo->product_is_media_mail == 1 ? '<span class="errorText">' . '<br />' . TEXT_PRODUCT_IS_MEDIA_MAIL_PREVIEW . '</span>' : '') . ($pInfo->product_is_call == 1 ? '<span class="errorText">' . '<br />' . TEXT_PRODUCTS_IS_CALL_PREVIEW . '</span>' : '') . ($pInfo->products_qty_box_status == 0 ? '<span class="errorText">' . '<br />' . TEXT_PRODUCTS_QTY_BOX_STATUS_PREVIEW . '</span>' : '') . ($pInfo->products_priced_by_attribute == 1 ? '<br />' . zen_get_products_display_price($_GET['pID']) : ''); ?></td>
    In copy_to_confirm.php I used:
    Code:
                                                products_price_sorter, master_categories_id,
                                   product_is_media_mail
                                         from " . TABLE_PRODUCTS . "
    Code:
                                           products_price_sorter, master_categories_id,
                                     product_is_media_mail
                                           )
                              values ('" . zen_db_input($product->fields['products_type']) . "',
    Code:
                                      '" . zen_db_input($categories_id) . "',
                                '" . zen_db_input($product_is_media_mail) .
                                      "')");
    In update_product.php I used:
    Code:
                                'products_price_sorter' => zen_db_prepare_input($_POST['products_price_sorter']),
                          'product_is_media_mail' => zen_db_prepare_input($_POST['product_is_media_mail'])
                                );
    In /my_secerate_admin/includes/languages/english/extra_definitions/extra_product_is_media_mail.php I used:
    Code:
    <?php
    // extra_product_is_media_mail.php
    // ALTER TABLE products CHANGE product_is_media_mail product_is_media_mail TINYINT(1) NOT NULL DEFAULT '0';
      define('TEXT_PRODUCT_IS_MEDIA_MAIL','Product is MEDIA MAIL:');
      define('TEXT_PRODUCT_IS_MEDIA_MAIL_PREVIEW','*Product is marked as MEDIA MAIL');
      define('TEXT_PRODUCT_IS_MEDIA_MAIL_EDIT','*Product is marked as MEDIA MAIL');
    Then to add the field I used:
    Code:
    ALTER TABLE products CHANGE product_is_media_mail product_is_media_mail TINYINT(1) NOT NULL DEFAULT '0';
    Perhaps that will help you track down the issue?
    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. #3

    Default Re: USPS Media Mail problem.

    Still got a couple of problems.
    1) I get "TEXT_PRODUCT_IS_MEDIA_MAIL_EDIT" on the product edit page in the office and "TEXT_PRODUCT_IS_MEDIA_MAIL_PREVIEW" on the product preview page. Here is my extra_product_is_media_mail.php file
    Code:
    <?php
    // extra_product_is_media_mail.php
    // ALTER TABLE products CHANGE product_is_media_mail product_is_media_mail TINYINT(1) NOT NULL DEFAULT '0';
      define('TEXT_PRODUCT_IS_MEDIA_MAIL','Product is MEDIA MAIL:');
      define('TEXT_PRODUCT_IS_MEDIA_MAIL_PREVIEW','*Product is marked as MEDIA MAIL');
      define('TEXT_PRODUCT_IS_MEDIA_MAIL_EDIT','*Product is marked as MEDIA MAIL');
    
      ?>
    2) The Media Mail 'product_is_media_mail' in the database is not being updated. I do have the product_book module with a update_product.php file that I made the same changes as you showed for the default update_product.php are there other update files I need to change?
    Beau

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: USPS Media Mail problem.

    I am just using changes to:
    /your_secret_admin/includes/modules/product/collect_info.php
    /your_secret_admin/includes/modules/product/preview_info.php
    /your_secret_admin/includes/modules/copy_to_confirm.php
    /your_secret_admin/includes/modules/update_product.php

    and made the file:
    /your_secret_admin/includes/languages/english/extra_definitions/extra_product_is_media_mail.php

    Do a search in the Tools ... Developers Tool Kit ... in the bottom input box for:
    TEXT_PRODUCT_IS_MEDIA_MAIL_EDIT
    TEXT_PRODUCT_IS_MEDIA_MAIL_PREVIEW

    Then, as a check, do a search on:
    TEXT_PRODUCTS_IS_MEDIA_MAIL_EDIT
    TEXT_PRODUCTS_IS_MEDIA_MAIL_PREVIEW

    as that was an easy error in cloning all the product_is_free stuff ...

    Do a search on:
    IS_MEDIA_MAIL

    What all comes up on that search? NOTE: do not show your secret Admin directory name ...

    Do you have any debug logs being generated in the /logs directory? (this would be /cache in older versions)

    Are you only using the 1 Product type for Product General?
    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. #5
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: USPS Media Mail problem.

    I did find that I have a typo in copy_to_confirm.php

    The code should be:
    Code:
                                      '" . zen_db_input($categories_id) . "',
                                '" . zen_db_input((int)$product->fields['product_is_media_mail']) .
                                      "')");
    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!

 

 

Similar Threads

  1. v151 Media Mail restriction mod to new, 3-7-14 usps module, any help?
    By linniedarling in forum Addon Shipping Modules
    Replies: 61
    Last Post: 13 Aug 2023, 01:25 AM
  2. v139h USPS allow media mail based on cart contents?
    By geckomafia in forum Addon Shipping Modules
    Replies: 34
    Last Post: 9 Nov 2013, 02:44 AM
  3. USPS-Offering Media mail on all items
    By flyred77 in forum Built-in Shipping and Payment Modules
    Replies: 7
    Last Post: 2 Dec 2009, 12:04 AM
  4. Product Customization USPS Media Mail
    By rfloyd in forum Built-in Shipping and Payment Modules
    Replies: 6
    Last Post: 30 May 2008, 09:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg