Skip to content

Instantly share code, notes, and snippets.

View rskonieczka's full-sized avatar

RafałS rskonieczka

View GitHub Profile

Magento Snippets

Download extension manually using pear/mage

Pear for 1.4, mage for 1.5. File downloaded into /downloader/.cache/community/

./pear download magento-community/Shipping_Agent
./mage download community Shipping_Agent

Clear cache/reindex

@rskonieczka
rskonieczka / magento-delete-attribute-options.php
Created April 23, 2016 18:31 — forked from jonathansayag/magento-delete-attribute-options.php
Magento PHP script to delete all values of an attribute
<?php
$attribute_code = 'ATTRIBUTE_NAME';
$attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', $attribute_code);
$options = $attribute->getSource()->getAllOptions();
$optionsDelete = array();
foreach($options as $option) {
if ($option['value'] != "") {
$optionsDelete['delete'][$option['value']] = true;
@rskonieczka
rskonieczka / customers.sql
Created April 13, 2016 13:35 — forked from leek/_Magento1_DeleteTestData.md
Magento - Delete All Test Data
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`;
@rskonieczka
rskonieczka / WritingMagentoModules.md
Created March 28, 2016 19:02 — forked from leek/WritingMagentoModules.md
Writing Modules for Magento 1.x

Writing Magento Modules

All custom modules should have a Namespace and Module Name. These are used below as {Namespace} and {Module}.

Caution: The Magento autoloader is known to have problems with CamelCase namespaces and/or modules between Windows and *nix systems. If your module requires more than one word for either of these, it is best to just concatenate them to avoid any issues (Example: {Namespace}_{Examplemodule}).

Index

@rskonieczka
rskonieczka / attrs.sql
Created March 28, 2016 19:01 — forked from amon-ra/attrs.sql
Clean magento database, maybe must revision categories and attributes default ids
DELETE eav_attribute_option_value FROM eav_attribute_option,eav_attribute_option_value WHERE eav_attribute_option.attribute_id > 133 and eav_attribute_option.option_id = eav_attribute_option_value.option_id;
DELETE FROM eav_attribute WHERE attribute_id > 133;
DELETE FROM eav_attribute_label WHERE attribute_id > 133;
DELETE FROM eav_attribute_option WHERE attribute_id > 133;
DELETE FROM eav_attribute_group WHERE attribute_set_id > 25;
@rskonieczka
rskonieczka / magento_url_rewrite.patch
Created March 28, 2016 18:38 — forked from edannenberg/magento_url_rewrite.patch
Fixes the catalog url rewrite indexer in Magento 1.7.x-1.9.x See https://github.com/magento/bugathon_march_2013/issues/265 for details.Update: DexterDee in the ticket above noted that the previous patch had some side effects. This updated patch still feels like duct tape but at least it seems to be free of the mentioned side effects. It also fix…
diff -rupN mage_org/app/code/core/Mage/Catalog/Model/Url.php src_shop/app/code/core/Mage/Catalog/Model/Url.php
--- mage_org/app/code/core/Mage/Catalog/Model/Url.php 2013-11-19 00:48:25.679009391 +0100
+++ src_shop/app/code/core/Mage/Catalog/Model/Url.php 2013-11-19 00:49:24.188005601 +0100
@@ -643,13 +643,24 @@ class Mage_Catalog_Model_Url
$this->_rewrite = $rewrite;
return $requestPath;
}
+
+ // avoid unnecessary creation of new url_keys for duplicate url keys
+ $noSuffixPath = substr($requestPath, 0, -(strlen($suffix)));
login url
<?php echo Mage::getUrl('customer/account/login'); ?>
logout url
<?php echo Mage::getUrl('customer/account/logout'); ?>
My Account url
<?php echo Mage::getUrl('customer/account'); ?>
Register url
@rskonieczka
rskonieczka / performance.patch
Created March 28, 2016 18:35 — forked from DimaSoroka/performance.patch
Performance improvement for Magento Patch SUPEE-6788
Index: app/code/core/Mage/Admin/Model/Variable.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- app/code/core/Mage/Admin/Model/Variable.php (revision 2bd128c1f190cd9ea63269824f09789199565251)
+++ app/code/core/Mage/Admin/Model/Variable.php (revision )
@@ -30,6 +30,13 @@
class Mage_Admin_Model_Variable extends Mage_Core_Model_Abstract
{
@rskonieczka
rskonieczka / magento_removeAllCategories.sql
Created March 28, 2016 18:34 — forked from jklance/magento_removeAllCategories.sql
Magento: Remove all categories from a store
SET FOREIGN_KEY_CHECKS = 0;
TRUNCATE TABLE `catalog_category_entity`;
TRUNCATE TABLE `catalog_category_entity_datetime`;
TRUNCATE TABLE `catalog_category_entity_decimal`;
TRUNCATE TABLE `catalog_category_entity_int`;
TRUNCATE TABLE `catalog_category_entity_text`;
TRUNCATE TABLE `catalog_category_entity_varchar`;
TRUNCATE TABLE `catalog_category_product`;
TRUNCATE TABLE `catalog_category_product_index`;

Magento testing scenarios

For use after an upgrade to verify the correct working of Magento

SHIP IT

Frontend

General

  • Activate all logs on the server (PHP, MySQL, Magento, mail, etc)
  • Check meta tags in HTML