Strategic Growth and Marketing Blog
Magento – Upgrading Magento Core and Modules Via SSH
[shell] chmod 550 ./mage ./mage mage-setup . ./mage sync ./mage install http://connect20.magentocommerce.com/community Mage_All_Latest –force ./mage upgrade-all –force rm -rf downloader/.cache/* downloader/pearlib/cache/* downloader/pearlib/download/* var/cache/* php shell/indexer.php reindexall [/shell]
Magento – Programmatically Load and Delete Products
[php] <?php // Register a secure admin environment Mage::register(‘isSecureArea’, 1); // Load the Magento product by entity_id $product = Mage::getModel(‘catalog/product’)->load($productId); // Load the Magento product by sku $product = Mage::getModel(‘catalog/product’)->loadByAttribute(‘sku’,…
Magento – Accessing, Getting and Using Custom Variables in PHTML
[php] // To get the TEXT value of the custom variable: Mage::getModel(‘core/variable’)->setStoreId(Mage::app()->getStore()->getId())->loadByCode(‘custom_variable_code’)->getValue(‘text’); // To get the HTML value of the custom variable: Mage::getModel(‘core/variable’)->setStoreId(Mage::app()->getStore()->getId())->loadByCode(‘custom_variable_code’)->getValue(‘html’); // The store id is set as…
Magento Compilation – Compile, Clear, Enable and Disable from Command Line
[shell] $ php shell/compiler.php Usage: php -f compiler.php — [options] state Show Compilation State compile Run Compilation Process clear Disable Compiler include path and Remove compiled files enable Enable Compiler…
Magento – Inserting the Customer’s Email Address into the Email Templates
If you wish to see your customer’s email address in the order confirmation emails sent out by Magento, you will have to edit (or create a new template and assign…
Magento – Including OneStepCheckout’s Order Comments in the Email Templates
If you have installed the OneStepCheckout extension for your Magento store and wondering why you are not seeing the order comments (OneStepCheckout feature) in your order confirmation emails, your email…
Laravel 4 – Get Path to App, Public, Storage and Base Install Directories
[php] <?php /** * Path to the ‘app’ folder */ echo app_path(); /** * Path to the project’s root folder */ echo base_path(); /** * Path to the ‘public’ folder…
Magento – Get Logged In Customer’s Full Name, First Name, Last Name and Email Address
[php] // Check if any customer is logged in or not if (Mage::getSingleton(‘customer/session’)->isLoggedIn()) { // Load the customer’s data $customer = Mage::getSingleton(‘customer/session’)->getCustomer(); $customer->getPrefix(); $customer->getName(); // Full Name $customer->getFirstname(); // First…
Google’s Cookies Usage Notification Message to Searchers from the EU
Early this week, Google implemented a notice message to let it’s searchers from the EU know that they are using cookies on their website. This notice comes after the pressure…
How to Get the Magento CMS Page Identifier of the Current Page
To get the URL key / identifier of any CMS page in Magento, use the following bit of code. [php] <?php $cmsPageUrlKey = Mage::getSingleton(‘cms/page’)->getIdentifier(); ?> [/php] This will return the…
Magento – Easy Method to Set the Number of Columns in Product List.phtml Without XML
[php] <?php /* Edit the catalog/product/list.phtml template to include the following */ /* Get the layout’s page template */ $pageLayoutRootTemplate = $this->getLayout()->getBlock(‘root’)->getTemplate(); /* Set the column count based on the…
Magento – Returning JSON (for AJAX and API Calls) Response From Controller Action
Within your Magento Controller > Action you can use the below code to send a JSON response. [php] $this->getResponse()->setHeader(‘Content-type’, ‘application/json’); $this->getResponse()->setBody($jsonData); [/php] Read this post on how to use Magento’s…