Scaling Magento presentation with 60 slides and notes, which was then reviewed by Alan Storm.
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 | |
| 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
| /** | |
| * 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 | |
| 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
| <?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
| public function sendVendorNotification($po, $comment='') | |
| { | |
| $vendor = $po->getVendor(); | |
| $method = $vendor->getNewOrderNotifications(); | |
| if (!$method || $method=='0') { | |
| return $this; | |
| } |
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
| $collection = Mage::getModel('catalog/product')->getCollection(); | |
| $collection->joinField('category_id', 'catalog/category_product', 'category_id', 'product_id = entity_id', null, 'left'); | |
| $collection->addAttributeToFilter('category_id', array('null' => true)); | |
| $collection->addAttributeToFilter('status', 1); | |
| $collection->addAttributeToSelect('*'); |
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
| /** | |
| * Get collection size | |
| * | |
| * @return int | |
| */ | |
| public function getSize() | |
| { | |
| if (is_null($this->_totalRecords)) { | |
| $sql = $this->getSelectCountSql(); | |
| $this->_totalRecords = $this->getConnection()->fetchOne($sql, $this->_bindParams); |
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 Ip_Test_Model_Observer | |
| { | |
| public function implementOrderStatus(Varien_Event_Observer $observer) | |
| { | |
| $order = $observer->getEvent()->getOrder(); | |
| $orderItems = $order->getAllVisibleItems(); | |
| foreach ($orderItems as $item) { |