In magento, if you want add new tracking number to specific shipment , or if you have more than one tracking number assigned for any particular shipment, and you want showing that is the technique : How add new tracking numbers to specific shipment: 1 2 3 4 5 6 7 8 $shipment = Mage::getModel(sales/order_shipment)->load($id); $trackingDetail = array( 'carrier_code' => ... Read More »
Category Archives: Tutorials
Magento some code about rewrite model for SEO
get instance of class url_rewrite model: 1 $coreRewrite = Mage::getModel('core/url_rewrite'); get collection request path by products ids and categories ids : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 $cat_id=2; $product_id=array(1,3); $select = $this->getConnection()->select() ->from($this->getTable('core/url_rewrite'), array('product_id', 'request_path')) ->where('store_id=?', Mage::app()->getStore()->getId()) ->where('is_system=?', 1) ->where('category_id=? OR category_id is NULL', 2) // HERE ASSIGNED ->where('product_id IN(?)', $product_id) ... Read More »
Magento : clean compare list programmatically? and Get instance of Conrtoller
I was browsing the Web and found a lesson for us old, I had one of them replied to a question: clean compare list programmatically? for get instance of class ComapreController and execute directly the clear action 1 2 3 4 5 6 7 8 9 10 11 $app = Mage::app(); $frontController = $app->getFrontController(); $request = $frontController->getRequest(); //get the Magento ... Read More »
Magento about Currency , base currency , current currency , currency symbol and convert currency
in our last project we need know more about how convert currency form one to other , how get base currency how get current currency , get currency symbol by currency code . 1 – Convert currency 1 2 3 $from = 'SAR'; $to = 'USD'; $total = Mage::helper('directory')->currencyConvert('100.00', $from, $to); 2 – Get base currency code : 1 $baseCurrency ... Read More »
Magento : Complete list of events (observers) and few examples
Complete list of events (observers) , with few examples of how using inside your magento module Exemples catalog_product_save_before catalog_product_save_after config.xml : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 <global> <events> <customer_address_save_before> <observers> <yourmodule> <type>singleton</type> <class>yourmodule/observer</class> <method>customer_address_save_before</method> </yourmodule> ... Read More »
Magento How to get current store id in admin
this very useful snippet for find the current store id in admin in Magento : 1 2 3 4 5 6 7 8 9 10 11 12 13 if (strlen($code = Mage::getSingleton('adminhtml/config_data')->getStore())) // store level { $store_id = Mage::getModel('core/store')->load($code)->getId(); } elseif (strlen($code = Mage::getSingleton('adminhtml/config_data')->getWebsite())) // website level { $website_id = Mage::getModel('core/website')->load($code)->getId(); $store_id = Mage::app()->getWebsite($website_id)->getDefaultStore()->getId(); } else // default level { ... Read More »
Magento Remove Decimals from product price without touching the core
Many customers ask us to Remove Decimals from product price, so that does not happen for buyers confusion or mistakes in the price of the basket, so we decided to give a lesson in this easy way of how Remove Decimals from product price without touching the core . 1 – Remove Decimals from product price in product and category ... Read More »
Magento adding breadcrumb anywhere Programmatically
Magento developers can add breadcrumb anywhere , example For example, I added a page and want to make them more clarity and arrangement by adding breadcrumbs . There are several ways : go to any exist layout.xml add inside the big parent tag : 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ... Read More »
Magento : Edit Remove And Override Top Links
Many developers want change the default structure of top links inside Magento , example you want remove my account link or edit URL of checkout link other play with label or title of log In log Out . This tutorial is for how done this work : 1- First go to app/design/frontend/default/yourtheme/layout 2- Edit Remove Override : – Edit top ... Read More »
Magento : display Best Selling products ,Most Viewed products , New products ,absolutely or by categories
many developers want use the feature of showing Best Selling products Most Viewed products or New products in home page right column or left column , this tutorials of how create the query for this function ,display absolutely or by categories : Show Best Selling products : Step 1: Create this file app/code/local/YourCompany/YourModule/Block/Product/Bestseller.php in your module and add content : ... Read More »