Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    605
    Plugin Contributions
    0

    Default Flat Rate Shipping for just one product

    V 157.d

    We have always charged shipping by weight, but we have just taken on a product that needs to have a flat rate for shipping. I'm sure that has been asked here before, but I'm not seeing any earlier questions, and I don't see how to set it up. Our only other option would be to add the shipping cost to the basic price and give it free shipping, and I'd rather not do that if I don't have to. I'm competing with several other companies who are charging flat rate shipping, and many people are going to only look as far as seeing that my basic price appears to be higher, and not realize it includes shipping. Help?

  2. #2
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    605
    Plugin Contributions
    0

    Default Re: Flat Rate Shipping for just one product

    Can anyone even help with the flat.php code? It seems fairly straightforward, but I'm not sure where to change it to exclude everything except certain product numbers. I don't mind if the other shipping methods show up for a flat rate item, as long as the flat rate doesn't show up for anything else.

  3. #3
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,843
    Plugin Contributions
    11

    Default Re: Flat Rate Shipping for just one product

    Quote Originally Posted by HeleneWallis View Post
    Can anyone even help with the flat.php code? It seems fairly straightforward, but I'm not sure where to change it to exclude everything except certain product numbers. I don't mind if the other shipping methods show up for a flat rate item, as long as the flat rate doesn't show up for anything else.
    nothing with coding is straight forward.

    start with your requirements. you only want to offer flat rate shipping for this one item. what happens if there are 2 of them in the cart? do they get twice the flat rate? or just the single rate? if they get just the single rate, at what point does it go up? when they order 100?

    now what happens if they have that item in their cart and other items that get charged by weight? how do you want to handle that?

    ideally you want to code this using an observer. but in v157, the flat rate observer was not there. it does exist in v210.

    so now do you want to just copy that single flat rate file over to your v157 install so that you can use the observer?

    very few things are simple in coding when you take a close look at it.
    author of square Webpay.
    mxWorks now has Apple Pay and Google Pay. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  4. #4
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    605
    Plugin Contributions
    0

    Default Re: Flat Rate Shipping for just one product

    I’ve already considered both the possibilities that you mentioned. Fortunately, neither of them is likely to occur more than very occasionally. We’ll eat the shipping cost if it happens in the customer’s favor and refund the extra if it happens in our favor (which is what we already do anyway).

    I wrote software for dozens of different systems and languages for over 50 years. I know it can be complex. I have Lyme disease and my brain is slowly falling apart, or I wouldn’t have to ask for help. I will look at the observer file for v2.01 but I may still not be able to figure it out. Thank you for the suggestion.

  5. #5
    Join Date
    Nov 2005
    Location
    los angeles
    Posts
    2,843
    Plugin Contributions
    11

    Default Re: Flat Rate Shipping for just one product

    copy this file:

    https://github.com/zencart/zencart/b...pping/flat.php

    to where it is supposed to go, replacing the existing file.

    enable flat rate shipping and put the price that you want to offer.

    create this file:

    includes/classes/observers/auto.carlwhat_observer.php

    and put this in there (replace 8754 with the product_id of the item you want to offer flat rate shipping):

    PHP Code:
    <?php
        
    /*  portions copyright by... zen-cart.com
            developed and brought to you by proseLA
            https://mxworks.cc
        */

        
    if (!defined('IS_ADMIN_FLAG')) {
            die(
    'Illegal Access');
        }
        class 
    zcObserverCarlwhatObserver extends base
        
    {
            public function 
    __construct()
            {
                
    $this->attach($this, [
                    
    'NOTIFY_SHIPPING_FLAT_UPDATE_STATUS',
                ]);
            }

            public function 
    updateNotifyShippingFlatUpdateStatus(&$class$eventID, &$p1, &$p2)
            {
                if (!
    $_SESSION['cart']->in_cart('8754')) {
                    
    $p2 false;
                }
            }
        }
    if that does not work, someone else can help you with troubleshooting.

    good luck.
    author of square Webpay.
    mxWorks now has Apple Pay and Google Pay. donations: venmo or paypal accepted.
    premium consistent excellent support. available for hire.

  6. #6
    Join Date
    Jun 2016
    Location
    Suffolk VA
    Posts
    605
    Plugin Contributions
    0

    Default Re: Flat Rate Shipping for just one product

    Quote Originally Posted by carlwhat View Post
    copy this file:

    https://github.com/zencart/zencart/b...pping/flat.php

    to where it is supposed to go, replacing the existing file.

    enable flat rate shipping and put the price that you want to offer.

    create this file:

    includes/classes/observers/auto.carlwhat_observer.php

    and put this in there (replace 8754 with the product_id of the item you want to offer flat rate shipping):

    PHP Code:
    <?php
        
    /*  portions copyright by... zen-cart.com
            developed and brought to you by proseLA
            https://mxworks.cc
        */

        
    if (!defined('IS_ADMIN_FLAG')) {
            die(
    'Illegal Access');
        }
        class 
    zcObserverCarlwhatObserver extends base
        
    {
            public function 
    __construct()
            {
                
    $this->attach($this, [
                    
    'NOTIFY_SHIPPING_FLAT_UPDATE_STATUS',
                ]);
            }

            public function 
    updateNotifyShippingFlatUpdateStatus(&$class$eventID, &$p1, &$p2)
            {
                if (!
    $_SESSION['cart']->in_cart('8754')) {
                    
    $p2 false;
                }
            }
        }
    if that does not work, someone else can help you with troubleshooting.

    good luck.
    Wow, I was not looking for that level of help, just something to get me started. That is very much appreciated, and I will spend some time studying what it does. I can still figure out most things if I have something to work from.

 

 

Similar Threads

  1. More than one Flat Rate for Shipping
    By brightideas in forum Built-in Shipping and Payment Modules
    Replies: 6
    Last Post: 8 Mar 2010, 01:18 AM
  2. Flat rate just for a set cities and UPS or USPS shipping rates for States
    By pkalout in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 9 Oct 2009, 04:20 PM
  3. Flat rate shipping override - on one product only
    By Nappy Nature in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 27 Mar 2008, 11:43 PM
  4. One product only be set to Flat Rate shipping?
    By LilleyPadGifts in forum Built-in Shipping and Payment Modules
    Replies: 3
    Last Post: 3 Jan 2008, 06:32 AM
  5. Flat rate shipping-one rate euro, one rate international
    By schwimwastaken in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 11 Oct 2006, 04:59 AM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR