Magento themes and extensions

Add New Column to Existing Database Table in Magento

Share
Posted on October 7th, 2012 | Posted by admin

While writing codes for Magento, sometimes you would like to add new columns to existing tables in Magento database. These situations arise very frequently in Magento programming. Suppose you want to add a custom ‘referred_by’ column to the items in your wishlist. Magento stores the wishlist items in the ‘wishlist_item’ table. So here we will add ‘referred_by’ column to the table. This column will store the id of the customer who referred a certain product. Now we will see how to add this column to existing ‘wishlist_item’ table. For this you have to create a custom module . Suppose you have created your module ‘Web’ under ‘Company’ namespace. In the sql installer file for this module, we will write the code to add the new column.

Open appcodelocal<Namespace><Module>sql<module>_setupmysql4-install-0.1.0.php
Write following lines in this file:

Magento how to save additional shipping info to Quote during checkout

Share
Posted on October 7th, 2012 | Posted by admin

I’m quite new in magento, I work version 1.6.2.0.
I’m trying to add my own Custom Shipping Method module and I have few problems.
My magento has already custom checkout module – Threestep checkout, what I’m trying to do is save additional shipping info which I choose in 3rd step (Payment and Shipping) (something like Store Pickup place) to Quote, and then in Review retrive Quote data and save it to Order.

I’m using Events to do this:
checkout_controller_onepage_save_shipping_method to save data to Quote
checkout_type_onepage_save_order to save data to Order
The problem is that Quote and Order doesn’t have any free place where i can save my data, so I created installer for my module:

GETTING ORDERED ITEMS AND THEIR DETAIL FROM ORDER ID IN MAGENTO

Share
Posted on October 6th, 2012 | Posted by admin

Here is a small snippet of code, yet useful, to get ordered items and its details. I’ve deviced this code a lot before and posted in Magento Commerce’s Forum as well. But felt like writting it again, so that I can have a quick refrence to it as well. Next thing, I’ve tried a lot to get all orders and their items details by single query, but have not yet come up with a solution. If you have any method of finding order and its details by a single query, then please do response. The code below first needs an order ID as it parameters to give order details.

Magento Default System Configuration Values

Share
Posted on October 5th, 2012 | Posted by admin

his is more of an addendum to my previous articles on the System Configuration system than an entirely new article. Go back and read up if anything’s over your head.

When you create a new System Configuration path, Magento doesn’t store a default value. This is true even for the default stock system configuration. You can confirm this by looking at the core_config_data table.

mysql> select * from core_config_data ;
+-----------+---------+----------+----------------------------+------------+
| config_id | scope   | scope_id | path                       | value      |
+-----------+---------+----------+----------------------------+------------+
...

This table will only store values that have been explicitly set via the Admin Console or other programatic means.

If you request the value of a System Configuration path that doesn’t have a value explicitly set, Magento will check the global config tree for a default value. Although not required, it’s a good idea to set a default value for your custom configuration variables. It’s simple enough to do, and will ensure nothing unexpected happens when a blank value is retrieved for your config variables.

How can i change Magento inventory settings to website scope instead of global?

Share
Posted on October 4th, 2012 | Posted by admin

We have a multi-store setup with magento operating across multiple domains. Some of these websites are wholesale b2b websites and some are retail b2c websites.

We have a different price per retail and wholesale websites (which was easy to do in magento config) we do this as we force wholesale customers to purchase in multiples by using the magento minimum allowed in cart and must be bought in multiples inventory features. However we cannot seem to switch this off for the retail stores.

We would also like to allow backorders on wholesale website but not on the retail ones and this setting is also set to global and we cannot change it to website.