Forums

Covering OroCommerce, OroCRM, OroPlatform topics, including community updates and company announcements.

Forums Forums Oro Community Shipping Freight Class

This topic contains 0 replies, has 1 voice, and was last updated by  marius.negoescu 4 years, 8 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #40075

    marius.negoescu
    Participant

    Hi, guys

    I have added an extra freight class: pallet.

    I had no problem in adding the data to the database, but I am struggling with creating the FreightClassesExtension class which implements the FreightClassesExtensionInterface.

    I have followed this guide:

    https://github.com/oroinc/orocommerce/blob/3.0/src/Oro/Bundle/ShippingBundle/Resources/doc/freight-classes-extension.md

    I have created the class in my bundle:

    namespace Oro\Bundle\ShippingDemoBundle\Extension\Shipping;

    use Oro\Bundle\ShippingBundle\Entity\FreightClassInterface;
    use Oro\Bundle\ShippingBundle\Entity\ProductShippingOptionsInterface;
    use Oro\Bundle\ShippingBundle\Extension\FreightClassesExtensionInterface;

    class FreightClassesExtension implements FreightClassesExtensionInterface
    {
    /**
    * {@inheritdoc}
    */
    public function isApplicable(FreightClassInterface $class, ProductShippingOptionsInterface $options)
    {
    if ($class->getCode() === ‘demo_class50’) {
    return $this->checkClass50($options);
    } elseif ($class->getCode() === ‘demo_class55’) {
    return $this->checkClass55($options);
    }

    return false;
    }

    //Other protected methods that implement logic to verify given options against given freight class
    }

    and added it to the services.yml like this:

    services:
    oro_shipping_demo.extension.shipping_freight_classes:
    class: ‘Oro\Bundle\ShippingDemoBundle\Extension\Shipping\FreightClassesExtension’
    tags:
    – { name: oro_shipping.extension.freight_classes }

    but when I go to a product it keeps saying:

    Attempted to load class “FreightClassesExtension” from namespace “Oro\Bundle\ShippingDemoBundle\Extension\Shipping”.
    Did you forget a “use” statement for another namespace?

    Any ideas ?

    Cheers, Marius

The forum ‘Oro Community’ is closed to new topics and replies.

Back to top