Magento themes and extensions

Add a link to the product on the admin order page

Share
Posted on May 1st, 2013 | Posted by admin

We recently had a client who asked to have a link added to the magento admin order page so they could easily see what the product was. It requires a core hack so isn’t recommended. If you want to go ahead here’s the code:

Open app/design/adminhtml/default/default/template/sales/order/view/items/renderer/default.phtml at look and at ~ line 68 until you find

1
<?php echo $this->getColumnHtml($_item, 'name') ?>

Replace with:

1
2
<?php $_pullProduct = Mage::getModel('catalog/product')->loadByAttribute('sku', $_item->getData('sku')); ?>
<a target="_blank" rel="external" href="<?php echo Mage::getUrl() . $_pullProduct->getData('url_path'); ?>"><?php echo $this->getColumnHtml($_item, 'name') ?></a>

MAGENTO: UPDATE PRODUCT PRICES GLOBALLY

Share
Posted on April 28th, 2013 | Posted by admin

There are many ways to mass update product attributes in Magento, each well suited to a different purpose. Magento’s built-in mass product attribute updater is great if you want to modify a selection of products or the new attribute value is the same for all products you want to edit. Alternatively, if you wish to alter the attributes in more dynamic ways, updating them programmatic ally via PHP is probably a better way.. The downside to both of these methods is speed, with each product update taking a few seconds to complete. While this time can be dramatically reduced by disabling indexing, the wait can still be too long for a store with a massive catalog. A more efficient way to update product attributes is to write direct SQL queries. As an example, I will show you how to mass update product pricing for all products, products from a certain store and products that use a certain attribute set.

Why would I want to mass update price?

When I was first asked to do this I asked myself the same question, however, the reason is quite simple. In Magento, shipping costs aren’t usually displayed to the user until they enter their delivery address. While this makes sense, the customer usually enters their delivery address during the checkout process, meaning a lot of customers weren’t aware of this extra cost. During a study of one site, I found that almost 30% of customers were leaving the store during checkout and that this bounce rate could almost definitely be attributes to the shipping cost.

How to hide the price for a 0 priced product in Magento

Share
Posted on April 3rd, 2013 | Posted by admin

There are several ways to show the text “FREE” on the product page in case the product price is 0 in Magento you will need to do an if statement inside the view.phtml file located in app/design/frontend/default/YOUR_TEMPLATE/template/catalog/product/view.phtml

You will need to find the

getChildHtml(‘product_type_data’) ?>

and replace it with:

price==0): ?>


getChildHtml(‘product_type_data’) ?>

Get current category or product model in Magento

Share
Posted on February 25th, 2013 | Posted by admin

How to get the current category or product model?

You may use the magento registry class like this:

//Get current category or product
Mage::registry('current_category');
Mage::registry('current_product');

Magento adding downloadable product to cart by coding php

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

Probably you know it’s possible to add a product to the cart via querystring, but may be you prefer code a new module for your needs using Magento objects and methods.

So adding a simple product is easy:

01....
02.
03.$cart = Mage::getSingleton('checkout/cart');
04.
05.// start adding the product
06.
07.try {
08.
09.$cart->addProduct($product, array('qty' => 1));
10.
11.// save the cart
12.
13.$cart->save();
14.
15.$result = null;
16.
17.} catch (Mage_Core_Exception $e) {
18.
19.$result = $e->getMessage();
20.
21.}

But how to add a Downloadable product with its right link ? Just try this, it’s a controller I used to integrate an “add to cart” API:

Page 1 of 912345»...Last »