Skip to content

Instantly share code, notes, and snippets.

View WENKz's full-sized avatar

Quentin Grisard WENKz

View GitHub Profile
<?php
error_reporting(E_ALL | E_STRICT);
define('MAGENTO_ROOT', getcwd());
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
require_once $mageFilename;
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
define('STORE_ID', $_GET["boutique"]);Mage::app()->setCurrentStore(STORE_ID);
Mage::app();
class check {
@WENKz
WENKz / change_attributes.php
Last active August 29, 2015 14:25
Magento change all attributes value
public function getAttributes() {
$attributes = Mage::getResourceModel('catalog/product_attribute_collection')
->getItems();
return $attributes;
}
$attributes = $this->getAttributes();
foreach ($attributes as $attribute) {
@WENKz
WENKz / refresh cache
Created July 20, 2015 09:00
refresh cache en prod environnement symfony
php app/console cache:clear --env=prod --no-debug
<div style="background-color: yellow;">
<?php
foreach ($_product->getMediaGalleryImages() as $image) {
echo $image->getUrl();
echo "<br>";
}
?>
</div>
@WENKz
WENKz / export_configurable.php
Created July 21, 2015 07:58
Magento: Get a configurable products associated simple product data
if($_product->getTypeId() == "configurable"):
$conf = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);
$simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addFilterByRequiredOptions();
foreach($simple_collection as $simple_product){
echo $simple_product->getSku() . " - " . $simple_product->getName() . " - " . Mage::helper('core')->currency($simple_product->getPrice()) . "<br>";
}
endif;
@WENKz
WENKz / export.php
Last active August 29, 2015 14:25
gert configurable product with simple associated
<?php
error_reporting(E_ALL | E_STRICT);
define('MAGENTO_ROOT', getcwd());
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
require_once $mageFilename;
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
Mage::app();
@WENKz
WENKz / get_product_configurable_price.php
Created July 22, 2015 14:53
get_product_configurable_price
<?php
ini_set('memory_limit','2048M');
error_reporting(E_ALL | E_STRICT);
define('MAGENTO_ROOT', getcwd());
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
require_once $mageFilename;
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
@WENKz
WENKz / qty_increments_export.php
Created July 23, 2015 11:52
qty_increments_export.php
<?php
ini_set('memory_limit','2048M');
error_reporting(E_ALL | E_STRICT);
define('MAGENTO_ROOT', getcwd());
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
require_once $mageFilename;
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
@WENKz
WENKz / color.csv
Last active August 29, 2015 14:25
How to Programmatically set a Product's Multi-Select Attribute with csv (color)
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
Sku;color_simple
ACBG-0002;Gris
ACBG-0003;Gris
ACBG-0011;Transparent
ACBG-0012;Noir
ACBG-0013;Noir
ACBG-0016;Gris
ACBG-0020;Noir
ACBG-0022;Transparent
ACBG-0024;Transparent
@WENKz
WENKz / liste_attribute.php
Created July 28, 2015 11:26
liste marque
<?php
error_reporting(E_ALL | E_STRICT);
define('MAGENTO_ROOT', getcwd());
$mageFilename = MAGENTO_ROOT . '/app/Mage.php';
require_once $mageFilename;
Mage::setIsDeveloperMode(true);
ini_set('display_errors', 1);
Mage::app();