Magento themes and extensions

Join custom table to product collection in magento

Posted on November 6th, 2012 | Posted by admin

For your custom module if you want to join your custom table data with Magento default product collection then you need to join tables with the entiry_id of the product and your product_id stored in your custom table. Here I have just used the resource model collection to join the table. I tried with getmodel feature of Magento don’t know why it doesn’t able to create the Product grid in the backend. So I used resource model and it worked. If you are only joining the table, not to generate the Product grid, then you can use getmodel instead of resource model.

$collection = Mage::getResourceModel('catalog/product_collection')
                ->addAttributeToFilter('type_id', array('eq' => 'simple'))
                ->addFieldToFilter('status', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)
                ->addAttributeToFilter('visibility', array('neq' => 1));

$collection->getSelect()->join(array('mep' => "mage_brand_product"), "e.entity_id = mep.product_id", array('mep.*'));

Get database connection details in Magento

Posted on November 5th, 2012 | Posted by admin

I am writing here an important code snippet for getting the database connection details used in Magento

$config = Mage::getConfig()->getResourceConnectionConfig("default_setup");
$_host = $config->host;
$_uname = $config->username;
$_pass = $config->password;
$_dbname = $config->dbname;
echo $_host; ///likewise

Adding your custom module to Magento’s Admin Global Search

Posted on November 4th, 2012 | Posted by admin

When creating a custom module in Magento, have you ever wanted to add custom search functionality to the Magento admin area, allowing users to search your module? Today I will attempt to show you in the most simple of terms how you can achieve this and add to Magento’s global search.

For this example I will be using a custom module called Matt_Car, a fictitious module that may contain information on a car and output on the store front. We will be adding functionality to search by car name or brand within Magento’s admin area global search box.

I will assume you’ve already created a custom module, as this will be the module you are searching, but your module declaration should look something like…

How to import configurable products from CSV File into Magento System

Posted on November 3rd, 2012 | Posted by admin

Unlikely the default Magento import module, this fully customizable bulk import module allows you to import configurable products through CSV feed.
Module features:

  • Import from CSV feed
  • Create CSV for import
  • Import configurable products and their associated simple products.
  • Import images / multiple images / gallery images from remote server.
  • Supports cron job
  • Copy the file Productwithconfigurablesandcategories.php located in (file attached to this post) to the folder /app/code/core/Mage/Catalog/Model/Convert/Adapter/.

How to Import Products into Magento

Posted on November 2nd, 2012 | Posted by admin

There’s a little confusion among some on how to import products into a Magento ecommerce store. I spent some time today researching and trying to find the best method on doing this. The reason for my research is because there was no simple documentation anywhere that I could find on how to import products. Magento actually has built a pretty robust import/export mechanism into the ecommerce cms that has a ton of flexibility to do many things. I’m not going to cover all of those. This is just for those of you who simply just want to import products into their Magento cart.

Step 1 – Add a new product manually
add a new product manually to the catalog, assign it to a category, and fill out all fields that will be necessary to your store. The obvious ones are price, description, quantity etc. It’s important that you fill out all fields that you know you are going to need for all the products you import.