Articles tagged with: product
Magento »
Here is a quick code to get any product’s stock information like quantity (qty), minimum quantity (min_qty), stock availability (is_in_stock), minimum and maximum sale quantity (min_sale_qty and max_sale_qty), etc. First load the product. Product can be loaded in different ways. Here are the two different ways to load any product in Magento:-
Magento »
Here is a quick and useful code on getting actual price and special price of any product in Magento. The actual price is the real price assigned to the product and special price is the price after any discount is applied to the product. Loading Product
Magento »
Here is a quick tip to sort/order latest product by both created date and new from date. Created At date is automatically added when you add a new product. However, you have to set New from Date manually while adding or editing product. You may have product with same new from date. And, then you [...]
Magento »
Scenario: I have changed my product’s Visibility to ‘Nowhere‘. But still the product is visible in both catalog and search. I have refreshed cache but the problem is still there. Cause:
Magento »
Scenario: I have a fresh installation of Magento 1.4. I already have installed the sample data for Magento. Now, when I go to the category listing page, no products are displayed. It says “There are no products matching the selection.“.
Magento »
Here, I will show you the code to get the most viewed products in Magento. The function addViewsCount() filters the products with their views count. Here is the code:-
Magento »
Here, I will be showing how you can get product collection from product type i.e. simple, configurable, bundle, grouped, and virtual. Here is the code:-
Magento »
Suppose, you have the product data. You can get product from either of the following way:- $_product = $this->getProduct(); OR,
Magento, MySQL »
Suppose, you have a product collection and you want to filter it by category. Suppose, you want to filter it by more than one category. You can use addCategoryFilter if you have only one category. But, what if you want to filter by more than one category? Category ids are stored for product in a [...]
Magento »
Here, I will be showing you the code to get sub categories of a particular category and the number of products (product count) present in the sub categories. Like, I have a category named Furniture. The sub categories under Furniture are Living Room and Bedroom. Now, I want to show the sub categories under Funiture [...]
Magento »
Difference between backorder and pre-order A backorder is for an item that was in stock previously but is temporarily out of stock. A pre-order is for an item that has not been released yet. Scenario for backorder:
Magento »
Scenario: While editing product programatically from frontend. I was trying to change the status of the product with the following code: Mage::getModel(‘catalog/product’)->load($product->getId())->setStatus(2)->save();
Magento »
$product->getCategoryIds() gives array of category ids which the product is associated to. We can loop through this array and load each category to get the category name and url.
Magento »
Different stores can be set in Magento. A product can be made visible in selected stores.
Magento »
Scenario: A simple product is associated with a configurable product. You have the id of the simple product. Now, you need the id of the configurable product with which the simple product is associated. Get parent product id, i.e. get id of configurable product from a simple product.
