Articles tagged with: product
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.
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.“.
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:-
Products can be of different types in Magento. The different product types are Simple Product, Configurable Product, Bundle Product, Grouped Product, Downloadable Product, and Virtual Product. For example: Chair can be a Simple Product. Shoes can be of different color and size. So, shoes falls under Configurable product. A downloadable mp3 music file will fall under Downloadable product.
The following code shows how to fetch product collection by particular product type, i.e. fetching all products which falls under a particular product type. If I want to fetch all Configurable …
Suppose, you have the product data, i.e. you have a loaded product information stored in a variable named ‘$_product‘. Now, when you type $_product->getManufacturer() , you will get the manufacturer ID. To get the manufacturer name, you have to use the following: $_product->getAttributeText(‘manufacturer’). Below is the complete code:
Get Manufacturer Name and ID from Product
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 comma separated way. So, to filter product collection by more than one category, you have to use:
This article shows how to get sub categories of a particular category and the number of products (product count) present in the sub categories.
Suppose, you have a category named Furniture. The sub categories under Furniture are Living Room and Bedroom. Now, you want to show the sub categories under Funiture and the products associated with the sub categories (Living Room and Bedroom).
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:
While editing product programatically from frontend. I was trying to change the status of the product with the following code. I was trying to disable the product. Status value 2 = Disabled.
// Trying to disable the product
// $product->getId() = PRODUCT ID
This article shows how you can fetch all the categories related/associated with a particular product.
$product->getCategoryIds() function gives array of category ids with which the product is associated to. We can loop through this array and load each category to get the category name and url.
Different stores can be set in Magento. A product can be made visible in selected stores.
* get store id
$storeId = Mage::app()->getStore()->getId();
* call the Magento catalog/product model
* set the current store ID
* load the product
$product = Mage::getModel('catalog/product')
Hope it helps. Thanks.
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.
Almost one year back, I had problem with the product display in Zen-cart. I searched for help in zen-cart forum. I started a topic over there. But at last, I myself had to post the solution on that thread.. coz, I found the solution. ;) I just wanted to include that problem and solution in this post.
My problem was:-