OroCommerce Forums

Covering OroCommerce topics, including community updates and company announcements.

Forums OroCommerce Shipping Freight Class

This topic contains 1 reply, has 1 voice, and was last updated by  marius.negoescu 3 weeks, 2 days ago.

  • Creator
    Topic
  • #40100

    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

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #40102

    marius.negoescu
    Participant

    If you ever do

    composer dump-autoload,

    make sure you do composer install in dev mode to load the classes properly.

Viewing 1 replies (of 1 total)

You must be logged in to reply to this topic.

You will be redirected to [title]. Would you like to continue?

Yes No