Giter Club home page Giter Club logo

Comments (4)

Mark-H avatar Mark-H commented on July 20, 2024 1

I think that can be done with setLinkOfLabels or setPdfOfLabels. Their first parameter is the label format/position (1-4 = position on a4, false = a6). Internally that calls the setLabelFormat method you're looking for.

While those methods also call createConcepts(), from reading the code it seems it should only do that for consigments where the myparcel_consignment_id is null, i.e. actual new ones.

I'm using it like this for new :

        $collection = (new MyParcelCollection())
            ->setUserAgent('modmore\Commerce', (string)$this->commerce->version)
            ->addConsignment($consignment)
            ->setLinkOfLabels(1);

In your case I think you should be able of using the SDK like this to fetch the right consigments and to generate the labels:

$collection = MyParcelCollection::findMany($shipment_ids, $this->plugin_options['api_key']);
$link = $collection->setLinkOfLabels($this->plugin_options['positions'])->getLinkOfLabels();
// or
$collection->setPdfOfLabels($this->plugin_options['positions'])->downloadPdfOfLabels();

(To not have github mess with the code formatting, wrap it in triple backticks before and after the code block, on their own line.)

from sdk.

RichardPerdaan avatar RichardPerdaan commented on July 20, 2024 1

I see no reason why we could not set the function setLabelFormat to public, so I also opened the following pull request: #154
When it is approved by my colleagues I will process it in a new version.

from sdk.

hikashop-nicolas avatar hikashop-nicolas commented on July 20, 2024

It seems github is messing the formatting of the code. Here is a screenshot of the code instead:
Web - hikashop_plugins_plg_hikashop_myparcel_myparcel php - Aptana Studio 3 2019-07-29 16 04 54

from sdk.

RichardPerdaan avatar RichardPerdaan commented on July 20, 2024

The new version is live, the change has been included in the version 2.1.4

from sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.