It’s pretty weird thing that Magento doesnt extract “?>” but does extract “<?php” and so for this purpose you just substitute “]]> Hope it helps someone to save some time :) SyntaxHighlighter.defaults['toolbar'] = false;SyntaxHighlighter.config.bloggerMode = true;SyntaxHighlighter.all();if (window.jstiming) window.jstiming.load.tick(‘widgetJsBefore’);if (typeof(BLOG_attachCsiOnload) != ‘undefined’ && BLOG_attachCsiOnload != null) { window['blogger_templates_experiment_id'] = “templatesV2″;window['blogger_blog_id'] = ’32637828′;BLOG_attachCsiOnload(‘item_’); }_WidgetManager._Init(‘http://www.blogger.com/rearrange?blogID=32637828′,’http://fahdshariff.blogspot.com/2011/03/upgrading-to-syntaxhighlighter-30.html’,’32637828′);_WidgetManager._SetPageActionUrl(‘http://www.blogger.com/display?blogID=32637828′,’APq4FmDdmaO1E0AiAntKEHoCeCo1IIbMkhFh8aoj7ANUfzSEK9xRLZIjujI7Ey_m-z4NBCPLh4eEBbhU0zJmXPhGaJLNBnDKBg==’,'AOuZoY5th5qGHtR4Wpx2476uNklp-eN74Q:1320253700709′);_WidgetManager._SetDataContext([{'name': 'blog', 'data': {'title': [...]
How to paste sample php code into field comments of system.xml
by Tykhon Dziuban on December 9, 2011 in Magento development
How to get current store’s timestamp
by Tykhon Dziuban on December 2, 2011 in Magento development
Just use the method below – you dont need any other tricks to play: $currentTimestampProper = Mage::getModel(‘core/date’)->timestamp(time()); P.S.: This simple method proved its reliability on my very own practice ;) SyntaxHighlighter.defaults['toolbar'] = false;SyntaxHighlighter.config.bloggerMode = true;SyntaxHighlighter.all();if (window.jstiming) window.jstiming.load.tick(‘widgetJsBefore’);if (typeof(BLOG_attachCsiOnload) != ‘undefined’ && BLOG_attachCsiOnload != null) { window['blogger_templates_experiment_id'] = “templatesV2″;window['blogger_blog_id'] = ’32637828′;BLOG_attachCsiOnload(‘item_’); }_WidgetManager._Init(‘http://www.blogger.com/rearrange?blogID=32637828′,’http://fahdshariff.blogspot.com/2011/03/upgrading-to-syntaxhighlighter-30.html’,’32637828′);_WidgetManager._SetPageActionUrl(‘http://www.blogger.com/display?blogID=32637828′,’APq4FmDdmaO1E0AiAntKEHoCeCo1IIbMkhFh8aoj7ANUfzSEK9xRLZIjujI7Ey_m-z4NBCPLh4eEBbhU0zJmXPhGaJLNBnDKBg==’,'AOuZoY5th5qGHtR4Wpx2476uNklp-eN74Q:1320253700709′);_WidgetManager._SetDataContext([{'name': 'blog', 'data': {'title': 'fahd.blog', [...]
Creating a new user role programmatically
by Tykhon Dziuban on December 1, 2011 in Magento development
I’ve been working recently on one enhancement which has involved role creation programming. So, today im sharing my knowledge of that process with you :) First of all id like to mention that all the code that you might need to use in the future is already somewhere in the core files, as a rule, [...]
How to determine which module, controller and action are loaded now?
by Tykhon Dziuban on November 11, 2011 in Magento development
Just like in the previous article – here ive decided to gather all 3 enquiries for determination of currently loaded module, controller and action names. 1) Current Module name: $request = Mage::app()->getRequest(); $request->getModuleName(); 2) Current Controller name: $request = Mage::app()->getRequest(); $request->getControllerName(); 3) Current Action name: $request = Mage::app()->getRequest();; $request->getActionName(); SyntaxHighlighter.defaults['toolbar'] = false;SyntaxHighlighter.config.bloggerMode = true;SyntaxHighlighter.all();if (window.jstiming) [...]
Getting grand total values on cart, checkout and success pages
by Tykhon Dziuban on November 10, 2011 in Magento development
Ive decided to combine different methods for different pages of the buying process in one article here. 1) Shopping Cart page: $grandTotal = Mage::getModel(‘checkout/cart’)->getQuote()->getGrandTotal(); 2) Checkout page: $grandTotal = Mage::helper(‘checkout’)->getQuote()->getBaseGrandTotal(); 3) Sucess page: $order = Mage::getModel(‘sales/order’)->loadByIncrementId(Mage::getSingleton(‘checkout/session’)->getLastRealOrderId()); $grandTotal = $order->getGrandTotal(); SyntaxHighlighter.defaults['toolbar'] = false;SyntaxHighlighter.config.bloggerMode = true;SyntaxHighlighter.all();if (window.jstiming) window.jstiming.load.tick(‘widgetJsBefore’);if (typeof(BLOG_attachCsiOnload) != ‘undefined’ && BLOG_attachCsiOnload != null) { window['blogger_templates_experiment_id'] [...]
How to control configs of other modules via your system.xml
by Tykhon Dziuban on November 9, 2011 in Magento development
All you need to do is just set and do all the necessary routine in it just like in the sample codes below: Enable some option select modulename/path_to_your_model adminhtml/system_config_source_yesno 1 1 1 1 class Your_class extends Mage_Core_Model_Config_Data { protected function _beforeSave() { $postData = Mage::app()->getRequest()->getPost(); $value = $postData['groups']['general']['fields']['somefield']['value']; Mage::getModel(‘core/config’)->saveConfig(‘wishlist/general/active’, $value); return $this; } } As [...]
Getting Breadcrumb Path in Magento
by Tykhon Dziuban on November 8, 2011 in Magento development
The most recent code i worked on – it gets current breadcrumb path and getting it prepared for further processing. I think everything is self-explanatory: $path = Mage::helper(‘catalog’)->getBreadcrumbPath(); foreach ($path as $name => $breadcrumb) { $breadcrumbs[$name][] = $breadcrumb['label']; $breadcrumbs[$name][] = $breadcrumb['link']; } SyntaxHighlighter.defaults['toolbar'] = false;SyntaxHighlighter.config.bloggerMode = true;SyntaxHighlighter.all();if (window.jstiming) window.jstiming.load.tick(‘widgetJsBefore’);if (typeof(BLOG_attachCsiOnload) != ‘undefined’ && BLOG_attachCsiOnload != [...]
Practical usage of label fields in Magento’s system.xml
by Tykhon Dziuban on November 7, 2011 in Magento development
I’ve discovered this “trick” when i was just beginning to work with Magento’s framework. I was think about a way to just show some info, which means no inputs but just raw text. Then ive come up with whis piece of code: Display in CMS pages label Ok, this is clear that label is for [...]
Working with attributes in Magento
by Tykhon Dziuban on November 6, 2011 in Magento development
Ive decided to share some usefull code in this post – which can be pretty usefull for the backend development. Ive created it in my spare time when been learning soap interface in Magento. This is gonna be a set of 3 functions(methods). 1st one called “getAttributeSetsThatContain” and made to get attribute sets which contain [...]
How to quickly get all images of the product in Magento
by Tykhon Dziuban on November 4, 2011 in Magento development
If you want to get all images of the given product, then you should do this(code is good to be used anywhere – blocks, template, helpers, controllers): $gallery = Mage::getModel(‘catalog/product’)->load($product->getId())->getMediaGalleryImages(); $image_urls = array(); foreach ($gallery as $image ) { $imageUrls[] = Mage::helper(‘catalog/image’)->init($product, ‘image’, $image->getFile()); } SyntaxHighlighter.defaults['toolbar'] = false;SyntaxHighlighter.config.bloggerMode = true;SyntaxHighlighter.all();if (window.jstiming) window.jstiming.load.tick(‘widgetJsBefore’);if (typeof(BLOG_attachCsiOnload) != ‘undefined’ [...]
Follow @addonbakery on Twitter
