Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4535060
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:21:29+00:00 2026-05-21T14:21:29+00:00

I’m working on a Magento storefront for a client. They use dropshippers, so a

  • 0

I’m working on a Magento storefront for a client. They use dropshippers, so a single zip code doesn’t do us much help. We do have it set for the most common zip code from which the client ships, so, in many cases, it’s ok.

However, in some cases, there is a different origin zip code that needs to be used. In more rare cases, we will have multiple origin zip codes. When there is a zip that differs from the main one, we have stored this in an attribute called ‘origin zip’ (creative, huh?)

Where should I be looking to make the modifications? We’re only using the UPS shipping method, and what I’m looking to do is, before calculating shipping, to grab whatever origin zips may be in the cart (I think we’ve got this part), but then, depending on the results, I may need to iterate through the shipping calculation and add the values together – i.e. in the case they order one product with an origin zip code, and another product without an origin zip code, it would have to calculate the first, then the second, and then add them together.

If someone could point us in the correct direction of which php files or classes we’ll need to modify, I would greatly appreciate it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T14:21:30+00:00Added an answer on May 21, 2026 at 2:21 pm

    First of all you need to add your custom attributed to list of attributes that will be used in shopping cart.
    Follow these answer on stackoverflow:
    How to add custom uploaded images to cart in magento 1.4.1.1?

    Then you need to create your custom shipping method, maybe extended from yours one. It should walk through items it receives from shipping request and check for different zip origin, then calculate rate for them separately.

    I hope for you it will not be a problem to create a module that will extend existing shipping method functionality.

    Cheers!

    UPDATE
    For adding your attribute to product that is loaded in the cart item use such configuration:

    <config>
         <global>
              <sales>
                   <quote>
                        <item>
                            <product_attributes>
                                 <origin_zip />
                            </product_attributes>
                        </item>
                   </quote>
              </sales>
         </global>
    </config>
    

    Then in shipping method model use something like this (used USPS as example):

    public function collectRates(Mage_Shipping_Model_Rate_Request $request)
    {
        if (!$this->getConfigFlag('active')) {
            return false;
        }
    
        $defaultOriginZip = Mage::getStoreConfig('shipping/origin/postcode', $this->getStore());
    
        $requestDataByOriginZip = array();
        // Walking through quote items
        foreach ($request->getAllItems() as $quoteItem) {
            // If virtual or not shippable separately, it should be skipped
            if ($quoteItem->isVirtual() || $quoteItem->isDummy(true)) {
                continue;
            }
            // Retrieving origin zip code
            if ($quoteItem->getProduct()->getOriginZip()) {
                $zipCodeForCalculation = $quoteItem->getProduct()->getOriginZip();
            } else {
                $zipCodeForCalculation = $defaultOriginZip;
            }
    
            if (!isset($requestDataByOriginZip[$zipCodeForCalculation])) {
                // Default values initialization for this zip code
                $requestDataByOriginZip[$zipCodeForCalculation] = array(
                    'orig_postcode' => $zipCodeForCalculation,
                    'package_weight' => 0,
                    'package_value' => 0,
                    // etc...
                );
            }
    
            $requestDataByOriginZip[$zipCodeForCalculation]['package_weight'] += $quoteItem->getRowWeight();
            $requestDataByOriginZip[$zipCodeForCalculation]['package_value'] += $quoteItem->getBaseRowTotal();
            // Etc...
        }
    
        $results = array();
        foreach ($requestDataByOriginZip as $requestData) {
           $requestByZip = clone $request; // Cloning to prevent changing logic in other shipment methods.
           $requestByZip->addData($requestData);
           $this->setRequest($requestByZip);
           // Returns rate result for current request
           $results[] = $this->_getQuotes();
        }
    
        $yourMergedResult = Mage::getModel('shipping/rate_result');
    
        foreach ($results as $result) {
           // Logic for merging the rate prices....
        }
    
        return $yourMergedResult;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want use html5's new tag to play a wav file (currently only supported
this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am trying to loop through a bunch of documents I have to put
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have a bunch of posts stored in text files formatted in yaml/textile (from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.