November 2011

Custom Add to Cart button on CMS Page in Magento

Magento provides an easy way of adding products to shopping cart via query string. To create a simple add to cart button on any magento’s CMS page open it in WYSIWYG editor and the following HTML to its contents:

<button onclick=”location.href ={{config path=”web/unsecure/base_url”}}/checkout/cart/add?product=1&qty=1′”>
Buy It Now</button>

Save the page and refresh the cache. Now if you open the page in you should be able to see “Buy It Now” button. When clicked it adds 1 product with ID=1 to your shopping cart.

Magento Checkout Success Page - Order Details, Product Price, SKU retrival

    $_customerId = Mage::getSingleton('customer/session')->getCustomerId();
    $lastOrderId = Mage::getSingleton('checkout/session')->getLastOrderId();
    $order = Mage::getSingleton('sales/order'); 
    $_totalData =$order->getData(); 
    $_sub = $_totalData['subtotal'];
    //USD ==> global_currency_code,base_currency_code order_currency_code
    //print_r($order); print_r($_totalData);
    $_order   = $this->getOrder();
    $allitems = $order->getAllItems();
    $index    = 1;
    $data   = "";//Needed format ==> &ITEM1=3

A Javascript Playground - JsFiddle

JsFiddle is a playground for web developers, a tool which may be used in many ways. One can use it as an online editor for snippets build from HTML, CSS and JavaScript. The code can then be shared with others, embedded on a blog, etc. Using this approach, JavaScript developers can very easily isolate bugs. We aim to support all actively developed frameworks - it helps with testing compatibility.

Cannot Enter Credit Card Details at Checkout in IE9 - Magento

With the release of IE9 there was a sigh of relief for the web developers. Finally Microsoft released a browser that promised adherence to W3C standards and the cessation of compatibility headaches. However, not everything is rosy.

Insert a block programmatically with Drupal

Block is generated by a view

$block = module_invoke('views', 'block', 'view', <view_name not quoted: this is The unique identifier of the view>);


$block = module_invoke('views', 'block', 'view', list_all_providers_cat_map);
print $block['content'];

The above does work for Drupal 5 but it doesn;t look like is working for Drupal 6 so you can just embed the view.