(858) 586 7777 | About | Testimonials | Contact
vteams vteams vteams vteams
  • How does it work?
    • Startup Process
    • Your First Day
  • Technologies
    • Hire PHP Developer
    • Hire App Developer
    • Hire JavaScript Developer
    • Hire ROR Developer
    • Hire IOS Developer
    • Hire .NET Developer
    • Hire AI Developer
    • Hire Robotics Engineer
  • Sample Budgets
  • Meet The Team
  • Experiments
  • Captain’s Log
  • Blog
vteams vteams
  • How does it work?
    • Startup Process
    • Your First Day
  • Technologies
    • Hire PHP Developer
    • Hire App Developer
    • Hire JavaScript Developer
    • Hire ROR Developer
    • Hire IOS Developer
    • Hire .NET Developer
    • Hire AI Developer
    • Hire Robotics Engineer
  • Sample Budgets
  • Meet The Team
  • Experiments
  • Captain’s Log
  • Blog
Blog
  1. vteams
  2. Blog
  3. Calculation of shipping charges using two third party APIs and used them in Magento’s checkout process.
May 14

Calculation of shipping charges using two third party APIs and used them in Magento’s checkout process.

  • May 14, 2014

Tahir-Yasin---Magento-Checkout-ProcessClient sent the requirements to integrate two third party APIs (UPS & World Wide Express) for calculations of shipping charges in Magento’s one page checkout process. Several product attributes were to be taken care of while calculating the shipping charges.

Technical Challenges:

vteams developer Tahir had to calculate shipping charges based on combined dimensions of all the products added to the shopping cart. Magento’s built in shipping methods were not useful at all for these requirements. Tahir searched for suitable plugins but the available plugin were not meeting the requirements either.

Solution:

Tahir created a custom solution by overriding the flat rate method, injected the calculated rate there, and added a rewrite rule in module’s configuration file. Following are the details about the solution:

  1. Created a custom model Flatrate.php in:
    app/code/local/Namespace/ModuleName/model/

    PHP
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    class Namespace_ModuleName_Model_Flatrate extends
    Mage_Shipping_Model_Carrier_Abstract implements
    Mage_Shipping_Model_Carrier_Interface
    {
    protected $_code = 'flatrate';
    public function collectRates(Mage_Shipping_Model_Rate_Request $request)
    {
    if (!$this->getConfigFlag('active'))
    {
    return false;
    }
    // API call and rest of the logic
    }
    }
  2. Added a rewrite rule to override core model in module’s config.xml file:
    app/code/local/Namespace/ModuleName/etc/
    PHP
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    <global>
         <models>
            <shipping>
              <rewrite>
                <carrier_flatrate>
                   Namespace_ModuleName_Model_Flatrate
                </carrier_flatrate>
              </rewrite>
            </shipping>
         </models>
    </global>

Conclusion:

With the help of above mentioned solution, the shipping rates were calculated via third party APIs and seamlessly injected in Magento’s one page checkout process.

  • Facebook
  • Twitter
  • Tumblr
  • Pinterest
  • Google+
  • LinkedIn
  • E-Mail

Comments are closed.

SEARCH BLOG

Categories

  • Blog (490)
  • Captain's Log (1)
  • Closure Reports (45)
  • Experiments (7)
  • How-To (56)
  • Implementation Notes (148)
  • Learn More (156)
  • LMS (8)
  • Look Inside (10)
  • Operations Log (12)
  • Programmer Notes (20)
  • R&D (14)
  • Rescue Log (4)
  • Testimonials (25)
  • Uncategorized (4)

RECENT STORIES

  • GitHub Actions- Automate your software workflows with excellence
  • Yii Framework – Accomplish Repetitive & Iterative Projects with Ease
  • A Recipe for CRM Software Development
  • Are Agile and DevOps the same?
  • The Data Scientist’s Toolset

ARCHIVES

In Short

With the vteams model, you bypass the middleman and hire your own offshore engineers - they work exclusively for you. You pay a reasonable monthly wage and get the job done without hassles, re-negotiations, feature counts or budget overruns.

Goals for 2020

  • Open development center in Australia
  • Complete and Launch the Robot
  • Structural changes to better address Clients' needs

Contact Us

Address: NEXTWERK INC.
6790 Embarcadero Ln, Ste 100,
Carlsbad, CA 92011, USA

Tel: (858) 586 7777
Email: fahad@nextwerk.com
Web: www.vteams.com

© 2020 vteams. All Rights Reserved.

Content Protection by DMCA.com