This file contains hidden or 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 | |
// generate a CSV of id,sku of products with missing images to var/missingimages.csv | |
// core/resource_iterator used to prevent memory max limits issues | |
// original source: https://stackoverflow.com/questions/3565377/how-can-i-find-all-products-without-images-in-magento | |
require_once('app/Mage.php'); | |
umask(0); | |
ini_set('display_errors', 1); | |
Mage::setIsDeveloperMode(true); |
This file contains hidden or 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
<!--[if !IE]><!--> | |
<style> | |
/* | |
/* | |
Generic Styling, for Desktops/Laptops | |
*/ | |
table { | |
width: 100%; | |
border-collapse: collapse; |
This file contains hidden or 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 | |
/* | |
* General shell template used in development | |
*/ | |
require_once 'abstract.php'; | |
// Generic PHP development settings | |
umask(0); |
This file contains hidden or 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
UPDATE catalog_product_entity_decimal SET value = '1' WHERE attribute_id = 80 AND value IS NULL |
This file contains hidden or 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
/** | |
* Split a string by string (Similar to the php function explode()) | |
* | |
* @param VARCHAR(12) delim The boundary string (delimiter). | |
* @param VARCHAR(255) str The input string. | |
* @param INT pos The index of the string to return | |
* @return VARCHAR(255) The (pos)th substring | |
* @return VARCHAR(255) Returns the [pos]th string created by splitting the str parameter on boundaries formed by the delimiter. | |
* @{@example | |
* SELECT SPLIT_STRING('|', 'one|two|three|four', 1); |
This file contains hidden or 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 -r '$x=new SimpleXMLElement(file_get_contents("sitemap.xml"));foreach($x->url as $n) echo $n->loc.PHP_EOL;' > urls.txt |
This file contains hidden or 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
echo __FILE__ .":". __LINE__ . PHP_EOL . __METHOD__; |
This file contains hidden or 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
// Source: http://www.magentocommerce.com/boards/viewthread/17414/#t141830 | |
function addMediaGalleryAttributeToCollection(Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection $_productCollection) { | |
$_mediaGalleryAttributeId = Mage::getSingleton('eav/config')->getAttribute('catalog_product', 'media_gallery')->getAttributeId(); | |
$_read = Mage::getSingleton('core/resource')->getConnection('catalog_read'); | |
$_mediaGalleryData = $_read->fetchAll(' | |
SELECT | |
main.entity_id, `main`.`value_id`, `main`.`value` AS `file`, | |
`value`.`label`, `value`.`position`, `value`.`disabled`, `default_value`.`label` AS `label_default`, |
This file contains hidden or 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
If any exceptions are encountered due to 3rd party/local observers debugging can be questionable as no log | |
is created to determine root cause. This mini doc covers how to use the XML-RPC API in Magento to test a | |
product update API call that is returning a 500 internal server error due to an observer firing in 3rd party | |
code. Using some simple XML docs prepared for login and the request it is easier to see the Fatal error | |
returned for a request, in this example product.update. | |
xmlrpclogin.xml contents: | |
<?xml version="1.0"?> | |
<methodCall> |
This file contains hidden or 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 | |
/* | |
* Get attributes via Flat table instead of EAV alternative to the resource heavy | |
* $product->getTypeInstance()->getConfigurableAttributesAsArray() | |
* Source: http://www.atwix.com/magento/custom-resource-model-magento-product-flat-tables/ | |
*/ | |
class Company_Custom_Model_Resource_Flat extends Mage_Core_Model_Resource_Db_Abstract | |
{ | |
protected $_storeId; |