Showing the most recently added products that are set to display on this websiteNot all products are showing...

What will happen if I transfer large sums of money into my bank account from a pre-paid debit card or gift card?

Why does magnet wire need to be insulated?

What makes papers publishable in top-tier journals?

Why is it that Bernie Sanders is always called a "socialist"?

Does a paladin have to announce that they're using Divine Smite before attacking?

Is there a lava-breathing lizard creature (that could be worshipped by a cult) in 5e?

How do you funnel food off a cutting board?

Coworker asking me to not bring cakes due to self control issue. What should I do?

Why does 0.-5 evaluate to -5?

Does it take energy to move something in a circle?

What is a good reason for every spaceship to carry a weapon on board?

Does diversity provide anything that meritocracy does not?

Updating Statistics: Estimated Number of Rows not equal to Actual for Index Scan. Why?

False written accusations not made public - is there law to cover this?

Why do all the books in Game of Thrones library have their covers facing the back of the shelf?

Citing paid articles from illegal web sharing

Can we "borrow" our answers to populate our own websites?

What is a DAG (Graph Theory)?

The probability of reaching the absorbing states from a particular transient state?

Plausible reason for gold-digging ant

Cryptic with some cross words

Could an Apollo mission be possible if Moon would be Earth like?

Calculate the true diameter of stars from photographic plate

The No-Straight Maze



Showing the most recently added products that are set to display on this website


Not all products are showing upmagento showing irrelevant products and products that are under a disabled categoryrecently viewed products not showing for guest usersDisplay all website productsAdded Products are showing out of stockMy products aren't showing up on my new store. Transactional website needs to share all the same products as default storedisplay product failedMagento 2 get out of stock products in collectionMagento 2 Products Not Showing in Category (but are visible via search)Programatically get special price products that are active by checking the end date?













0















Magento 2.1.6
I have a module that populates a specific category with the "latest 200" new items added to my magento database.
However, it has a problem in that it doesn't account for the "Product In Website" attribute against each product. So any items that I do not yet have assigned to the website are still counted among those 200 products I am trying to display. In that case, there will be missing products from the page as they will not be displayed - no problem unless you want to add another 10,000 items to your magento database, but not display them on this website! My 200 most recent items will actually display zero items in this case.



This is the part of the code that puts together the product collection, but I think it needs reworking to take into account the problem outlined above, and to also always contain 200 products in the resulting collection.



if ($catID == 571 && $catID !== "") {
$request = $objectManager->create('MagentoFrameworkAppRequestHttp');
$productCollection = $objectManager->create('MagentoCatalogModelResourceModelProductCollectionFactory');
$_productCollectionlastitem = $productCollection->create()->setPageSize(1)->addAttributeToSelect('*')->addAttributeToSort('entity_id', 'desc')
->load();
$lastid = $_productCollectionlastitem->getFirstItem()->getId();
$startid = $lastid - 200;
$storeid = 1;
$_productCollection = $productCollection->create()
->setPageSize(36)
->setCurPage($request->getParam("p"))
->addAttributeToSelect('*')
->addStoreFilter($storeid)
->addAttributeToFilter('visibility', MagentoCatalogModelProductVisibility::VISIBILITY_BOTH)
->addAttributeToFilter('status', MagentoCatalogModelProductAttributeSourceStatus::STATUS_ENABLED)
->addAttributeToFilter('image', array("neq"=>'no_selection'))
->addAttributeToFilter('entity_id', array(
'from' => $startid,
'to' => $lastid
));
if ($request->getParam("product_list_order")) {
$_productCollection->addAttributeToSort($request->getParam("product_list_order"), "asc");
} else {
$_productCollection->addAttributeToSort('entity_id', "desc");
}
$_productCollection->addUrlRewrite();
//
$_productCollection->load();

return $_productCollection;
}


I think the way this collection is assembled is incorrect, starting counting at the most recent ID number of the products, but I am unsure how I might fix this.



Could anyone shine some light on how I might change this code to resolve this issue?










share|improve this question



























    0















    Magento 2.1.6
    I have a module that populates a specific category with the "latest 200" new items added to my magento database.
    However, it has a problem in that it doesn't account for the "Product In Website" attribute against each product. So any items that I do not yet have assigned to the website are still counted among those 200 products I am trying to display. In that case, there will be missing products from the page as they will not be displayed - no problem unless you want to add another 10,000 items to your magento database, but not display them on this website! My 200 most recent items will actually display zero items in this case.



    This is the part of the code that puts together the product collection, but I think it needs reworking to take into account the problem outlined above, and to also always contain 200 products in the resulting collection.



    if ($catID == 571 && $catID !== "") {
    $request = $objectManager->create('MagentoFrameworkAppRequestHttp');
    $productCollection = $objectManager->create('MagentoCatalogModelResourceModelProductCollectionFactory');
    $_productCollectionlastitem = $productCollection->create()->setPageSize(1)->addAttributeToSelect('*')->addAttributeToSort('entity_id', 'desc')
    ->load();
    $lastid = $_productCollectionlastitem->getFirstItem()->getId();
    $startid = $lastid - 200;
    $storeid = 1;
    $_productCollection = $productCollection->create()
    ->setPageSize(36)
    ->setCurPage($request->getParam("p"))
    ->addAttributeToSelect('*')
    ->addStoreFilter($storeid)
    ->addAttributeToFilter('visibility', MagentoCatalogModelProductVisibility::VISIBILITY_BOTH)
    ->addAttributeToFilter('status', MagentoCatalogModelProductAttributeSourceStatus::STATUS_ENABLED)
    ->addAttributeToFilter('image', array("neq"=>'no_selection'))
    ->addAttributeToFilter('entity_id', array(
    'from' => $startid,
    'to' => $lastid
    ));
    if ($request->getParam("product_list_order")) {
    $_productCollection->addAttributeToSort($request->getParam("product_list_order"), "asc");
    } else {
    $_productCollection->addAttributeToSort('entity_id', "desc");
    }
    $_productCollection->addUrlRewrite();
    //
    $_productCollection->load();

    return $_productCollection;
    }


    I think the way this collection is assembled is incorrect, starting counting at the most recent ID number of the products, but I am unsure how I might fix this.



    Could anyone shine some light on how I might change this code to resolve this issue?










    share|improve this question

























      0












      0








      0








      Magento 2.1.6
      I have a module that populates a specific category with the "latest 200" new items added to my magento database.
      However, it has a problem in that it doesn't account for the "Product In Website" attribute against each product. So any items that I do not yet have assigned to the website are still counted among those 200 products I am trying to display. In that case, there will be missing products from the page as they will not be displayed - no problem unless you want to add another 10,000 items to your magento database, but not display them on this website! My 200 most recent items will actually display zero items in this case.



      This is the part of the code that puts together the product collection, but I think it needs reworking to take into account the problem outlined above, and to also always contain 200 products in the resulting collection.



      if ($catID == 571 && $catID !== "") {
      $request = $objectManager->create('MagentoFrameworkAppRequestHttp');
      $productCollection = $objectManager->create('MagentoCatalogModelResourceModelProductCollectionFactory');
      $_productCollectionlastitem = $productCollection->create()->setPageSize(1)->addAttributeToSelect('*')->addAttributeToSort('entity_id', 'desc')
      ->load();
      $lastid = $_productCollectionlastitem->getFirstItem()->getId();
      $startid = $lastid - 200;
      $storeid = 1;
      $_productCollection = $productCollection->create()
      ->setPageSize(36)
      ->setCurPage($request->getParam("p"))
      ->addAttributeToSelect('*')
      ->addStoreFilter($storeid)
      ->addAttributeToFilter('visibility', MagentoCatalogModelProductVisibility::VISIBILITY_BOTH)
      ->addAttributeToFilter('status', MagentoCatalogModelProductAttributeSourceStatus::STATUS_ENABLED)
      ->addAttributeToFilter('image', array("neq"=>'no_selection'))
      ->addAttributeToFilter('entity_id', array(
      'from' => $startid,
      'to' => $lastid
      ));
      if ($request->getParam("product_list_order")) {
      $_productCollection->addAttributeToSort($request->getParam("product_list_order"), "asc");
      } else {
      $_productCollection->addAttributeToSort('entity_id', "desc");
      }
      $_productCollection->addUrlRewrite();
      //
      $_productCollection->load();

      return $_productCollection;
      }


      I think the way this collection is assembled is incorrect, starting counting at the most recent ID number of the products, but I am unsure how I might fix this.



      Could anyone shine some light on how I might change this code to resolve this issue?










      share|improve this question














      Magento 2.1.6
      I have a module that populates a specific category with the "latest 200" new items added to my magento database.
      However, it has a problem in that it doesn't account for the "Product In Website" attribute against each product. So any items that I do not yet have assigned to the website are still counted among those 200 products I am trying to display. In that case, there will be missing products from the page as they will not be displayed - no problem unless you want to add another 10,000 items to your magento database, but not display them on this website! My 200 most recent items will actually display zero items in this case.



      This is the part of the code that puts together the product collection, but I think it needs reworking to take into account the problem outlined above, and to also always contain 200 products in the resulting collection.



      if ($catID == 571 && $catID !== "") {
      $request = $objectManager->create('MagentoFrameworkAppRequestHttp');
      $productCollection = $objectManager->create('MagentoCatalogModelResourceModelProductCollectionFactory');
      $_productCollectionlastitem = $productCollection->create()->setPageSize(1)->addAttributeToSelect('*')->addAttributeToSort('entity_id', 'desc')
      ->load();
      $lastid = $_productCollectionlastitem->getFirstItem()->getId();
      $startid = $lastid - 200;
      $storeid = 1;
      $_productCollection = $productCollection->create()
      ->setPageSize(36)
      ->setCurPage($request->getParam("p"))
      ->addAttributeToSelect('*')
      ->addStoreFilter($storeid)
      ->addAttributeToFilter('visibility', MagentoCatalogModelProductVisibility::VISIBILITY_BOTH)
      ->addAttributeToFilter('status', MagentoCatalogModelProductAttributeSourceStatus::STATUS_ENABLED)
      ->addAttributeToFilter('image', array("neq"=>'no_selection'))
      ->addAttributeToFilter('entity_id', array(
      'from' => $startid,
      'to' => $lastid
      ));
      if ($request->getParam("product_list_order")) {
      $_productCollection->addAttributeToSort($request->getParam("product_list_order"), "asc");
      } else {
      $_productCollection->addAttributeToSort('entity_id', "desc");
      }
      $_productCollection->addUrlRewrite();
      //
      $_productCollection->load();

      return $_productCollection;
      }


      I think the way this collection is assembled is incorrect, starting counting at the most recent ID number of the products, but I am unsure how I might fix this.



      Could anyone shine some light on how I might change this code to resolve this issue?







      magento2 products






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 2 hours ago









      robgtrobgt

      2791417




      2791417






















          1 Answer
          1






          active

          oldest

          votes


















          1














          After understanding your problem, I would say you should apply the store filter to the first collection where you get the last entity_id. Also I would limit that collection to 200 and get the first and last item. That should be safe because the store filter is applied. To be 100% in sync with the collection where you retrieve the data you need to put all filter except paging in the collection where the range of entity_ids is determined.



          Give it a try:



          //your code
          $_productCollectionlastitem = $productCollection->create()->setPageSize(1)->addAttributeToSelect('*')->addAttributeToSort('entity_id', 'desc')
          ->load();
          $lastid = $_productCollectionlastitem->getFirstItem()->getId();
          $startid = $lastid - 200;

          //new code with lastid and startid matching the store
          //anyway to be 100% consistent with the collection where you retrieve data, you need all filters set here (except paging parameters)
          $storeid = 1;
          $_productCollectionlastitem = $productCollection->create()
          ->setPageSize(200)
          ->addStoreFilter($storeid)
          ->addAttributeToFilter('visibility', MagentoCatalogModelProductVisibility::VISIBILITY_BOTH)
          ->addAttributeToFilter('status', MagentoCatalogModelProductAttributeSourceStatus::STATUS_ENABLED)
          ->addAttributeToFilter('image', array("neq"=>'no_selection'))
          ->addAttributeToSort('entity_id', 'desc')
          ->load();
          $lastid = $_productCollectionlastitem->getFirstItem()->getId();
          $startid = $_productCollectionlastitem->getLastItem()->getId();
          //continue with your code....





          share|improve this answer


























          • There is already a setPageSize(36) in the collection code, which determines how many items to display on a page. not sure this will work?

            – robgt
            1 hour ago













          • Sorry, you're right - I have overseen that, choose the pagesize you need - if you want 36 keep the first one, if you need 200 the last. The difference to your code is that I have removed the "hard" limitation of the entity_ids from - to. I've updated the code and removed the duplicate setPageSize

            – HelgeB
            1 hour ago













          • Thank you. I will have to try this now. What I am hoping is that it will always start displaying products from the most recently added new item down to older items (limited to 200 total products).

            – robgt
            1 hour ago











          • Unfortunately, this pulls in ALL products from the database, and displays 200 per page...

            – robgt
            1 hour ago











          • Ok, now I understand: you expect a product list with correct pagination which ends at 200 products. I'll think about that, of course my code can't do that, sorry

            – HelgeB
            1 hour ago











          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%2f263503%2fshowing-the-most-recently-added-products-that-are-set-to-display-on-this-website%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









          1














          After understanding your problem, I would say you should apply the store filter to the first collection where you get the last entity_id. Also I would limit that collection to 200 and get the first and last item. That should be safe because the store filter is applied. To be 100% in sync with the collection where you retrieve the data you need to put all filter except paging in the collection where the range of entity_ids is determined.



          Give it a try:



          //your code
          $_productCollectionlastitem = $productCollection->create()->setPageSize(1)->addAttributeToSelect('*')->addAttributeToSort('entity_id', 'desc')
          ->load();
          $lastid = $_productCollectionlastitem->getFirstItem()->getId();
          $startid = $lastid - 200;

          //new code with lastid and startid matching the store
          //anyway to be 100% consistent with the collection where you retrieve data, you need all filters set here (except paging parameters)
          $storeid = 1;
          $_productCollectionlastitem = $productCollection->create()
          ->setPageSize(200)
          ->addStoreFilter($storeid)
          ->addAttributeToFilter('visibility', MagentoCatalogModelProductVisibility::VISIBILITY_BOTH)
          ->addAttributeToFilter('status', MagentoCatalogModelProductAttributeSourceStatus::STATUS_ENABLED)
          ->addAttributeToFilter('image', array("neq"=>'no_selection'))
          ->addAttributeToSort('entity_id', 'desc')
          ->load();
          $lastid = $_productCollectionlastitem->getFirstItem()->getId();
          $startid = $_productCollectionlastitem->getLastItem()->getId();
          //continue with your code....





          share|improve this answer


























          • There is already a setPageSize(36) in the collection code, which determines how many items to display on a page. not sure this will work?

            – robgt
            1 hour ago













          • Sorry, you're right - I have overseen that, choose the pagesize you need - if you want 36 keep the first one, if you need 200 the last. The difference to your code is that I have removed the "hard" limitation of the entity_ids from - to. I've updated the code and removed the duplicate setPageSize

            – HelgeB
            1 hour ago













          • Thank you. I will have to try this now. What I am hoping is that it will always start displaying products from the most recently added new item down to older items (limited to 200 total products).

            – robgt
            1 hour ago











          • Unfortunately, this pulls in ALL products from the database, and displays 200 per page...

            – robgt
            1 hour ago











          • Ok, now I understand: you expect a product list with correct pagination which ends at 200 products. I'll think about that, of course my code can't do that, sorry

            – HelgeB
            1 hour ago
















          1














          After understanding your problem, I would say you should apply the store filter to the first collection where you get the last entity_id. Also I would limit that collection to 200 and get the first and last item. That should be safe because the store filter is applied. To be 100% in sync with the collection where you retrieve the data you need to put all filter except paging in the collection where the range of entity_ids is determined.



          Give it a try:



          //your code
          $_productCollectionlastitem = $productCollection->create()->setPageSize(1)->addAttributeToSelect('*')->addAttributeToSort('entity_id', 'desc')
          ->load();
          $lastid = $_productCollectionlastitem->getFirstItem()->getId();
          $startid = $lastid - 200;

          //new code with lastid and startid matching the store
          //anyway to be 100% consistent with the collection where you retrieve data, you need all filters set here (except paging parameters)
          $storeid = 1;
          $_productCollectionlastitem = $productCollection->create()
          ->setPageSize(200)
          ->addStoreFilter($storeid)
          ->addAttributeToFilter('visibility', MagentoCatalogModelProductVisibility::VISIBILITY_BOTH)
          ->addAttributeToFilter('status', MagentoCatalogModelProductAttributeSourceStatus::STATUS_ENABLED)
          ->addAttributeToFilter('image', array("neq"=>'no_selection'))
          ->addAttributeToSort('entity_id', 'desc')
          ->load();
          $lastid = $_productCollectionlastitem->getFirstItem()->getId();
          $startid = $_productCollectionlastitem->getLastItem()->getId();
          //continue with your code....





          share|improve this answer


























          • There is already a setPageSize(36) in the collection code, which determines how many items to display on a page. not sure this will work?

            – robgt
            1 hour ago













          • Sorry, you're right - I have overseen that, choose the pagesize you need - if you want 36 keep the first one, if you need 200 the last. The difference to your code is that I have removed the "hard" limitation of the entity_ids from - to. I've updated the code and removed the duplicate setPageSize

            – HelgeB
            1 hour ago













          • Thank you. I will have to try this now. What I am hoping is that it will always start displaying products from the most recently added new item down to older items (limited to 200 total products).

            – robgt
            1 hour ago











          • Unfortunately, this pulls in ALL products from the database, and displays 200 per page...

            – robgt
            1 hour ago











          • Ok, now I understand: you expect a product list with correct pagination which ends at 200 products. I'll think about that, of course my code can't do that, sorry

            – HelgeB
            1 hour ago














          1












          1








          1







          After understanding your problem, I would say you should apply the store filter to the first collection where you get the last entity_id. Also I would limit that collection to 200 and get the first and last item. That should be safe because the store filter is applied. To be 100% in sync with the collection where you retrieve the data you need to put all filter except paging in the collection where the range of entity_ids is determined.



          Give it a try:



          //your code
          $_productCollectionlastitem = $productCollection->create()->setPageSize(1)->addAttributeToSelect('*')->addAttributeToSort('entity_id', 'desc')
          ->load();
          $lastid = $_productCollectionlastitem->getFirstItem()->getId();
          $startid = $lastid - 200;

          //new code with lastid and startid matching the store
          //anyway to be 100% consistent with the collection where you retrieve data, you need all filters set here (except paging parameters)
          $storeid = 1;
          $_productCollectionlastitem = $productCollection->create()
          ->setPageSize(200)
          ->addStoreFilter($storeid)
          ->addAttributeToFilter('visibility', MagentoCatalogModelProductVisibility::VISIBILITY_BOTH)
          ->addAttributeToFilter('status', MagentoCatalogModelProductAttributeSourceStatus::STATUS_ENABLED)
          ->addAttributeToFilter('image', array("neq"=>'no_selection'))
          ->addAttributeToSort('entity_id', 'desc')
          ->load();
          $lastid = $_productCollectionlastitem->getFirstItem()->getId();
          $startid = $_productCollectionlastitem->getLastItem()->getId();
          //continue with your code....





          share|improve this answer















          After understanding your problem, I would say you should apply the store filter to the first collection where you get the last entity_id. Also I would limit that collection to 200 and get the first and last item. That should be safe because the store filter is applied. To be 100% in sync with the collection where you retrieve the data you need to put all filter except paging in the collection where the range of entity_ids is determined.



          Give it a try:



          //your code
          $_productCollectionlastitem = $productCollection->create()->setPageSize(1)->addAttributeToSelect('*')->addAttributeToSort('entity_id', 'desc')
          ->load();
          $lastid = $_productCollectionlastitem->getFirstItem()->getId();
          $startid = $lastid - 200;

          //new code with lastid and startid matching the store
          //anyway to be 100% consistent with the collection where you retrieve data, you need all filters set here (except paging parameters)
          $storeid = 1;
          $_productCollectionlastitem = $productCollection->create()
          ->setPageSize(200)
          ->addStoreFilter($storeid)
          ->addAttributeToFilter('visibility', MagentoCatalogModelProductVisibility::VISIBILITY_BOTH)
          ->addAttributeToFilter('status', MagentoCatalogModelProductAttributeSourceStatus::STATUS_ENABLED)
          ->addAttributeToFilter('image', array("neq"=>'no_selection'))
          ->addAttributeToSort('entity_id', 'desc')
          ->load();
          $lastid = $_productCollectionlastitem->getFirstItem()->getId();
          $startid = $_productCollectionlastitem->getLastItem()->getId();
          //continue with your code....






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 1 hour ago

























          answered 2 hours ago









          HelgeBHelgeB

          1,463114




          1,463114













          • There is already a setPageSize(36) in the collection code, which determines how many items to display on a page. not sure this will work?

            – robgt
            1 hour ago













          • Sorry, you're right - I have overseen that, choose the pagesize you need - if you want 36 keep the first one, if you need 200 the last. The difference to your code is that I have removed the "hard" limitation of the entity_ids from - to. I've updated the code and removed the duplicate setPageSize

            – HelgeB
            1 hour ago













          • Thank you. I will have to try this now. What I am hoping is that it will always start displaying products from the most recently added new item down to older items (limited to 200 total products).

            – robgt
            1 hour ago











          • Unfortunately, this pulls in ALL products from the database, and displays 200 per page...

            – robgt
            1 hour ago











          • Ok, now I understand: you expect a product list with correct pagination which ends at 200 products. I'll think about that, of course my code can't do that, sorry

            – HelgeB
            1 hour ago



















          • There is already a setPageSize(36) in the collection code, which determines how many items to display on a page. not sure this will work?

            – robgt
            1 hour ago













          • Sorry, you're right - I have overseen that, choose the pagesize you need - if you want 36 keep the first one, if you need 200 the last. The difference to your code is that I have removed the "hard" limitation of the entity_ids from - to. I've updated the code and removed the duplicate setPageSize

            – HelgeB
            1 hour ago













          • Thank you. I will have to try this now. What I am hoping is that it will always start displaying products from the most recently added new item down to older items (limited to 200 total products).

            – robgt
            1 hour ago











          • Unfortunately, this pulls in ALL products from the database, and displays 200 per page...

            – robgt
            1 hour ago











          • Ok, now I understand: you expect a product list with correct pagination which ends at 200 products. I'll think about that, of course my code can't do that, sorry

            – HelgeB
            1 hour ago

















          There is already a setPageSize(36) in the collection code, which determines how many items to display on a page. not sure this will work?

          – robgt
          1 hour ago







          There is already a setPageSize(36) in the collection code, which determines how many items to display on a page. not sure this will work?

          – robgt
          1 hour ago















          Sorry, you're right - I have overseen that, choose the pagesize you need - if you want 36 keep the first one, if you need 200 the last. The difference to your code is that I have removed the "hard" limitation of the entity_ids from - to. I've updated the code and removed the duplicate setPageSize

          – HelgeB
          1 hour ago







          Sorry, you're right - I have overseen that, choose the pagesize you need - if you want 36 keep the first one, if you need 200 the last. The difference to your code is that I have removed the "hard" limitation of the entity_ids from - to. I've updated the code and removed the duplicate setPageSize

          – HelgeB
          1 hour ago















          Thank you. I will have to try this now. What I am hoping is that it will always start displaying products from the most recently added new item down to older items (limited to 200 total products).

          – robgt
          1 hour ago





          Thank you. I will have to try this now. What I am hoping is that it will always start displaying products from the most recently added new item down to older items (limited to 200 total products).

          – robgt
          1 hour ago













          Unfortunately, this pulls in ALL products from the database, and displays 200 per page...

          – robgt
          1 hour ago





          Unfortunately, this pulls in ALL products from the database, and displays 200 per page...

          – robgt
          1 hour ago













          Ok, now I understand: you expect a product list with correct pagination which ends at 200 products. I'll think about that, of course my code can't do that, sorry

          – HelgeB
          1 hour ago





          Ok, now I understand: you expect a product list with correct pagination which ends at 200 products. I'll think about that, of course my code can't do that, sorry

          – HelgeB
          1 hour ago


















          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%2f263503%2fshowing-the-most-recently-added-products-that-are-set-to-display-on-this-website%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

          “%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

          How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

          夢乃愛華...