Magento Development. Design. Integration.
(888) 897-7775

Archive for the ‘Magento Code Snippets’ Category

How to Properly Add an External JS/CSS file to Magento

How to Properly Add an External JS/CSS file to Magento

Magento code snippet showing the proper way to add an external Javascript or CSS file links to your Magento theme’s layout files without any additional files or extensions and without any direct template files hacks. This method is simple, easy and works every time.

Read more

How to Check for HTTPS in Magento phtml Files?

How to Check for HTTPS in Magento phtml Files?

These days our eCommerce pages are littered with third party social bookmarking tools, social media tools, facebook like buttons, add this buttons, and third party marketing scripts. It is easy to lose track of the most basic aspect of your shopping carts’ security: valid HTTPS pages. Here is a quick way to isolate all of these third party utilities and simply avoid using them in the HTTPS pages:

Read more

Add Custom Tabs to Product Edit page in Magento Admin Panel

Add Custom Tabs to Product Edit page in Magento Admin Panel

Just a quick note this time on a great way to introduce tabs into the product edit page in the Magento Admin panel: via the Observer. The full guide is posted on the custom tabs for magento product admin page on fishpig (a UK Magento Company).

Read more

Fix for Multi Store View Bug in Magento

Fix for Multi Store View Bug in Magento

There is a pretty nasty bug in Magento if you are using multi store view with configurable products. I have recently patched it nicely with an extension that overrides the original controller method. This is a much nicer fix than actually hacking the core files which can then break in the next upgrade.

Read more

Retrieving the Collection of Enabled Grouped Products in Magento

Retrieving the collection of enabled grouped products in Magento, programmatically. Also note that various options available.

Read more

Bulk Copying Product Attributes in Magento

This static method can copy attributes between products in Magento very fast and relatively secure. We are bypassing the main Magento architecture and accessing the Database directly, but notice we are using the Zend framework for the db query and we still use DB transactions. It accepts the source product ID (not SKU), destination product ID, the array of attribute codes (‘size’, ‘color’, ‘name’, etc.), and the attribute type (‘varchar’, ‘int’, etc.).

Read more

How to Change Index Status to REINDEX REQUIRED in Magento

How to Change Index Status to REINDEX REQUIRED in Magento

Indexing and index processes were introduced in Magento since version 1.4.x. Here is how you can set one index to ‘REINDEX REQUIRED’ with code programmatically.

Read more

How to Avoid the ‘___from_store’ Query Parameter When Switching Store Views in Magento

This is a simple fix that makes a big difference. For some reason it is set to show up by default, however some websites that are sensitive to SEO or want to avoid this parameter so you do not get any weird values in Google Analytics or any other Analytics that you may be using, here is how to remove the ‘___from_store’ query string:

Read more

How to Get the Base Url for a specific Magento Store View

This article contains code snippets for getting the base url for a specific magento store view in a multi store view setup. I also point out how to get the default baseurl for the current running store and what are the different types of base urls that you can retrieve at any given time.

Read more

How to Show a Magento Collection’s Select Query

This is maybe one of those things that I end up researching almost every time that I need (more…)

Read more
Page 1 of 212»