Skip to content

Instantly share code, notes, and snippets.

@mschultheiss83
Last active October 12, 2015 13:58
Show Gist options
  • Save mschultheiss83/4037376 to your computer and use it in GitHub Desktop.
Save mschultheiss83/4037376 to your computer and use it in GitHub Desktop.
Magento - Quick n Dirty - Test Scripts
<?php
/**
* Magento Test File
*
*/
error_reporting(E_ALL);
define('MAGENTO', realpath(dirname(__FILE__)));
require_once MAGENTO . '/app/Mage.php';
umask(0);
Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
<?php
/**
* Created by tripuls.
* User: m.schultheiss
* Date: 07.05.14
* Time: 08:47
*/
/**
* Magento Test File
*
*/
error_reporting( E_ALL );
define( 'MAGENTO', realpath( dirname( __FILE__ ) ) );
require_once MAGENTO . '/app/Mage.php';
umask( 0 );
Mage::app()->setCurrentStore( Mage_Core_Model_App::ADMIN_STORE_ID );
$product = Mage::getModel( 'catalog/product' )->loadByAttribute( 'sku', 'AD43-10-04' );
$_helper = Mage::helper( 'catalog/output' );
if ( $product->getImage() ) {
$img = Mage::helper( 'catalog/image' )->init( $product, 'image' );
$imgUrl = $_helper->productAttribute( $product, $img, 'image' );
Zend_Debug::dump( $imgUrl );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment