magento sql query to set a base image for any products that do not have one set

Posted on February 28th, 2013 | Posted by admin

I had to do some work on a Magento site today, where the site admin had added images to all the products, but had not set any of them as base, small, or thumb images – so none of the listings were showing an image on the front end. I googled for a SQL query to do the job, and found none – so I knocked this one up – maybe someone else will find it useful.

The queries do not affect any products that already have the respective values already set.

Magento : Get Upsell products list using Product Id

Posted on February 27th, 2013 | Posted by admin

Magento : Get Upsell products list using Product Id
In some situation when you need to show procuct in custom location file and in that file you also wanna show list of upsel product then this is example which will explain you.
For Example : Suppose you have Product ID and using that ID you want to accees upsell procust list then you can use following code :

1. Assume that you have product ID is : $product_id

2. Using that ID you can get list of Upsell product. Copy following code and place it in you custom file.

Getting and Setting Session Variables in Magento

Posted on February 26th, 2013 | Posted by admin

Working in the Magento ecosystem can seem daunting at first. Even experienced PHP programmers have a steep learning curve to work through before they really get the sense that they know what they are doing.

One thing that is very easy to do in regular PHP programming is setting a session variable. All you really have to do is set the variable in $_SESSION and you are good to go. In Magento, you probably could do it this way, but you would probably get this feeling that you are doing it incorrectly (and you would be correct).

Luckily, setting session variables in Magento is only difficult until you see it once, and then it is just as easy as setting the variable in $_SESSION. As long as you know how to set variables on an object, you can set a session variable. Look at the following code:

Get Price Including Tax In Magento Programmatically

Posted on February 25th, 2013 | Posted by admin

If you ever wanted to display Prices including VAT/Tax on list.phtml or view.html files in Magento programmatically this snippet may help ya!

echo $this->helper('tax')->getPrice($_product, $_product->getPrice(), true);

Removing Top or Bottom Price on Magento Product Page

Posted on February 23rd, 2013 | Posted by admin

If you set up configurable products in Magento , you will notice that the product page now has the price listed twice: once at the top of the product page and a second time below the configurable product options. This post details how to remove the top and / or the bottom price display.

To remove the top price display:
1) Open /app/design/frontend/default/THEME/template/catalog/product/view/type/configurable.phtml.

2) At the bottom of the file, add the following code:

Page 1 of 3123»