Call to a member function getId() on null - module-catalog/Helper/Product.php Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?Some 3rd level categories are not showing in filter in magento2Uncaught Error: Call to a member function setItem() on boolean on product grid: Magento 2Magento 2.2.2 REST API - I need to change the customer password using REST APIError at order shippingCall to a member function getId() on null in /var/www/vhosts/<web>/<name>/vendor/magento/framework/View/Model/Layout/Merge.phpHow to override webapi.xml in custom module?Add configure product in Cart using Magento 2 API facing an issueMagento2 REST API get all customers detailsUnable to Serialize Value Magento 2.2.6when click on place order then paypal showing error in Magento2Overriding the contact form module gets the fatal error in Magento2.2.5?

Did any compiler fully use 80-bit floating point?

The Nth Gryphon Number

Can haste grant me and my beast master companion extra attacks?

The bible of geometry: Is there a modern treatment of geometries from the most primitive to the most advanced?

Table formatting with tabularx?

Is this Kuo-toa homebrew race balanced?

Why not use the yoke to control yaw, as well as pitch and roll?

Vertical ranges of Column Plots in 12

When does a function NOT have an antiderivative?

Short story about astronauts fertilizing soil with their own bodies

Why can't fire hurt Daenerys but it did to Jon Snow in season 1?

Trying to understand entropy as a novice in thermodynamics

Flight departed from the gate 5 min before scheduled departure time. Refund options

Is it OK to use the testing sample to compare algorithms?

Why weren't discrete x86 CPUs ever used in game hardware?

How to make triangles with rounded sides and corners? (squircle with 3 sides)

Random body shuffle every night—can we still function?

How to evaluate this function?

Did John Wesley plagiarize Matthew Henry...?

How do Java 8 default methods hеlp with lambdas?

Can gravitational waves pass through a black hole?

Does the Rock Gnome trait Artificer's Lore apply when you aren't proficient in History?

Does a random sequence of vectors span a Hilbert space?

Found this skink in my tomato plant bucket. Is he trapped? Or could he leave if he wanted?



Call to a member function getId() on null - module-catalog/Helper/Product.php



Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Announcing the arrival of Valued Associate #679: Cesar Manara
Unicorn Meta Zoo #1: Why another podcast?Some 3rd level categories are not showing in filter in magento2Uncaught Error: Call to a member function setItem() on boolean on product grid: Magento 2Magento 2.2.2 REST API - I need to change the customer password using REST APIError at order shippingCall to a member function getId() on null in /var/www/vhosts/<web>/<name>/vendor/magento/framework/View/Model/Layout/Merge.phpHow to override webapi.xml in custom module?Add configure product in Cart using Magento 2 API facing an issueMagento2 REST API get all customers detailsUnable to Serialize Value Magento 2.2.6when click on place order then paypal showing error in Magento2Overriding the contact form module gets the fatal error in Magento2.2.5?



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








1















I added sample data to my magento2 website, but when I want to access to a product I always get this error :




Fatal error: Uncaught Error: Call to a member function getId() on null
in
/var/www/html/test/vendor/magento/module-catalog/Helper/Product.php:313
Stack trace: #0
/var/www/html/test/vendor/magento/module-catalog/Helper/Product.php(430):
MagentoCatalogHelperProduct->canShow(NULL) #1
/var/www/html/test/vendor/magento/module-catalog/Helper/Product/View.php(263):
MagentoCatalogHelperProduct->initProduct(1562,
Object(MagentoCatalogControllerProductViewInterceptor),
Object(MagentoFrameworkDataObject)) #2
/var/www/html/test/vendor/magento/module-catalog/Controller/Product/View.php(118):
MagentoCatalogHelperProductView->prepareAndRender(Object(MagentoFrameworkViewResultPageInterceptor),
1562, Object(MagentoCatalogControllerProductViewInterceptor),
Object(MagentoFrameworkDataObject)) #3
/var/www/html/test/vendor/magento/framework/App/Action/Action.php(108):
MagentoCatalogControllerProductView->execute() #4
/var/www/html/test/vendor/magento/framework/Interception/Interceptor.php(58):
MagentoFramewor in
/var/www/html/test/vendor/magento/module-catalog/Helper/Product.php on
line 313




The Product.php code :



public function canShow($product, $where = 'catalog')

if (is_int($product))
try
$product = $this->productRepository->getById($product);
catch (NoSuchEntityException $e)
return false;

else
/*313*/ if (!$product->getId())
return false;


return $product->isVisibleInCatalog() && $product->isVisibleInSiteVisibility();



when I var_dump($product) it's return NULL



Product.php class code : https://snipsave.com/saadsaad/#/snippet/iDIEafixLtWgzWO9sK



is there any solution?










share|improve this question
























  • It can be an indexing issue did you reindexed the site after the sample data deployment?

    – ABHISHEK TRIPATHI
    Apr 17 at 9:08











  • I lunch this command php bin/magento indexer:reindex but still not work

    – sayou
    Apr 17 at 9:10











  • did you check the $product like print_r($product) to check that the data is coming in in your $product or not

    – Asad Khan
    Apr 17 at 9:11











  • Id suggest redeploying your site if it still doesnt work try accessing the site via the admin and seeing if you can access the products via the admin if so save one via the admin and try and review that product

    – Dava Gordon
    Apr 17 at 9:11











  • @AsadKhan I don't really understand what you mean, but I get the list of products on the home page, but when I try to a specific one I get this error

    – sayou
    Apr 17 at 9:16

















1















I added sample data to my magento2 website, but when I want to access to a product I always get this error :




Fatal error: Uncaught Error: Call to a member function getId() on null
in
/var/www/html/test/vendor/magento/module-catalog/Helper/Product.php:313
Stack trace: #0
/var/www/html/test/vendor/magento/module-catalog/Helper/Product.php(430):
MagentoCatalogHelperProduct->canShow(NULL) #1
/var/www/html/test/vendor/magento/module-catalog/Helper/Product/View.php(263):
MagentoCatalogHelperProduct->initProduct(1562,
Object(MagentoCatalogControllerProductViewInterceptor),
Object(MagentoFrameworkDataObject)) #2
/var/www/html/test/vendor/magento/module-catalog/Controller/Product/View.php(118):
MagentoCatalogHelperProductView->prepareAndRender(Object(MagentoFrameworkViewResultPageInterceptor),
1562, Object(MagentoCatalogControllerProductViewInterceptor),
Object(MagentoFrameworkDataObject)) #3
/var/www/html/test/vendor/magento/framework/App/Action/Action.php(108):
MagentoCatalogControllerProductView->execute() #4
/var/www/html/test/vendor/magento/framework/Interception/Interceptor.php(58):
MagentoFramewor in
/var/www/html/test/vendor/magento/module-catalog/Helper/Product.php on
line 313




The Product.php code :



public function canShow($product, $where = 'catalog')

if (is_int($product))
try
$product = $this->productRepository->getById($product);
catch (NoSuchEntityException $e)
return false;

else
/*313*/ if (!$product->getId())
return false;


return $product->isVisibleInCatalog() && $product->isVisibleInSiteVisibility();



when I var_dump($product) it's return NULL



Product.php class code : https://snipsave.com/saadsaad/#/snippet/iDIEafixLtWgzWO9sK



is there any solution?










share|improve this question
























  • It can be an indexing issue did you reindexed the site after the sample data deployment?

    – ABHISHEK TRIPATHI
    Apr 17 at 9:08











  • I lunch this command php bin/magento indexer:reindex but still not work

    – sayou
    Apr 17 at 9:10











  • did you check the $product like print_r($product) to check that the data is coming in in your $product or not

    – Asad Khan
    Apr 17 at 9:11











  • Id suggest redeploying your site if it still doesnt work try accessing the site via the admin and seeing if you can access the products via the admin if so save one via the admin and try and review that product

    – Dava Gordon
    Apr 17 at 9:11











  • @AsadKhan I don't really understand what you mean, but I get the list of products on the home page, but when I try to a specific one I get this error

    – sayou
    Apr 17 at 9:16













1












1








1








I added sample data to my magento2 website, but when I want to access to a product I always get this error :




Fatal error: Uncaught Error: Call to a member function getId() on null
in
/var/www/html/test/vendor/magento/module-catalog/Helper/Product.php:313
Stack trace: #0
/var/www/html/test/vendor/magento/module-catalog/Helper/Product.php(430):
MagentoCatalogHelperProduct->canShow(NULL) #1
/var/www/html/test/vendor/magento/module-catalog/Helper/Product/View.php(263):
MagentoCatalogHelperProduct->initProduct(1562,
Object(MagentoCatalogControllerProductViewInterceptor),
Object(MagentoFrameworkDataObject)) #2
/var/www/html/test/vendor/magento/module-catalog/Controller/Product/View.php(118):
MagentoCatalogHelperProductView->prepareAndRender(Object(MagentoFrameworkViewResultPageInterceptor),
1562, Object(MagentoCatalogControllerProductViewInterceptor),
Object(MagentoFrameworkDataObject)) #3
/var/www/html/test/vendor/magento/framework/App/Action/Action.php(108):
MagentoCatalogControllerProductView->execute() #4
/var/www/html/test/vendor/magento/framework/Interception/Interceptor.php(58):
MagentoFramewor in
/var/www/html/test/vendor/magento/module-catalog/Helper/Product.php on
line 313




The Product.php code :



public function canShow($product, $where = 'catalog')

if (is_int($product))
try
$product = $this->productRepository->getById($product);
catch (NoSuchEntityException $e)
return false;

else
/*313*/ if (!$product->getId())
return false;


return $product->isVisibleInCatalog() && $product->isVisibleInSiteVisibility();



when I var_dump($product) it's return NULL



Product.php class code : https://snipsave.com/saadsaad/#/snippet/iDIEafixLtWgzWO9sK



is there any solution?










share|improve this question
















I added sample data to my magento2 website, but when I want to access to a product I always get this error :




Fatal error: Uncaught Error: Call to a member function getId() on null
in
/var/www/html/test/vendor/magento/module-catalog/Helper/Product.php:313
Stack trace: #0
/var/www/html/test/vendor/magento/module-catalog/Helper/Product.php(430):
MagentoCatalogHelperProduct->canShow(NULL) #1
/var/www/html/test/vendor/magento/module-catalog/Helper/Product/View.php(263):
MagentoCatalogHelperProduct->initProduct(1562,
Object(MagentoCatalogControllerProductViewInterceptor),
Object(MagentoFrameworkDataObject)) #2
/var/www/html/test/vendor/magento/module-catalog/Controller/Product/View.php(118):
MagentoCatalogHelperProductView->prepareAndRender(Object(MagentoFrameworkViewResultPageInterceptor),
1562, Object(MagentoCatalogControllerProductViewInterceptor),
Object(MagentoFrameworkDataObject)) #3
/var/www/html/test/vendor/magento/framework/App/Action/Action.php(108):
MagentoCatalogControllerProductView->execute() #4
/var/www/html/test/vendor/magento/framework/Interception/Interceptor.php(58):
MagentoFramewor in
/var/www/html/test/vendor/magento/module-catalog/Helper/Product.php on
line 313




The Product.php code :



public function canShow($product, $where = 'catalog')

if (is_int($product))
try
$product = $this->productRepository->getById($product);
catch (NoSuchEntityException $e)
return false;

else
/*313*/ if (!$product->getId())
return false;


return $product->isVisibleInCatalog() && $product->isVisibleInSiteVisibility();



when I var_dump($product) it's return NULL



Product.php class code : https://snipsave.com/saadsaad/#/snippet/iDIEafixLtWgzWO9sK



is there any solution?







magento2






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 17 at 11:07







sayou

















asked Apr 17 at 9:07









sayousayou

1358




1358












  • It can be an indexing issue did you reindexed the site after the sample data deployment?

    – ABHISHEK TRIPATHI
    Apr 17 at 9:08











  • I lunch this command php bin/magento indexer:reindex but still not work

    – sayou
    Apr 17 at 9:10











  • did you check the $product like print_r($product) to check that the data is coming in in your $product or not

    – Asad Khan
    Apr 17 at 9:11











  • Id suggest redeploying your site if it still doesnt work try accessing the site via the admin and seeing if you can access the products via the admin if so save one via the admin and try and review that product

    – Dava Gordon
    Apr 17 at 9:11











  • @AsadKhan I don't really understand what you mean, but I get the list of products on the home page, but when I try to a specific one I get this error

    – sayou
    Apr 17 at 9:16

















  • It can be an indexing issue did you reindexed the site after the sample data deployment?

    – ABHISHEK TRIPATHI
    Apr 17 at 9:08











  • I lunch this command php bin/magento indexer:reindex but still not work

    – sayou
    Apr 17 at 9:10











  • did you check the $product like print_r($product) to check that the data is coming in in your $product or not

    – Asad Khan
    Apr 17 at 9:11











  • Id suggest redeploying your site if it still doesnt work try accessing the site via the admin and seeing if you can access the products via the admin if so save one via the admin and try and review that product

    – Dava Gordon
    Apr 17 at 9:11











  • @AsadKhan I don't really understand what you mean, but I get the list of products on the home page, but when I try to a specific one I get this error

    – sayou
    Apr 17 at 9:16
















It can be an indexing issue did you reindexed the site after the sample data deployment?

– ABHISHEK TRIPATHI
Apr 17 at 9:08





It can be an indexing issue did you reindexed the site after the sample data deployment?

– ABHISHEK TRIPATHI
Apr 17 at 9:08













I lunch this command php bin/magento indexer:reindex but still not work

– sayou
Apr 17 at 9:10





I lunch this command php bin/magento indexer:reindex but still not work

– sayou
Apr 17 at 9:10













did you check the $product like print_r($product) to check that the data is coming in in your $product or not

– Asad Khan
Apr 17 at 9:11





did you check the $product like print_r($product) to check that the data is coming in in your $product or not

– Asad Khan
Apr 17 at 9:11













Id suggest redeploying your site if it still doesnt work try accessing the site via the admin and seeing if you can access the products via the admin if so save one via the admin and try and review that product

– Dava Gordon
Apr 17 at 9:11





Id suggest redeploying your site if it still doesnt work try accessing the site via the admin and seeing if you can access the products via the admin if so save one via the admin and try and review that product

– Dava Gordon
Apr 17 at 9:11













@AsadKhan I don't really understand what you mean, but I get the list of products on the home page, but when I try to a specific one I get this error

– sayou
Apr 17 at 9:16





@AsadKhan I don't really understand what you mean, but I get the list of products on the home page, but when I try to a specific one I get this error

– sayou
Apr 17 at 9:16










3 Answers
3






active

oldest

votes


















0














Change your code from if (!$product->getId()) to if (!$product) it should work



complete code would be:



public function canShow($product, $where = 'catalog')

if (is_int($product))
try
$product = $this->productRepository->getById($product);
catch (NoSuchEntityException $e)
return false;

else
/*313*/
if (!$product)
return false;


return $product->isVisibleInCatalog() && $product->isVisibleInSiteVisibility();






share|improve this answer


















  • 1





    I do it, but when I access to a product I get 404 page

    – sayou
    Apr 17 at 9:16


















0














Try this one:
null will be returned if the object is null.



public function canShow($product, $where = 'catalog')

if (is_int($product))
try
$product = $this->productRepository->getById($product);
catch (NoSuchEntityException $e)
return false;

else
return $product ? $product->getId() : null;

return $product->isVisibleInCatalog() && $product->isVisibleInSiteVisibility();






share|improve this answer

























  • It's get a 404 page

    – sayou
    Apr 17 at 9:25











  • better if you can post your whole Product class so that we can check why it returns 404

    – magefms
    Apr 17 at 9:30












  • @magefms, can you help me on this please, magento.stackexchange.com/questions/270442/…

    – jafar pinjar
    Apr 17 at 10:41











  • @magefms I added the product.php code

    – sayou
    Apr 17 at 11:08











  • @sayou I tried your code but it works. kindly double check if you have some custom class that extends product helper class

    – magefms
    Apr 17 at 11:40


















0














After a lot of search, I found that the problem was on di.xml



because I added this:



<preference for="MagentoCatalogApiProductRepositoryInterface" 
type="TestingHelloWorldModelCustomImplementation" />


so I remove it and it's work






share|improve this answer























    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
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f270445%2fcall-to-a-member-function-getid-on-null-module-catalog-helper-product-php%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    3 Answers
    3






    active

    oldest

    votes








    3 Answers
    3






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Change your code from if (!$product->getId()) to if (!$product) it should work



    complete code would be:



    public function canShow($product, $where = 'catalog')

    if (is_int($product))
    try
    $product = $this->productRepository->getById($product);
    catch (NoSuchEntityException $e)
    return false;

    else
    /*313*/
    if (!$product)
    return false;


    return $product->isVisibleInCatalog() && $product->isVisibleInSiteVisibility();






    share|improve this answer


















    • 1





      I do it, but when I access to a product I get 404 page

      – sayou
      Apr 17 at 9:16















    0














    Change your code from if (!$product->getId()) to if (!$product) it should work



    complete code would be:



    public function canShow($product, $where = 'catalog')

    if (is_int($product))
    try
    $product = $this->productRepository->getById($product);
    catch (NoSuchEntityException $e)
    return false;

    else
    /*313*/
    if (!$product)
    return false;


    return $product->isVisibleInCatalog() && $product->isVisibleInSiteVisibility();






    share|improve this answer


















    • 1





      I do it, but when I access to a product I get 404 page

      – sayou
      Apr 17 at 9:16













    0












    0








    0







    Change your code from if (!$product->getId()) to if (!$product) it should work



    complete code would be:



    public function canShow($product, $where = 'catalog')

    if (is_int($product))
    try
    $product = $this->productRepository->getById($product);
    catch (NoSuchEntityException $e)
    return false;

    else
    /*313*/
    if (!$product)
    return false;


    return $product->isVisibleInCatalog() && $product->isVisibleInSiteVisibility();






    share|improve this answer













    Change your code from if (!$product->getId()) to if (!$product) it should work



    complete code would be:



    public function canShow($product, $where = 'catalog')

    if (is_int($product))
    try
    $product = $this->productRepository->getById($product);
    catch (NoSuchEntityException $e)
    return false;

    else
    /*313*/
    if (!$product)
    return false;


    return $product->isVisibleInCatalog() && $product->isVisibleInSiteVisibility();







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Apr 17 at 9:15









    Shoaib MunirShoaib Munir

    2,55821031




    2,55821031







    • 1





      I do it, but when I access to a product I get 404 page

      – sayou
      Apr 17 at 9:16












    • 1





      I do it, but when I access to a product I get 404 page

      – sayou
      Apr 17 at 9:16







    1




    1





    I do it, but when I access to a product I get 404 page

    – sayou
    Apr 17 at 9:16





    I do it, but when I access to a product I get 404 page

    – sayou
    Apr 17 at 9:16













    0














    Try this one:
    null will be returned if the object is null.



    public function canShow($product, $where = 'catalog')

    if (is_int($product))
    try
    $product = $this->productRepository->getById($product);
    catch (NoSuchEntityException $e)
    return false;

    else
    return $product ? $product->getId() : null;

    return $product->isVisibleInCatalog() && $product->isVisibleInSiteVisibility();






    share|improve this answer

























    • It's get a 404 page

      – sayou
      Apr 17 at 9:25











    • better if you can post your whole Product class so that we can check why it returns 404

      – magefms
      Apr 17 at 9:30












    • @magefms, can you help me on this please, magento.stackexchange.com/questions/270442/…

      – jafar pinjar
      Apr 17 at 10:41











    • @magefms I added the product.php code

      – sayou
      Apr 17 at 11:08











    • @sayou I tried your code but it works. kindly double check if you have some custom class that extends product helper class

      – magefms
      Apr 17 at 11:40















    0














    Try this one:
    null will be returned if the object is null.



    public function canShow($product, $where = 'catalog')

    if (is_int($product))
    try
    $product = $this->productRepository->getById($product);
    catch (NoSuchEntityException $e)
    return false;

    else
    return $product ? $product->getId() : null;

    return $product->isVisibleInCatalog() && $product->isVisibleInSiteVisibility();






    share|improve this answer

























    • It's get a 404 page

      – sayou
      Apr 17 at 9:25











    • better if you can post your whole Product class so that we can check why it returns 404

      – magefms
      Apr 17 at 9:30












    • @magefms, can you help me on this please, magento.stackexchange.com/questions/270442/…

      – jafar pinjar
      Apr 17 at 10:41











    • @magefms I added the product.php code

      – sayou
      Apr 17 at 11:08











    • @sayou I tried your code but it works. kindly double check if you have some custom class that extends product helper class

      – magefms
      Apr 17 at 11:40













    0












    0








    0







    Try this one:
    null will be returned if the object is null.



    public function canShow($product, $where = 'catalog')

    if (is_int($product))
    try
    $product = $this->productRepository->getById($product);
    catch (NoSuchEntityException $e)
    return false;

    else
    return $product ? $product->getId() : null;

    return $product->isVisibleInCatalog() && $product->isVisibleInSiteVisibility();






    share|improve this answer















    Try this one:
    null will be returned if the object is null.



    public function canShow($product, $where = 'catalog')

    if (is_int($product))
    try
    $product = $this->productRepository->getById($product);
    catch (NoSuchEntityException $e)
    return false;

    else
    return $product ? $product->getId() : null;

    return $product->isVisibleInCatalog() && $product->isVisibleInSiteVisibility();







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Apr 17 at 9:29

























    answered Apr 17 at 9:17









    magefmsmagefms

    2,8052528




    2,8052528












    • It's get a 404 page

      – sayou
      Apr 17 at 9:25











    • better if you can post your whole Product class so that we can check why it returns 404

      – magefms
      Apr 17 at 9:30












    • @magefms, can you help me on this please, magento.stackexchange.com/questions/270442/…

      – jafar pinjar
      Apr 17 at 10:41











    • @magefms I added the product.php code

      – sayou
      Apr 17 at 11:08











    • @sayou I tried your code but it works. kindly double check if you have some custom class that extends product helper class

      – magefms
      Apr 17 at 11:40

















    • It's get a 404 page

      – sayou
      Apr 17 at 9:25











    • better if you can post your whole Product class so that we can check why it returns 404

      – magefms
      Apr 17 at 9:30












    • @magefms, can you help me on this please, magento.stackexchange.com/questions/270442/…

      – jafar pinjar
      Apr 17 at 10:41











    • @magefms I added the product.php code

      – sayou
      Apr 17 at 11:08











    • @sayou I tried your code but it works. kindly double check if you have some custom class that extends product helper class

      – magefms
      Apr 17 at 11:40
















    It's get a 404 page

    – sayou
    Apr 17 at 9:25





    It's get a 404 page

    – sayou
    Apr 17 at 9:25













    better if you can post your whole Product class so that we can check why it returns 404

    – magefms
    Apr 17 at 9:30






    better if you can post your whole Product class so that we can check why it returns 404

    – magefms
    Apr 17 at 9:30














    @magefms, can you help me on this please, magento.stackexchange.com/questions/270442/…

    – jafar pinjar
    Apr 17 at 10:41





    @magefms, can you help me on this please, magento.stackexchange.com/questions/270442/…

    – jafar pinjar
    Apr 17 at 10:41













    @magefms I added the product.php code

    – sayou
    Apr 17 at 11:08





    @magefms I added the product.php code

    – sayou
    Apr 17 at 11:08













    @sayou I tried your code but it works. kindly double check if you have some custom class that extends product helper class

    – magefms
    Apr 17 at 11:40





    @sayou I tried your code but it works. kindly double check if you have some custom class that extends product helper class

    – magefms
    Apr 17 at 11:40











    0














    After a lot of search, I found that the problem was on di.xml



    because I added this:



    <preference for="MagentoCatalogApiProductRepositoryInterface" 
    type="TestingHelloWorldModelCustomImplementation" />


    so I remove it and it's work






    share|improve this answer



























      0














      After a lot of search, I found that the problem was on di.xml



      because I added this:



      <preference for="MagentoCatalogApiProductRepositoryInterface" 
      type="TestingHelloWorldModelCustomImplementation" />


      so I remove it and it's work






      share|improve this answer

























        0












        0








        0







        After a lot of search, I found that the problem was on di.xml



        because I added this:



        <preference for="MagentoCatalogApiProductRepositoryInterface" 
        type="TestingHelloWorldModelCustomImplementation" />


        so I remove it and it's work






        share|improve this answer













        After a lot of search, I found that the problem was on di.xml



        because I added this:



        <preference for="MagentoCatalogApiProductRepositoryInterface" 
        type="TestingHelloWorldModelCustomImplementation" />


        so I remove it and it's work







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Apr 17 at 14:12









        sayousayou

        1358




        1358



























            draft saved

            draft discarded
















































            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.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f270445%2fcall-to-a-member-function-getid-on-null-module-catalog-helper-product-php%23new-answer', 'question_page');

            );

            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







            Popular posts from this blog

            Bulk add to cart function issuecart vs. mini cart issue … rwd themeRedirect Add to cart button to cart pageAdd to cart issue - Magento 2.1The requested Payment Method is not available When creating an orderM2: reason add-to-cart might not function in production modeAdd to cart issue in some android devicesMagento 2 - custom price can not add to subtotal and grand total after add to cartAdd to cart codeIssue with my cart module on pdp and cart pages, just keeps spinningBulk price and quantity update using rest api

            БиармияSxpst500bh2ntaf! 3h2r