How to Filter Out Of Stock Products?


In today’s blog, we are talking about Magento 1 out of the stock filter.

If you want to filter a product collection to show only items that are in stock then you can use many ways but if you want that collection specifically via the Join Field method then you should definitely check the below code.

This code is designed by Magento certified developer. Every Magento expert use this to customize this to manage their products.


    'product_id=entity_id', array(
	    'stock_status' => Mage_CatalogInventory_Model_Stock_Status::STATUS_IN_STOCK,    
	    'website_id' => $websiteId

  • $collection – This variable contains the object of the product collection.
  • $websiteId – Here, you need to assign current website id of your store

Encrypting passwords is not an easy task but extremely important to save the database from threats or data leakages. Hackers can easily do MySQL decrypt passwords by using designed algorithms and techniques.

Quick Tip:- Learn to Set Rest API with Example in Magento 1

To protect the decryption of passwords, hashing is techniques that can be implemented so that predicting a value, which will produce a given hash, cannot be achieved easily.

Security is essential for all types of eCommerce business. Magento website development companies and Magento certified developers worked to improve secure structure first. That is the reason to develop various secure functionalities like this.

Hash options such as SHA256 or SHA1 can be used to increase the security of the passwords. Using PHP inbuilt functions of encrypting the passwords along with algorithms to encrypt the data in the database.

User’s login password hash can be used as a key and in case the user forgets the password, database admin can use this hash key to MySQL decrypt the password and create a new pin and new hash for an updated password can be used to re-encrypt the data.

An extensive library of PHP programming language offers various functions to the users to perform a task without coding. In PHP convert date to timestamp, inbuilt function strtotime() can be used to convert the date formats into time and it is the number of seconds from 1st January 1970 to date in UNIX format.

Syntax of the function is:

strtotime(time, now)

time is the specific date or time string and now is the optional parameter used as a base for calculation of the output.

Below is the example code for the function:

The output of the above is 1581292800.

Daterangepicker is an interface provided to the user the select the dates according to the requirements. It offers to select days, week, month, quarter, or year calendar modes and to enter custom ranges to get the specific output.

It has integration with the jQuery and knockout and uses extensive methods to get the desired screen.

Methods used in daterangepicker are mainly included setStartDate and setEndDate, which can be done through programming as well.

These methods provide shortcuts to the developers and their functions and properties can be used by using the data elements assigned to each of them.

Syntax of these functions are:

setStartDate(Date or String): it sets the date of the picker selected date as the start date.
setEndDate(Date or String): it sets the date of the picker selected date as the end date.

Many events associated with the daterangepicker can be used which is available in the pre-defined library such as showCalendar, hideCalendar, cancel.daterangepicker or apply.daterangepicker, etc.

To generate the daterangepicker, a pre-defined configuration screen is available for the developers to select the option and add on the screen.

PayPal is a widely used application for making payments and its high-performance help the individuals and business owners to deal easily in different currencies.

Sometimes, people face issues related to login or using the different features of PayPal and one of the common errors thrown by the application is “10002 PayPal error” and it is a security error that conveys that information entered on the header is not correct while making payments.

There could be two reasons for it:

1. Credentials of the user are not entered correctly, which might be username or password. Any extra spaces, characters or typing errors may lead to this error. Users can try again with the right information.

2. A user account in live or test mode does not coordinate the shape live or test mode. Check-in PayPal to create beyond any doubt the account is in Live mode and make beyond any doubt your Soapbox shapes coordinate (test shapes with Sandbox account accreditations, live shapes with live account qualifications).

To avoid 10002 PayPal error, better to remind or save the credentials in the device.

Tier pricing magneto is a useful feature, instead of changing the price of each product, products can be categorized on the basis of factors and conditions can be written in one go.

To exemplify the fact, to give a quantity discount to the same category of products, tier pricing helps to mention it once and it will show automatically on every product.

To achieve it in the magneto, below steps can be followed:

1. Open the product in edit mode and in the pricing field, click on advanced pricing.

2. In the tier price option there are multiple options, click on the “Add” button to add the discount on all the tiers at once.

3. For each tier, website, customer group quantity and price can be entered. Price can be fixed, or a discount can be offered on a specific quantity or a range.

To the user the other options, select the fields website or customer group and the same steps can be followed to apply the tiered pricing. It is the common marketing techniques to increase sales through tier pricing.

Magento 2 templates are the main parts of the view layer and define the layout for the content on a page including the CSS pages and elements grouping.

It does not contain any logic but to add the design on the screen. Default templates are the best option to use and in case it needs to change, changes can be overwritten with the new version of the software.

Ultimo magneto theme, Porto, shopper, fastest are launched by magneto on a paid basis. Users need to pay the cost for a license either on a monthly or yearly basis.

USPS AfterShip tracking provides live updates to its customers and it is a reliable service for more than 100 business partners. It involves the customers after sales with delivery confirmation messages.

Imported shipments from shopping carts are made easy for the clients and multiple tracking numbers can be checked in one go.

About the author

I’m Magento Certified Developer having quite 5 years of commercial development expertise in Magento as well as in Shopify. I’ve worked primarily with the Magento and Shopify e-commerce platform, managing the complexities concerned in building e-commerce solutions tailored to a client’s specific desires.

Related Posts

Leave a Reply