This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Author: Nathan Wu | |
* Date: Nov 19, 2012 | |
* Time: 12:54:29 AM | |
* | |
* Mage_Shell script that interfaces with the Magento cache. | |
* | |
* | |
* @category JoomlaCreator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* File: /app/code/core/Mage/Directory/Model/Currency.php | |
* Function: formatTxt | |
* Do: Add this before return; | |
*/ | |
if (($price - intval($price)) == 0) { | |
$options['precision'] = 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Back up From the Command Line (using mysqldump) | |
#If you have shell or telnet access to your web server, you can backup your MySQL data by using the mysqldump command. | |
#This command connects to the MySQL server and creates an SQL dump file. | |
#The dump file contains the SQL statements necessary to re-create the database. Here is the proper syntax: | |
mysqldump --opt -u [uname] -p[pass] [dbname] > [backupfile.sql] | |
#For example, to backup a database named 'Tutorials' with the username 'root' and with no password to a file tut_backup.sql, | |
#you should accomplish this command | |
mysqldump -u root -p Tutorials > tut_backup.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET FOREIGN_KEY_CHECKS=0; | |
-- Customers | |
TRUNCATE `customer_address_entity`; | |
TRUNCATE `customer_address_entity_datetime`; | |
TRUNCATE `customer_address_entity_decimal`; | |
TRUNCATE `customer_address_entity_int`; | |
TRUNCATE `customer_address_entity_text`; | |
TRUNCATE `customer_address_entity_varchar`; | |
TRUNCATE `customer_entity`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
1. If you add your handle before you call $this->loadLayout() from a controller it’s too soon | |
2. If you add your handle after you call $this->loadLayout() it’s too late | |
So, if you really need to add a handle to a controller, you need to replace the call to $this->loadLayout() with: | |
**/ | |
$update = $this->getLayout()->getUpdate(); | |
$update->addHandle('default'); | |
$this->addActionLayoutHandles(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- First, update the attribute input type to multiselect | |
UPDATE eav_attribute SET | |
entity_type_id = 4, | |
attribute_model = NULL, | |
backend_model = 'eav/entity_attribute_backend_array', | |
backend_type = 'varchar', | |
backend_table = NULL, | |
frontend_model = NULL, | |
frontend_input = 'multiselect', | |
frontend_class = NULL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once "app/Mage.php"; | |
Mage::app(); | |
$installer = new Mage_Eav_Model_Entity_Setup('core_setup'); | |
$entityTypeId = $installer->getEntityTypeId('catalog_product'); | |
// replace <my_attribute_code> with your attribute code | |
$idAttribute = $installer->getAttribute($entityTypeId, '<your_attribute_code_here>', 'attribute_id'); | |
$installer->updateAttribute($entityTypeId, $idAttribute, array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static NSString * BCP47LanguageCodeFromISO681LanguageCode(NSString *ISO681LanguageCode) { | |
if ([ISO681LanguageCode isEqualToString:@"ar"]) { | |
return @"ar-SA"; | |
} else if ([ISO681LanguageCode hasPrefix:@"cs"]) { | |
return @"cs-CZ"; | |
} else if ([ISO681LanguageCode hasPrefix:@"da"]) { | |
return @"da-DK"; | |
} else if ([ISO681LanguageCode hasPrefix:@"de"]) { | |
return @"de-DE"; | |
} else if ([ISO681LanguageCode hasPrefix:@"el"]) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET @increamentID = 'XXXXXXXXX'; | |
SET FOREIGN_KEY_CHECKS = 1; | |
DELETE FROM sales_flat_order | |
WHERE increment_id = @increamentID; | |
DELETE FROM sales_flat_quote | |
WHERE reserved_order_id = @increamentID; |