Hello,
I have been trying to generate a Complimentary attribute in Sales Orders module to ‘compute’ the Shipping Method…to no avail!
This is what I’ve tried so far:
(($reloadedobj = new Expedition($db)) && ($reloadedobj->fetchNoCompute($objectoffield->id) > 0 ? $reloadedobj->shipping_method: ‘not found’)
This produces nothing.
Can someone clue me in? What am I doing wrong?
As of right now, {object_shipping_method} tag does not produce anything in my Sales Order ODT template file.
v19.02
@PimDolie
So, as a workaround, I’m trying to make an extra field (Complimentary attribute) to compute or link to the Shipping Method specified and stored in the Shipment module.
(For some reason {object_shipping_method} works just fine with Shipment ODTs.)
Then all I need to do is add the new {…options…} tag to my Sales Order ODT.
I tried your suggestions with the following results:
Bad string syntax to evaluate (found chars that are not chars for simplestring): (($reloadedobj = new Expedition($db)) && ($reloadedobj->fetchNoCompute($objectoffield->id) > 0 ? $reloadedobj->shipping_method: ‘not found’))
and
Bad string syntax to evaluate (found chars that are not chars for simplestring): (($reloadedobj = new llx_c_shipment_mode($db)) && ($reloadedobj->fetchNoCompute($objectoffield->id) > 0 ? $reloadedobj->libelle: ‘-1’))
The problem is due to the text in the first post - quoted string ‘-1’ were tranformed with ‘-1’
can you try (($reloadedobj = new Expedition($db)) && ($reloadedobj->fetchNoCompute($objectoffield->id) > 0 ? $reloadedobj->shipping_method: 'not found'))
or (($reloadedobj = new llx_c_shipment_mode($db)) && ($reloadedobj->fetchNoCompute($objectoffield->id) > 0 ? $reloadedobj->libelle: '-1'))
The problem is due to the text in the first post - quoted string ‘-1’ were tranformed with ‘-1’
can you try (($reloadedobj = new Expedition($db)) && ($reloadedobj->fetchNoCompute($objectoffield->id) > 0 ? $reloadedobj->shipping_method: 0))
I tried that as well as:
(($reloadedobj = new Expedition($db)) && ($reloadedobj->fetchNoCompute($objectoffield->id) > 0 ? $reloadedobj->shipping_method: 1))
I did not get the “Bad string syntax to evaluate (found chars that are not chars for simplestring):” error.