No Comments

$salable = $product->isSalable() – I need to determine what's Salable in an array

Magento Cron Does Not Generate Schedule
Magento2 page-footer (luma-theme)

I’m using an array to pull all the ids/skus in a category page. The problem is it’s pulling everything… I only want to show the ids/skus that are on the page. I need to sort out everything that is disabled and or no stock and everything that’s not on the page.

Here’s what I have:

if ($module === 'catalog' && $controller === 'category' && $action === 'view') {
          $category = Mage::registry('current_category');
          $category->load($category->getId());
          $prodCollection = $category->getProductCollection();
          foreach ($prodCollection as $product) {
          $prdIds[] = $product->getId();
          }

          $data['u2'] = implode(',', $prdIds);

          // Category ID
          $data['u6'] = $category->getId();

          // Category Name
          $data['u7'] = $category->getName();

          // Page Type
          $data['u14'] = 'Category';


}

$data[‘u2’] is pulling everything… it should only pull whats on the page and isSalable.

please see screenshotenter image description here

Related Posts

  • Push an array of all sku's on a category page into my $data = array(); (0)
    I want to list all sku's on a category page in a data array. Currently if i'm on a product detail page i can push the sku into my data array like this: if ($module === 'catalog' && $controller === 'product' && $action === 'view') { $product = […]
  • Module action returns 404 (1)
    I am making a module that adds a button to the Admin order view and allows the user to create a shipment and invoice (among others) once this button is clicked. I have used an observer to add the button and get the current order_id. I also used setLocation to the onclick parameter […]
  • Adding new page to Front end (2)
    UPDATED I am trying to add new page on front end. I am doing as following. I have a form, where I am using my action to load the view. On button click it never goes to controller, please help me, what I am doing wrong. My form is as <div id="abc-category-search"> […]
  • Magento2 cannot enable product (0)
    I setup a Magento 2.0.4 website, added some products and then gave access to the store owner to add remaining products. Some of them were added using duplicate function and were disabled by default. In PRODUCTS => CATALOG I selected them, clicked on ACTIONS => CHANGE STATUS => […]
  • Move disabled products at bottom in merchandising extension (0)
    I am using mechandising extension in this extension I have done to display most viewed products order by view counts and out of stock products at bottom but facing problem to display disabled products at […]
  • How to get Available Product Listing Sort By category data on front end? (1)
    I want to show Product listing sort data on left side on catalog page on front-end. Mage::getModel('catalog/category')->load('CATEGORY ID')->getAvailableSortBy() returns empty array and if i manually select each sort option from category then it prints array with options .
  • Opinion on setting products visibility on category product indexer (0)
    first things first, I'm trying to come up with a way to hide products from catalog with stock availability below min_qty (website scope), but I'm using a third-party multi-stock module which disables the Display Out of Stock Products functionality (availability attribute being global […]
  • Products not loading in Categories page (0)
    My Category page doesnt seem to load up with categories products. I have overridden my template files(using custom theme method) and they seem to be called! This is what i get: ('TAG' is just to confirm if my theme is calling) I feel the problem is in my layouts/templates. […]
  • B2C/B2B website – Best practices and feedback (0)
    I am developing a Magento 1 store which caters to 80% B2C and 20% B2B and I'd like to hear your opinion and experiences about what is the best way to go regarding stores vs website vs customer group layout handle. My requirements look like this: Same products with different […]
  • How to sort product collection on stock status (1)
    I want to sort product collection on category page so that the in stock products shall appear before out of stock products. All the out of stock products will be displayed after the in stock products. I have already rewritten the Mage_Product_Block_List block. After rewriting I have […]
Magento Cron Does Not Generate Schedule
Magento2 page-footer (luma-theme)

Be the first to post a comment.

Add a comment