Showing out-of-stock products

If you want to also show products that are out of stock in your Clerk.io results, you can easily control this in the Magento backend.

Start by going to:
System -> Configuration -> CLERK -> Settings

Choose your Store View from the left menu, and go to Clerk Settings.

In here, set Include Out Of Stock Products to Yes and click Save Config:

Finally, go to my.clerk.io -> Data and click Start New Data Sync to import all products, including ones that are out-of-stock.

Advanced changes

In Magento, the following file controls which products are imported to Clerk.io:

app->code->community->Clerk->Clerk->Model->Catalog->Product.php 

In the bottom of this file, locate the function called setExcludeReason()

Each if in this function checks a Magento attribute to control whether a product should be imported in Clerk.io or not.

For example, if you want to be able to display products that are out of stock, simply remove the following line.

if (!$this->isSalable()) {
   $this->excludeReason = 'Product is not saleable';
}

If you do this, we strongly recommend that you also add an extra attribute to this file, which indicates when a product is not saleable, so you can show it in your Design.

Assuming you create an attribute called is_saleable which is either true or false, you can use it like this in Designs:

{{#if is_saleable}}
   <div class="in-stock">In Stock</div>
{{else}}
  <div class="not-in-stock">Not In Stock</div>
{{/if}}

Finally, go to my.clerk.io -> Data and click Start New Data Sync to import your new data.

Did this answer your question?