62 votes
Accepted

Why Can't I Load a Product by SKU using loadBySku()?

// This method does not work (Of all, I expect this to work) $product = Mage::getModel('catalog/product')->loadBySku($sku); This is because the method Mage_Catalog_Model_Product::loadBySku does ...
user avatar
  • 6,770
55 votes

Magento 1.9, php 5.6 - Use of iconv.internal_encoding is deprecated

You can use the following patch: 0001-BUGIFX-Magento-Zend-Framework-1-PHP5.6.patch It is from the full Github-Gist: Bugfix for Zend Framework 1 in Magento (>= 1.7..) + PHP 5.6 https://gist....
user avatar
  • 14.7k
37 votes
Accepted

How to send email using Magento

simple function to send the email in magento <?php public function sendMailAction() { $html=" put your html content here blah blah "; $mail = Mage:...
user avatar
36 votes
Accepted

How can I fix "Item (Mage_Catalog_Model_Product) with the same id "xxx" already exist"?

Adding the distinct as suggested in the accepted answer does fix the problem but it has performance issues. The database might create temporary tables on disk when executing a query with distinct and ...
user avatar
  • 1,414
33 votes
Accepted

Magento : Fastest way to update a product attribute

The fastest way is to do direct selects and inserts/updates in the database, but that's not the safest. You can easily break stuff. I use the Mage::getSingleton('catalog/product_action')->...
user avatar
  • 195k
32 votes
Accepted

difference between cart getItemsCount() and getSummaryCount()

Mage::helper('checkout/cart')->getItemsCount() -- return shopping cart items count means how many sku add to shopping cart. Mage::helper('checkout/cart')->getSummaryCount() -- return shopping ...
user avatar
  • 34.3k
30 votes

Magento : Fastest way to update a product attribute

Actually there are 3 ways to update an attribute on a product without save the full product. Depending on the code/requirements one can be faster that the other. Method 1: $product = Mage::...
user avatar
  • 6,855
28 votes
Accepted

What is the difference between getChildHtml and getBlockHtml

getBlockHtml('block_name_here') get's you the html of the block with name block_name_here if it finds it in the layout...anywhere. getChildHtml('block_name_here') get's you the html of the block with ...
user avatar
  • 195k
28 votes

Confusion with order id, order increment id and I am not getting order id as 20001201

id = the sales_flat_order table primary key value. This is autoincremented for each order you get in your shop. It usually starts from 1 and goes up. increment id = a "user friendly" number generated ...
user avatar
  • 195k
28 votes
Accepted

programmatically adding product to cart returns empty price

There are many things wrong here and I feel compelled to do a code review with you. See the end for the correct approach. Code review: This line is loading a product with an undefined $sku var: $...
user avatar
  • 35.6k
25 votes
Accepted

How to move magento shop to another server

The following procedure describes the basic needs for moving your magento-shop to another server. There might be additional things to consider (changing domains, DNS, PHP-Configuration, tools & ...
user avatar
  • 17.2k
25 votes
Accepted

Where can I edit the information displayed on my magento store?

The most relevant parts for you in this case are: Template file (.phtml) and Blocks While the template files include the basic HTML output, which is a combination of PHP and HTML (thus .phtml), the ...
user avatar
  • 17.2k
25 votes

I cannot redirect to another page when i click on the button?

Your button contains onclick="document.location.href='http://www.labwise.in/devel/vaccination-details';". This means that when clicking on it, you will get redirected to http://www.labwise.in/devel/...
user avatar
  • 195k
24 votes
Accepted

Confusion with order id, order increment id and I am not getting order id as 20001201

The difference is: order_id is the internal Magento order ID order increment ID is the ID which you communicate to your customer You can easily load an order using the internal order_id: Mage::...
user avatar
  • 4,660
23 votes

Why Can't I Load a Product by SKU using loadBySku()?

I tested execution time for the various methods I've seen to load a product by SKU. This is the most efficient: $product = Mage::getModel('catalog/product'); $product->load($product->getIdBySku(...
user avatar
  • 433
23 votes

Where can I edit the information displayed on my magento store?

These are all located in your theme directory. If looks like you are talking specifically about the product details page, so the main one to change would be located in your themes catalog/product/...
user avatar
  • 3,363
19 votes
Accepted

what is the difference between disable module output and module active = true

System > Configuration > Advanced > Disable Modules Output will not actually disable that module. It work as the name suggest, disable modules output. When you look at abstract class ...
user avatar
  • 17.5k
18 votes
Accepted

Magento 1.9, php 5.6 - Use of iconv.internal_encoding is deprecated

I don't think you are supposed to use Magento with php 5.6 yet. I assume there will be an official statement when Magento will support php 5.6 and an offical patch if necessary.
user avatar
  • 195k
18 votes
Accepted

Helper vs Model? Which should I use?

First you must ask yourself what is the difference between a model and a helper. The most common answer is "a model has a table behind it". Then ask yourself "why are Observers listed as models and ...
user avatar
  • 195k
17 votes
Accepted

How i can fix error Invalid backend model specified

In the table eav_attribute find rows with the field backend_model equal to given model and temporary remove them or change the model to the name of the existing class.
user avatar
  • 6,490
17 votes

Magento 1.9, php 5.6 - Use of iconv.internal_encoding is deprecated

You need to change lib/Zend/Validate/Hostname.php and replace the internal_encoding related calls with ini_get('default_encoding') and all the other occurences in the Zend framework also...
user avatar
16 votes

'Ground' not appearing in FedEx shipping method magento

I had the same issue. After turning just about every option on and off. I figured out that if the field for "Residential Delivery" is set to 'Yes'. Ground is turned off, but you can select "Home ...
user avatar
  • 161
16 votes
Accepted

clear shopping cart is not working

In your theme directory, in the file: /app/design/frontend/yourthemepackage/default/template/checkout/cart.phtml or in the file: /app/design/frontend/default/yourtheme/template/checkout/cart....
user avatar
16 votes

How to enable https for my magento site

You need to change. In the same tab check Offloader header value is SSL_OFFLOADED If you want to use ssl for all pages, then need to change Base unsecure Url
user avatar
  • 75.6k
16 votes

Magento hacked even after applied patch

It seems your Magento setup is still compromised at some point so you should carefully check Magento + Webserver settings. You cannot trust your installation if it was compromised. The ultimate way ...
user avatar
  • 17.2k
15 votes

How display success message after submit the form

In php this type of work implement on session variable. Magento is doing by set success message using ->addSuccess('YOUR MSG');. and set error message using ->addError('YOUR ERROR MSG') ...
user avatar
  • 75.6k
15 votes
Accepted

how to re-install custom module in local with sql script

in your custom module's sql folder their is a folder with yourmodule_setup,you have to delete yourmodule_setup record from the core_resource table and just refresh the browser your script will run ...
user avatar
15 votes

Why is CSRF protection needed for add-to-cart?

I believe it will be difficult to source a definitive answer to this question of why a CSRF token is "needed" in Magento's add to cart GET action. I'll make an attempt to interpret its purpose. I'm by ...
user avatar
  • 1,952
14 votes

How display different price per store

You can do this on a per website basis. To do so, you need to go to System->Configuration->Catalog->Catalog. Then in the tab "Price", set price scope to Website instead of global. On the ...
user avatar
  • 4,660
14 votes
Accepted

How to set proper permissions for Magento on server?

Please check and verify below steps: Check if your server is compatible with Magento. Download file from this link Magento Server Compatibility check and follow the instructions given. Check for the ...
user avatar
  • 3,554

Only top scored, non community-wiki answers of a minimum length are eligible