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 | |
| include 'app/Mage.php'; | |
| Mage::app(); | |
| echo '<pre>'; | |
| print_r(Mage::getConfig()->getNode()->xpath('//global//rewrite')); |
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 | |
| include_once("app/Mage.php"); | |
| umask(0); | |
| Mage::app('admin'); | |
| $collection = Mage::getModel('catalog/product')->getCollection(); | |
| foreach ($collection as $product){ |
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
| /** | |
| * Load object data and create if doesnt exist | |
| * | |
| * @param integer $id | |
| * @return Mage_Core_Model_Abstract | |
| */ | |
| public function createIfDoesntExist($id, $field=null) | |
| { | |
| $this->load($id, $field); |
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 | |
| class Import_Csv | |
| { | |
| public function load($filepath) | |
| { | |
| if(!file_exists($filepath)){ | |
| throw new Exception("File \"{$filepath}\" not found."); | |
| exit; |
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 | |
| include_once("app/Mage.php"); | |
| umask(0); | |
| Mage::app('admin'); | |
| $collection = Mage::getResourceModel('catalog/product_collection'); |
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 | |
| Product::create([ | |
| 'sku' => 'foo', | |
| 'name' => 'Standard Foo', | |
| 'price' => 8.99, | |
| 'special_price' => 6.99, | |
| 'categories' => ['category' => [1,3,5]] | |
| ]); |
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 | |
| function array_walk_depth(array &$arr, $depth, $callback) | |
| { | |
| $depth--; | |
| foreach($arr as $key => &$val){ | |
| if($depth) array_walk_depth($val, $depth, $callback); |
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 | |
| class Dude implements Woah, Whoa{} | |
| interface Woah | |
| { | |
| const WOAH = true; | |
| } | |
| interface Whoa | |
| { | |
| const WHOA = 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
| <?php | |
| include 'app/Mage.php'; | |
| Mage::app(); | |
| $file = fopen("skus.csv", "r"); | |
| while ($data = fgetcsv($file, 1000, ",")) { | |
| $old = $data[0]; | |
| $new = $data[1]; | |
| $product = Mage::getModel('catalog/product')->loadByAttribute('sku', $old); | |
| if($product && $product->getId()){ | |
| $product->setSku($new); |
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
| <frontend> | |
| <events> | |
| <!-- logs --> | |
| <controller_action_predispatch> | |
| <observers><log><type>disabled</type></log></observers> | |
| </controller_action_predispatch> | |
| <controller_action_postdispatch> | |
| <observers><log><type>disabled</type></log></observers> | |
| </controller_action_postdispatch> | |
| <customer_login> |