Comments (4)
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.
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.
It seems github is messing the formatting of the code. Here is a screenshot of the code instead:
from sdk.
The new version is live, the change has been included in the version 2.1.4
from sdk.
Related Issues (20)
- Postbus setconsignment HOT 4
- Position not working correctly HOT 2
- MyParcel is gekoppeld door middel van API koppeling, maar er worden geen labels gemaakt HOT 1
- Download link PDF gaat fout HOT 1
- SDK can't split Street + Housenumber + Suffix HOT 1
- BadMethodCallException not handeling in catch block
- Feature: mogelijkheid om een label_description op te geven voor secondary_shipments
- Labels printen voor DPD zending lukt niet (via Woocommerce plugin) HOT 3
- Add functions to set the webhook url. HOT 1
- Invalid `MyParcelCollection::setUserAgent()` deprecation replacement
- Invalid return type `AbstractConsignment::setPhone()` HOT 1
- As a client I want this address to be split correctly HOT 1
- Fatal error on creating consignment for pickup point HOT 5
- Availability PostNL field 'Extra veld straat' in API HOT 2
- Feature: Use better models
- Mogelijkheid om te kiezen voor portrait/landscape a4
- Pickup point consignments don't always have countries HOT 1
- Implement unrelated returns
- Registration of Croatian Consignment fails HOT 1
- Parameter type of LabelFormat positions is wrong in DocBlock HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdk.