Plugin wont set Stock level and status - Module wont fire on Product Load Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Observer not executing. Could use extra eyesmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2. Custom Attribute And Plugin in ModuleProduct image wont load and dropwon wont populateMagento 2.2.5: Overriding Admin Controller sales/orderHow can we get stock data in product listing via afterGetList plugin in Magento 2.2.3Magento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 Can't view module's front end page output?Override product load via plugin
Is the Standard Deduction better than Itemized when both are the same amount?
Can I cast Passwall to drop an enemy into a 20-foot pit?
Fundamental Solution of the Pell Equation
Is there a node or combination of nodes that can take an average colour out of a single image?
Should I discuss the type of campaign with my players?
Output the ŋarâþ crîþ alphabet song without using (m)any letters
How to find all the available tools in macOS terminal?
Why is my conclusion inconsistent with the van't Hoff equation?
Align equal signs while including text over equalities
Is there a (better) way to access $wpdb results?
Why didn't this character "real die" when they blew their stack out in Altered Carbon?
Resolving to minmaj7
What exactly is a "Meth" in Altered Carbon?
How come Sam didn't become Lord of Horn Hill?
Bete Noir -- no dairy
How to bypass password on Windows XP account?
Apollo command module space walk?
Why was the term "discrete" used in discrete logarithm?
Using audio cues to encourage good posture
Dating a Former Employee
Why are there no cargo aircraft with "flying wing" design?
List *all* the tuples!
Overriding an object in memory with placement new
Why do people hide their license plates in the EU?
Plugin wont set Stock level and status - Module wont fire on Product Load
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Observer not executing. Could use extra eyesmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2. Custom Attribute And Plugin in ModuleProduct image wont load and dropwon wont populateMagento 2.2.5: Overriding Admin Controller sales/orderHow can we get stock data in product listing via afterGetList plugin in Magento 2.2.3Magento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 Can't view module's front end page output?Override product load via plugin
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'm trying to update a stock level and status via a seperate API, and will code that when I get this working, however, I'm struggling to even set the Stock status and count to update based on information I've found on the net.
I need to run this before the product loads, as the product will most likely update and I need the screen to show the correct information. I want to use a product object as I might actually do some update on custom fields too, but for now, I'm starting simple, so any advice would be good.
UPDATE:
So I've gone done the module route, and it doesn't look like my module is firing, here is the files in the module. What kind of debugging can I use? or can anyone see anything obvious:
/app/code/Olisco/Tpcconnector/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoCatalogHelperProduct">
<plugin name="calltpc" type="OliscoTpcconnectorPluginApiCall" sortOrder="1" disabled="false"/>
</type>
</config>
/app/code/Olisco/Tpcconnector/Plugin/ApiCall.php
<?php
namespace OliscoTpcconnectorPlugin;
class ApiCall
public function beforeinitProduct(MagentoCatalogHelperProduct $subject, $result)
error_log("TEST");
var_dump("TEST");
echo "#########";
curl_setopt($ch, CURLOPT_URL, "https://dealer.theperformance.co/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
return $result;
magento2 event-observer plugin
add a comment |
I'm trying to update a stock level and status via a seperate API, and will code that when I get this working, however, I'm struggling to even set the Stock status and count to update based on information I've found on the net.
I need to run this before the product loads, as the product will most likely update and I need the screen to show the correct information. I want to use a product object as I might actually do some update on custom fields too, but for now, I'm starting simple, so any advice would be good.
UPDATE:
So I've gone done the module route, and it doesn't look like my module is firing, here is the files in the module. What kind of debugging can I use? or can anyone see anything obvious:
/app/code/Olisco/Tpcconnector/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoCatalogHelperProduct">
<plugin name="calltpc" type="OliscoTpcconnectorPluginApiCall" sortOrder="1" disabled="false"/>
</type>
</config>
/app/code/Olisco/Tpcconnector/Plugin/ApiCall.php
<?php
namespace OliscoTpcconnectorPlugin;
class ApiCall
public function beforeinitProduct(MagentoCatalogHelperProduct $subject, $result)
error_log("TEST");
var_dump("TEST");
echo "#########";
curl_setopt($ch, CURLOPT_URL, "https://dealer.theperformance.co/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
return $result;
magento2 event-observer plugin
2
you should not use events to update data. use plugins instead
– Philipp Sander
Apr 4 at 7:09
you are not saving the product
– Philipp Sander
Apr 4 at 7:10
@PhilippSander tried the ->save too and it made no difference.
– Toby Lockyer
Apr 4 at 7:13
@Toby Lockyer does your events.xml is under etc/frontend folder?
– Kirill Korushkin
Apr 4 at 7:26
add a comment |
I'm trying to update a stock level and status via a seperate API, and will code that when I get this working, however, I'm struggling to even set the Stock status and count to update based on information I've found on the net.
I need to run this before the product loads, as the product will most likely update and I need the screen to show the correct information. I want to use a product object as I might actually do some update on custom fields too, but for now, I'm starting simple, so any advice would be good.
UPDATE:
So I've gone done the module route, and it doesn't look like my module is firing, here is the files in the module. What kind of debugging can I use? or can anyone see anything obvious:
/app/code/Olisco/Tpcconnector/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoCatalogHelperProduct">
<plugin name="calltpc" type="OliscoTpcconnectorPluginApiCall" sortOrder="1" disabled="false"/>
</type>
</config>
/app/code/Olisco/Tpcconnector/Plugin/ApiCall.php
<?php
namespace OliscoTpcconnectorPlugin;
class ApiCall
public function beforeinitProduct(MagentoCatalogHelperProduct $subject, $result)
error_log("TEST");
var_dump("TEST");
echo "#########";
curl_setopt($ch, CURLOPT_URL, "https://dealer.theperformance.co/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
return $result;
magento2 event-observer plugin
I'm trying to update a stock level and status via a seperate API, and will code that when I get this working, however, I'm struggling to even set the Stock status and count to update based on information I've found on the net.
I need to run this before the product loads, as the product will most likely update and I need the screen to show the correct information. I want to use a product object as I might actually do some update on custom fields too, but for now, I'm starting simple, so any advice would be good.
UPDATE:
So I've gone done the module route, and it doesn't look like my module is firing, here is the files in the module. What kind of debugging can I use? or can anyone see anything obvious:
/app/code/Olisco/Tpcconnector/etc/di.xml
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<type name="MagentoCatalogHelperProduct">
<plugin name="calltpc" type="OliscoTpcconnectorPluginApiCall" sortOrder="1" disabled="false"/>
</type>
</config>
/app/code/Olisco/Tpcconnector/Plugin/ApiCall.php
<?php
namespace OliscoTpcconnectorPlugin;
class ApiCall
public function beforeinitProduct(MagentoCatalogHelperProduct $subject, $result)
error_log("TEST");
var_dump("TEST");
echo "#########";
curl_setopt($ch, CURLOPT_URL, "https://dealer.theperformance.co/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
return $result;
magento2 event-observer plugin
magento2 event-observer plugin
edited 3 mins ago
Toby Lockyer
asked Apr 4 at 6:58
Toby LockyerToby Lockyer
61
61
2
you should not use events to update data. use plugins instead
– Philipp Sander
Apr 4 at 7:09
you are not saving the product
– Philipp Sander
Apr 4 at 7:10
@PhilippSander tried the ->save too and it made no difference.
– Toby Lockyer
Apr 4 at 7:13
@Toby Lockyer does your events.xml is under etc/frontend folder?
– Kirill Korushkin
Apr 4 at 7:26
add a comment |
2
you should not use events to update data. use plugins instead
– Philipp Sander
Apr 4 at 7:09
you are not saving the product
– Philipp Sander
Apr 4 at 7:10
@PhilippSander tried the ->save too and it made no difference.
– Toby Lockyer
Apr 4 at 7:13
@Toby Lockyer does your events.xml is under etc/frontend folder?
– Kirill Korushkin
Apr 4 at 7:26
2
2
you should not use events to update data. use plugins instead
– Philipp Sander
Apr 4 at 7:09
you should not use events to update data. use plugins instead
– Philipp Sander
Apr 4 at 7:09
you are not saving the product
– Philipp Sander
Apr 4 at 7:10
you are not saving the product
– Philipp Sander
Apr 4 at 7:10
@PhilippSander tried the ->save too and it made no difference.
– Toby Lockyer
Apr 4 at 7:13
@PhilippSander tried the ->save too and it made no difference.
– Toby Lockyer
Apr 4 at 7:13
@Toby Lockyer does your events.xml is under etc/frontend folder?
– Kirill Korushkin
Apr 4 at 7:26
@Toby Lockyer does your events.xml is under etc/frontend folder?
– Kirill Korushkin
Apr 4 at 7:26
add a comment |
1 Answer
1
active
oldest
votes
If you are modifying the data, then you should use plugins and not the observers.
You can try creating the after plugin for the method initProduct of class MagentoCatalogHelperProduct
Reference Link for using Plugins : https://devdocs.magento.com/guides/v2.3/extension-dev-guide/plugins.html
Perfect. I would prefer to do it properly. This makes more sense...
– Toby Lockyer
Apr 4 at 7:24
This example looks about right too....emiprotechnologies.com/technical_notes/…
– Toby Lockyer
Apr 4 at 7:24
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f268697%2fplugin-wont-set-stock-level-and-status-module-wont-fire-on-product-load%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
If you are modifying the data, then you should use plugins and not the observers.
You can try creating the after plugin for the method initProduct of class MagentoCatalogHelperProduct
Reference Link for using Plugins : https://devdocs.magento.com/guides/v2.3/extension-dev-guide/plugins.html
Perfect. I would prefer to do it properly. This makes more sense...
– Toby Lockyer
Apr 4 at 7:24
This example looks about right too....emiprotechnologies.com/technical_notes/…
– Toby Lockyer
Apr 4 at 7:24
add a comment |
If you are modifying the data, then you should use plugins and not the observers.
You can try creating the after plugin for the method initProduct of class MagentoCatalogHelperProduct
Reference Link for using Plugins : https://devdocs.magento.com/guides/v2.3/extension-dev-guide/plugins.html
Perfect. I would prefer to do it properly. This makes more sense...
– Toby Lockyer
Apr 4 at 7:24
This example looks about right too....emiprotechnologies.com/technical_notes/…
– Toby Lockyer
Apr 4 at 7:24
add a comment |
If you are modifying the data, then you should use plugins and not the observers.
You can try creating the after plugin for the method initProduct of class MagentoCatalogHelperProduct
Reference Link for using Plugins : https://devdocs.magento.com/guides/v2.3/extension-dev-guide/plugins.html
If you are modifying the data, then you should use plugins and not the observers.
You can try creating the after plugin for the method initProduct of class MagentoCatalogHelperProduct
Reference Link for using Plugins : https://devdocs.magento.com/guides/v2.3/extension-dev-guide/plugins.html
answered Apr 4 at 7:15
Anshu MishraAnshu Mishra
5,67152662
5,67152662
Perfect. I would prefer to do it properly. This makes more sense...
– Toby Lockyer
Apr 4 at 7:24
This example looks about right too....emiprotechnologies.com/technical_notes/…
– Toby Lockyer
Apr 4 at 7:24
add a comment |
Perfect. I would prefer to do it properly. This makes more sense...
– Toby Lockyer
Apr 4 at 7:24
This example looks about right too....emiprotechnologies.com/technical_notes/…
– Toby Lockyer
Apr 4 at 7:24
Perfect. I would prefer to do it properly. This makes more sense...
– Toby Lockyer
Apr 4 at 7:24
Perfect. I would prefer to do it properly. This makes more sense...
– Toby Lockyer
Apr 4 at 7:24
This example looks about right too....emiprotechnologies.com/technical_notes/…
– Toby Lockyer
Apr 4 at 7:24
This example looks about right too....emiprotechnologies.com/technical_notes/…
– Toby Lockyer
Apr 4 at 7:24
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f268697%2fplugin-wont-set-stock-level-and-status-module-wont-fire-on-product-load%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
you should not use events to update data. use plugins instead
– Philipp Sander
Apr 4 at 7:09
you are not saving the product
– Philipp Sander
Apr 4 at 7:10
@PhilippSander tried the ->save too and it made no difference.
– Toby Lockyer
Apr 4 at 7:13
@Toby Lockyer does your events.xml is under etc/frontend folder?
– Kirill Korushkin
Apr 4 at 7:26