LeeTaylorDoes

  • Archive
  • RSS
  • Ask me anything
  • Submit

SVN: Magento Best Practice

Who: Anyone who works with Magento (especially clients who are running a store) and could benefit from a more in-depth understanding of Magento best practices. What: SVN and Magento (a sweet relationship) Why: Because whether you are a client or a developer, your life can be made easier by using SVN and reaping its benefits Quick Summary:

  1. High-level explanation of SVN
  2. Who should use SVN
  3. Why it should be used
  4. Specific things to watch out for with Magento
  5. Bonus: optional tools

SVN-Environment Relationships

1. A high-level explanation SVN

“SVN” (aka “Subversion”) changes and improves the development process. It is an “enhancement” to “CVS” which allows developers to maintain local, staging, and production environments. This is a best proactive for most software development (and Magento) projects. SVN relates to “Git” (though some prefer one more than the other) and is free to use. Simply put, SVN is a tool that keeps a revision history of code over a period of time. You keep project code located within the repository and pull a copy of the entire code with one simple command (a total of about 6 seconds). In addition, any updates to the code are committed to the repository, which allows anyone who is “linked” to the repository to sync their code with the latest changes via one click of a button. A simultaneous, multi-user environment is thus organized for development and proper administration. Just to reiterate - there are an incredible number of benefits to SVN… too many to mention here.

2. Who should use SVN

Everyone who works with Magento should use SVN. As a rule of thumb, SVN should be used in any significant software development project (unless you use Git).

3. Why SVN should be used

SVN allows multiple developers to build simultaneously in an organized fashion with a detailed history of the progress. This ensures that the live storefront (production environment) is always intricately cared for (read open for business). Every developer has experienced early on in their career the inevitable mistake of removing a file via FTP, only left to realize that file is lost in space and no longer retrievable. But large cocktails are no longer necessary to cope with such an event thanks to SVN. The developer’s life becomes easier; and the client’s business is safer. When used properly, SVN ensures reliability, integrity, speed, and fall-back recovery.

4. Specific things to watch out for with Magento

In our experience, there are a few specifics to watch out for when using SVN with Magento. Without getting too technical, here are a few things we’ve learned along the way: You need to watch out for the caching within Magento. Utilizing SVN:Ignore is the key to allowing the local environment to cache correctly. I would recommend setting SVN to “ignore” for the following (at least) when maintaining separate environments:
  • app/etc/local.xml (or use SVN lock instead for this)
  • media/catalog/product/cache
  • var/
If you use Beanstalk then you can streamline SVN managing with the “Deployment” tool within BeanstalkApp’s repository storage. Use a test script. We’ve learned the hard way to stick to a quality test script as we merge different branches into the main SVN repository (used for production). Maintain a staging environment and use the test script from every angle prior to going “live” to production with the new changes. For phases of a project, it helps to create a “branch” for each phase and a staging environment for each branch (assuming the project is large enough to call for it). This makes it easier to rollback and merge updates. We prefer to keep the entire Magento directory maintained via a SVN repo. We do this so that we can upgrade, modify, and perform other changes locally prior to streamlining the changes to the staging and production environments.

5. Bonus: optional tools

At Elias, we fancy apps that make our lives easier. We invest a lot of time researching and trying out new apps to see how well they fit our business. So far we have found a few SVN tools that are worth mentioning. (Note: these may be Apple-specific. Forgive us):
  • VersionsApp: A high-quality desktop application that allows one to manage repositories locally for streamlined management of code.
  • BeanstalkApp: A sweet as online SVN storage service to host repositories full of code, revisions, and a great interface for management.
  • Coda App: A quality code editor that integrates with SVN
  • TextMate: Another quality code editor with SVN integration
  • MAMP: A personal Mac server with Apache, Mysql and PHP
  • VirtualHostX: A virtual hosting utility that works well with MAMP
  • VirtualBox: A sweet virtualization product to run multiple operating systems
  • Spoon.net: A browser-compatibility testing tool we’re just becoming familiar with
Those of you who are already familiar with SVN know that there is obviously much more to rave about. This post is intended to be a simplified “business use-case” for SVN and explanation of why it is a Magento best practice. We welcome you to chime in with other suggestions for us all to benefit from!

  • 2 years ago
  • Comments
  • Permalink
  • Share
    Tweet

Keramikos Excitement

So our friends at Keramikos Kitchen decided to send along a set of knives to their developer :) In the meantime, his wife enjoys…

Thanks Keramikos!

  • 2 years ago
  • Comments
  • Permalink
  • Share
    Tweet

Part 1 of 3: Scene 7 Integration With Magento eCommerce

What: Straightforward overview on our approach for integrating Scene 7 with Magento eCommerce. Why: Because Magento rocks and Scene 7 rocks. Together, they can create an inspiring user experience! Who: For the business who desires real interactivity, and for developers who desire to implement Scene 7 capabilities with Magento. We recently were approach by a company who knew about Scene 7’s capabilities and they wanted their Magento store to do the following:

1. Replace all product and category images with Scene 7 composited images 2. Allow the user to “build” a custom product based off of product options, and reflect the user selections in the product image 3. Create a unique user experience in their Magento store
Why could this be useful? Well, take a few minutes to learn more about what Scene 7 and Magento integration can do together. Soon, when the project is completed - we’ll have some examples to share. What was our process in approaching this? Let me give a high-level outline our take on integrating the two systems. First off, we looked at how we can utilize Scene 7 url’s instead of native Magento URLs. So we decided to override the catalog image helper so we could add custom functions to composite the appropriate URLs to build the image via a specified URL string. Secondly, we interfaced this custom helper with the Scene 7 backend and some Javascript to build the desired product images. We did this by creating a function inside of the new helper to be able to do all URL string manipulation based off of product options changed by the user on the frontend. Thirdly, we went through and determined every theme file that needed modifying to use the function that built the Scene 7 URLs and reflect the composited image.   As an overview, we took the following approach: 1. Created the right images in Scene 7 to use in correlation with Magento. 2. Created product options in Magento 3. Overlaid JS to the product options to be used as variables within our Helper function 4. Manipulated the URL string and returned the composited URL to build the product image (based off of the user-selected product options)   The site has yet to go live, though keep in touch with Elias updates and you will see the finished product.
  • 2 years ago
  • Comments
  • Permalink
  • Share
    Tweet

Magento and Scene 7 Integration: 3 Part Series

Hey All, Here’s a head’s up for those interested in Scene 7 integration with Magento. We’re excited for what Scene 7 brings to the table, and we hope to see it more throughout the Magento community in the near future. In an effort to back that up, we’re going to come out with a 4-part series on a project we recently did to integrate Scene 7 with Magento. For those interests that are being peaked, feel free to check back with us to catch up on the following:

1. How we integrated the two (a high-level overview of Magento and Scene 7) 2. How to structure Magento for Scene 7 3. How to structure Scene 7 for Magento
We’ll try to keep it as straight-forward and basic as we can, as we’re very excited to see the Magento community start utilizing Scene 7 more. Cheers, Lee
  • 3 years ago
  • Comments
  • Permalink
  • Share
    Tweet

Magento Featured Products: A More Convenient Way To Display Featured Products On The Home Page

About: How To Show / Display Featured Products On The Home Page (Conveniently) Who’s Interested: Informative to the technical gurus What: An alternative direction on how to show featured products on your Magento storefront home page Magento Version Relevance: Any Magento Store Setup: Any My thought: “Why not let the Admin choose what products to display on the home page like every other category?” If you’ve been involved in the community dialogue that constantly evolves through the Magento boards, you may have run across a topic mainly focused on ways for developers to display featured products on the home page. There have been many directions taken with this, including the following as only a few to mention:
  1. Install a extension and configure
  2. Create an attribute, assign each product a value for that attribute, and then display products based upon the value they contain for that attribute
  3. Use the CMS template code to display a certain category

I didn’t want to override any other solutions, but simply offer another approach - one that does not do the following:

  • Modify any core code
  • Require per-product management
  • Install any extension
After my review, I still wanted a way that was more convenient for our client/administrators to be able to manage the products that display on their home page. Going through each product can become cumbersome, so what if they had one specific category that gets displayed all the time, and any products within it show up on the home page? That’s what I went for, and came up with the following:
  1. Create a new “structural block” within Magento (see example, thanks Inchoo)
  2. Create a (hidden) category within the Magento Admin
  3. Modify the structural block to display that category in a specific way
  4. Set the Category Id
Here are the files/modifications:

Structural Block

  • app/design/frontend/*/*/template/catalog/product/featured-products.phtml
[sourcecode language=”php”] /* Magento NOTICE OF LICENSE This source file is subject to the Academic Free License (AFL 3.0) that is bundled with this package in the file LICENSE_AFL.txt. It is also available through the world-wide-web at this URL: http://opensource.org/licenses/afl-3.0.php If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@magentocommerce.com so we can send you a copy immediately. DISCLAIMER Do not edit or add to this file if you wish to upgrade Magento to newer versions in the future. If you wish to customize Magento for your needs please refer to http://www.magentocommerce.com for more information. @category design_default @package Mage @copyright Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com) @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) */
  • 3 years ago
  • Comments
  • Permalink
  • Share
    Tweet

Magento eCommerce: How To Reset All Test Order Information and Set Unique Prefix For Orders, Invoices, Shipments, and Credit Memos

About: How To Reset Test Orders, Dashboard Information, and Set Unique Starting Values for Orders, Invoices, Shipments, and Credit Memos Who’s Interested: Informative to the technical gurus What: Plug ‘n Play Database Script that runs queries to customize after store is installed and product(s) have been created Magento Version Relevence: 1.1.6 Magento Store Setup: Single-Store Setup A client of ours went in to test products, orders, invoices, etc. to get the feel for the overall “purchase order to shipment” process from start to finish. After creating many test users, orders, etc. - they now desire to have everything reset back to “0” (zero). Not only that, but they also want to separate the prefixes for the following items just for ease of dissimilarity when using the Magento ADMIN tools:

  • Orders (set prefix to begin with “1”)
  • Invoices (set prefix to begin with “2”)
  • Shipments (set prefix to begin with “3”)
  • Credit Memo’s (set prefix to begin with “4”)
Thus, we have the following script (and a special thanks to Tomislav at Inchoo for getting us started!) Instructions:
  1. Find “YOUR_DB_NAME” down below and change to match your database name (though leave the ticks “)
  2. Copy and paste code into SQL manager (PhpMyAdmin or similar) and then run the query
  3. Feel free to Create test order, invoice, shipment, and credit memo’s via the ADMIN (easier than going through order process on frontend)
  4. Once you like the changes you see, go back and run the same SQL query
  5. …the following will now be in effect:
  • All data pertaining to orders and search terms (Dashboard) are reset to 0 (zero)
  • Order number prefix with 0, Invoice number prefix with 2, Shipment number prefix with 3, Credit Memo number prefix with 4
Please feel free to copy and paste into your PhpMyAdmin [sourcecode language=”sql”] — Reset Magento TEST Data SET FOREIGN_KEY_CHECKS=0; — reset dashboard search queries TRUNCATE `catalogsearch_query`; ALTER TABLE `catalogsearch_query` AUTO_INCREMENT=1; — reset sales order info TRUNCATE `sales_order`; TRUNCATE `sales_order_datetime`; TRUNCATE `sales_order_decimal`; TRUNCATE `sales_order_entity`; TRUNCATE `sales_order_entity_datetime`; TRUNCATE `sales_order_entity_decimal`; TRUNCATE `sales_order_entity_int`; TRUNCATE `sales_order_entity_text`; TRUNCATE `sales_order_entity_varchar`; TRUNCATE `sales_order_int`; TRUNCATE `sales_order_text`; TRUNCATE `sales_order_varchar`; TRUNCATE `sales_flat_quote`; TRUNCATE `sales_flat_quote_address`; TRUNCATE `sales_flat_quote_address_item`; TRUNCATE `sales_flat_quote_item`; TRUNCATE `sales_flat_quote_item_option`; TRUNCATE `sales_flat_order_item`; TRUNCATE `sendfriend_log`; TRUNCATE `tag`; TRUNCATE `tag_relation`; TRUNCATE `tag_summary`; TRUNCATE `wishlist`; TRUNCATE `log_quote`; TRUNCATE `report_event`; ALTER TABLE `sales_order` AUTO_INCREMENT=1; ALTER TABLE `sales_order_datetime` AUTO_INCREMENT=1; ALTER TABLE `sales_order_decimal` AUTO_INCREMENT=1; ALTER TABLE `sales_order_entity` AUTO_INCREMENT=1; ALTER TABLE `sales_order_entity_datetime` AUTO_INCREMENT=1; ALTER TABLE `sales_order_entity_decimal` AUTO_INCREMENT=1; ALTER TABLE `sales_order_entity_int` AUTO_INCREMENT=1; ALTER TABLE `sales_order_entity_text` AUTO_INCREMENT=1; ALTER TABLE `sales_order_entity_varchar` AUTO_INCREMENT=1; ALTER TABLE `sales_order_int` AUTO_INCREMENT=1; ALTER TABLE `sales_order_text` AUTO_INCREMENT=1; ALTER TABLE `sales_order_varchar` AUTO_INCREMENT=1; ALTER TABLE `sales_flat_quote` AUTO_INCREMENT=1; ALTER TABLE `sales_flat_quote_address` AUTO_INCREMENT=1; ALTER TABLE `sales_flat_quote_address_item` AUTO_INCREMENT=1; ALTER TABLE `sales_flat_quote_item` AUTO_INCREMENT=1; ALTER TABLE `sales_flat_quote_item_option` AUTO_INCREMENT=1; ALTER TABLE `sales_flat_order_item` AUTO_INCREMENT=1; ALTER TABLE `sendfriend_log` AUTO_INCREMENT=1; ALTER TABLE `tag` AUTO_INCREMENT=1; ALTER TABLE `tag_relation` AUTO_INCREMENT=1; ALTER TABLE `tag_summary` AUTO_INCREMENT=1; ALTER TABLE `wishlist` AUTO_INCREMENT=1; ALTER TABLE `log_quote` AUTO_INCREMENT=1; ALTER TABLE `report_event` AUTO_INCREMENT=1; — Reset all ID counters TRUNCATE `eav_entity_store`; ALTER TABLE `eav_entity_store` AUTO_INCREMENT=1; SET FOREIGN_KEY_CHECKS=1; — set appropriate prefixes for orders, invoices, shipments, credit memos INSERT INTO `YOUR_DB_NAME`.`eav_entity_store` (`entity_store_id` ,`entity_type_id` ,`store_id` ,`increment_prefix` ,`increment_last_id`) VALUES (‘1’, ‘11’, ‘1’, ‘1’, ‘000000000’); update `eav_entity_store` set `increment_prefix`= 1 where `entity_type_id`=’4’ and `store_id`=’1’; update `eav_entity_store` set `increment_last_id`= ‘000000000’ where `entity_type_id`=’4’ and `store_id`=’1’; INSERT INTO `YOUR_DB_NAME`.`eav_entity_store` (`entity_store_id` ,`entity_type_id` ,`store_id` ,`increment_prefix` ,`increment_last_id`) VALUES (‘2’, ‘16’, ‘1’, ‘2’, ‘000000000’); update `eav_entity_store` set `increment_prefix`= 2 where `entity_type_id`=’18’ and `store_id`=’1’; update `eav_entity_store` set `increment_last_id`= ‘000000000’ where `entity_type_id`=’18’ and `store_id`=’1’; INSERT INTO `YOUR_DB_NAME`.`eav_entity_store` (`entity_store_id` ,`entity_type_id` ,`store_id` ,`increment_prefix` ,`increment_last_id`) VALUES (‘3’, ‘19’, ‘1’, ‘3’, ‘000000000’); update `eav_entity_store` set `increment_prefix`= 3 where `entity_type_id`=’24’ and `store_id`=’1’; update `eav_entity_store` set `increment_last_id`= ‘000000000’ where `entity_type_id`=’24’ and `store_id`=’1’; INSERT INTO `YOUR_DB_NAME`.`eav_entity_store` (`entity_store_id` ,`entity_type_id` ,`store_id` ,`increment_prefix` ,`increment_last_id`) VALUES (‘4’, ‘23’, ‘1’, ‘4’, ‘000000000’); update `eav_entity_store` set `increment_prefix`= 4 where `entity_type_id`=’28’ and `store_id`=’1’; update `eav_entity_store` set `increment_last_id`= ‘000000000’ where `entity_type_id`=’28’ and `store_id`=’1’; [/sourcecode] For SQL Script download: Magento Database Modifications Let us know how you like it! Thanks, Lee Taylor
  • 3 years ago
  • Comments
  • Permalink
  • Share
    Tweet

Magento: Create New Payment Method -> Cash On Delivery

About: How To Create a Magento Custom Module and A “Cash On Delivery” Payment Method Who’s Interested: Informative to the semi-technically savvy What: Custom Magento Payment Method   So I’ve seen more and more people raising awareness about desire to create a new payment method that allows orders to be paid via “cash on delivery” or “on pickup” by customer. Is this helpful to companies who sell to local clients? Absolutely.   So in offering a solution, I’ll go ahead and outline what files need to be created and why with hopes to help educate the intigued learner in how to create a Magento Custom Module as well. The benefit in knowing how to do this is modifying existing Magento functionality in a way that it will not be overwritten upon a successful Magento upgrade.   Thus, I’ll jump in. The following 5 files will be created (relative to one’s Magento root folder):  

  • confix.xml
  • system.xml
  • PaymentMethod.php
  • mysql4-install-0.1.0.php
  • NewModule.xml
Here are their contents (with comments) and relative paths:   app/code/local/Mage/NewModule/etc/config.xml (below) [sourcecode language=’xml’] Mage_NewModule_ModelMage_NewModulecore_setupcore_writecore_read1newmodule/paymentMethod1Cash On Delivery [/sourcecode] app/code/local/Mage/NewModule/etc/system.xml (below) [sourcecode language=’xml’] 670110 selectadminhtml/system_config_source_yesno1110 selectadminhtml/system_config_source_order_status4110 allowspecific50adminhtml/system_config_source_payment_allspecificcountries111 multiselect51adminhtml/system_config_source_country111<label>Title</label> <frontend_type>text</frontend_type><sort_order>2</sort_order><show_in_default>1</show_in_default><show_in_website>1</show_in_website><show_in_store>0</show_in_store> [/sourcecode] app/code/local/Mage/NewModule/Model/PaymentMethod.php (below) [sourcecode language=’php’] Custom Payment Module for Cash On Delivery * @category Mage * @package Mage_Local * @author Lee Taylor / Elias Interactive -> lee [at] eliasinteractive [dot] com * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) */ class Mage_NewModule_Model_PaymentMethod extends Mage_Payment_Model_Method_Abstract { protected $_code = 'newmodule'; //protected $_formBlockType = 'payment/form_checkmo'; //protected $_infoBlockType = 'payment/info_cod'; /** * Assign data to info model instance * * @param mixed $data * @return Mage_Payment_Model_Method_Checkmo */ public function assignData($data) { $details = array(); if ($this->getPayableTo()) { $details['payable_to'] = $this->getPayableTo(); } if ($this->getMailingAddress()) { $details['mailing_address'] = $this->getMailingAddress(); } if (!empty($details)) { $this->getInfoInstance()->setAdditionalData(serialize($details)); } return $this; } public function getPayableTo() { return $this->getConfigData('payable_to'); } public function getMailingAddress() { return $this->getConfigData('mailing_address'); } } [/sourcecode] app/code/local/Mage/NewModule/sql/newmodule_setup/mysql4-install-0.1.0.php (below) [sourcecode language='php'] app/etc/modules/NewModule.xml (below) [sourcecode language='xml'] truelocal0.1.0 [/sourcecode] Again, this serves as a basic configuration for a new payment method that allows Cash On Delivery and is written as a Magento Custom Module. Modifying these files may be necessary, though this should be a good outline to get you started. Any help needed, post here and we’ll get some dialogue going to find solutions for your needs. Or simply download the files here:

Elias: Cash On Delivery (Magento Payment Method)

 

  • 3 years ago
  • Comments
  • Permalink
  • Share
    Tweet

Making It Happen: Coda-Slider

Hi All,
I knew it, you were wondering what jQuery tool we used across our site and how we customized it, right? Well, here’s one small way in how we added a bit to the core code.
  While reading along in some of the forums (located here: http://www.ndoherty.com/blog/2007/10/29/coda-slider-11/), I noticed some are wanting an “auto-slide” feature for this thing (great job by the way Niall Doherty).  
Here’s how you do it:
 
Modify the js code included in the page's header into this:
[sourcecode language='js'] jQuery(window).bind("load", function() { jQuery("div#slider1").codaSlider() // jQuery("div#slider2").codaSlider() // etc, etc. Beware of cross-linking difficulties if using multiple sliders on one page. //call every __ seconds var autoSlide = setInterval(function() { $("#left-link").click(); }, 10000); }); [/sourcecode]
And change line 63 (i believe, or corresponding line of code) of coda.slider.1.1.1.js:
[sourcecode language='js'] jQuery(this).before(”
Left”); [/sourcecode]  
And there you have it. Feel free to check us out here where we may be hosting some cool developments.
 

Hat's off to Niall Doherty and others who have put their efforts towards this sweet tool.

 

  • 3 years ago
  • Comments
  • Permalink
  • Share
    Tweet
← Newer • Older →
Page 3 of 3

About

technology, communication, and simplistic innovations to share wealth and opportunities globally and socially.

Pages

  • Contact

Me, Elsewhere

  • @timothyltaylor on Twitter
  • My Skype Info
  • Linkedin Profile
  • leetaylordoes on github

Twitter

loading tweets…

  • RSS
  • Random
  • Archive
  • Ask me anything
  • Submit
  • Mobile

Effector Theme by Carlo Franco.

Powered by Tumblr