Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Spree Ecommerce (Commit university workshop)

1,009 views

Published on

Introduzione a Spree Ecommerce esposta da Stefano Mancini in occasione del Commit University Workshop del 19/06/2014

Topic:
- introduzione a Spree Ecommerce
- funzionalità principali
- architettura
- estensioni ufficiali e popolari
- come scrivere un'estensione
- considerazioni finali

Published in: Software
  • Be the first to comment

  • Be the first to like this

Spree Ecommerce (Commit university workshop)

  1. 1. SPREE ECOMMERCE CommitUniversityWorkshop 19/06/2014 Stefano Mancini http://www.devinterface.com
  2. 2. STEFANO MANCINI Co-Founder diDevInterface snc Agile Web Developer Startupper Globitaliasrl Laureato in InformaticaaVerona Contatti: stefano.mancini@devinterface.com http://www.devinterface.com https://twitter.com/stefano_mancini http://it.linkedin.com/in/mancinistefano/
  3. 3. AGENDA 1. introduzione aSpree Ecommerce 2. funzionalitàprincipali 3. architettura 4. estensioniufficialie popolari 5. come scrivere un'estensione 6. considerazionifinali 7. Q&A
  4. 4. PERCHÈ SPREE? ecommerce opensource l'unicaverasoluzione diecommerce per RoR perché siamo sviluppatorie cipiace poter personalizzare i prodotti secondo le esigenze deiclienti demo site: demo code: http://demo.cloud-ecommerce.it https://github.com/devinterface/commit_university_demo
  5. 5. OVERVIEW - HOMEPAGE
  6. 6. OVERVIEW - LISTA PRODOTTI
  7. 7. OVERVIEW - DETTAGLIO PRODOTTO
  8. 8. OVERVIEW - CHECKOUT PRODOTTO
  9. 9. OVERVIEW - ADMIN PRODOTTI
  10. 10. OVERVIEW - ADMIN ORDINI
  11. 11. OVERVIEW - ADMIN CONFIGURAZIONI
  12. 12. CARATTERISTICHE PRINCIPALI estensibile (railsengines) seo friendly /t/categories/brand /products/samsung-tv-t22c300-22-full-hd localizzazione delsito e deicontenuti ricerche configurabili(built-in,Solr,ElasticSeach)
  13. 13. CARATTERISTICHE PRINCIPALI supporto per temigrafici interfacciabile con imaggiorigatewaydipagamento Paypal ,Braintree,Stripe Mobile ready(responsive ,skeleton) API REST
  14. 14. ARCHITETTURA core(models,mailerse tutte le funzionalitàprincipali) frontend (store,listaprodotti,dettaglioprodotti,checkout prodotti,areariservatautenti) backend (areadiamministrazione) APIRESTFUL (per integrarsiinletturae scritturaconsistemiesterni)
  15. 15. ARCHITETTURA - PRODOTTI
  16. 16. ARCHITETTURA - ORDINI
  17. 17. ARCHITETTURA - PAGAMENTI Check Bank Transfer Gateway
  18. 18. ARCHITETTURA - SPEDIZIONI shippingmethods (spedizionieri) zones (zone geografiche) calculations (flat,per quantità,per peso)
  19. 19. ARCHITETTURA - MAGAZZINO
  20. 20. ARCHITETTURA - REST API Permette dileggere/scrivere ognirisorsadell'ecommerce Dipende daipermessidell'API KEY utilizzata, quindidaipermessi dell'utente Ritornaun JSONdirisposta
  21. 21. ARCHITETTURA - REST API GET/api/products/1 $curlhttp://demo.cloud-ecommerce.it/api/products/1.json?token=YOUR_KEY_HERE { "id":1, "name":"RubyonRailsTote", "description":"Autemomnisquosesseatinciduntodio.Quiainquamodioarchite "price":"14.0", "display_price":"€14,00EUR", "available_on":"2014-02-18T18:04:37.870Z", "permalink":"ruby-on-rails-tote", "meta_description":null, "meta_keywords":null, "shipping_category_id":1, "taxon_ids":[ 3, 11, 14, 15 ], "variants":[ { "id":1, "name":"RubyonRailsTote", "sku":"ROR-00011", "price":"14.0", "weight":null,
  22. 22. ESTENSIONI - GEMME UFFICIALI Spree Wishlist( ) Spree RecentlyViewed ( ) Spree PaypalExpress ( ) Spree i18n ( ) Spree Social( ) Spree Related Products ( ) https://github.com/spree/spree_wishlist http://github.com/spree/spree_recently_viewed http://github.com/spree/spree_paypal_express https://github.com/spree/spree_i18n http://github.com/spree/spree_comments http://github.com/spree/spree_related_products
  23. 23. ESTENSIONI - ALTRE GEMME POPOLARI BloggingSpree ( )http://github.com/stefansenk/spree-blogging-spree Spree Simple CMS ( )http://github.com/damianogiacomello/spree_simple_cms Spree LoyaltyPoints ( )http://github.com/vinsol/spree-loyalty-points Spree Solr ( )https://github.com/devinterface/spree_solr Spree Monetaweb ( )https://github.com/devinterface/spree_monetaweb
  24. 24. ESTENDERE SPREE Override delle views: Deface ( )https://github.com/spree/deface Template replacement
  25. 25. DEFACE #app/views/spree/home/index.html.erb <divdata-hook="homepage_products"> <ulid="products"class="inlineproduct-listing"data-hook=""> <liid="product_2"class="columnsthreealpha"data-hook="products_list_item" <divclass="product-image"><ahref="/products/apple"itemprop="url"><img </div> <ahref="/products/apple"class="info"itemprop="name"title="Apple">Appl </li> </ul> </div>
  26. 26. DEFACE #app/overrides/homepage_contents.rb Deface::Override.new(:virtual_path=>"spree/home/index", :replace=>"[data-hook='homepage_products']", :name=>"homepage_contents", :partial=>"home/homepage_contents")
  27. 27. ESTENDERE SPREE Extend ed override dimodels e controllers: #app/models/spree/product_decorator.rb Spree::Product.class_evaldo defsome_method end end
  28. 28. ESTENDERE SPREE Extend ed override dimodels e controllers: #app/controllers/spree/products_controller_decorator.rb Spree::ProductsController.class_evaldo defsome_action end end
  29. 29. ESTENDERE SPREE Cambiare l'outputdiunaaction: #app/controllers/spree/products_controller_decorator.rb Spree::ProductsController.class_evaldo respond_override:index=>{:html=> {:success=>lambda{render'shared/some_file'}}} end
  30. 30. ESTENDERE SPREE Customizzare le dimensionidelle immagini: Spree::Image.class_evaldo attachment_definitions[:attachment][:styles]={ :mini=>'48x48>',#thumbsunderimage :small=>'100x100>',#imagesoncategoryview :product=>'240x240>',#fullproductimage :large=>'600x600>'#lightboximage } end
  31. 31. ESTENDERE SPREE lamagia: #config/application.rb moduleMistercucina classApplication<Rails::Application config.to_preparedo #Loadapplication'smodel/classdecorators Dir.glob(File.join(File.dirname(__FILE__),"../app/**/*_decorator*.rb"))do|c| Rails.configuration.cache_classes?require(c):load(c) end #Loadapplication'sviewoverrides Dir.glob(File.join(File.dirname(__FILE__),"../app/overrides/*.rb"))do|c| Rails.configuration.cache_classes?require(c):load(c) end end end end
  32. 32. CREARE UN'ESTENSIONE spreeextensionspree_monetaweb railsgmigrationadd_monetaweb_payment_id_to_payments #Gemfile gem'spree_monetaweb',:path=>'../spree_monetaweb' bundleinstall railsgspree_monetaweb:install
  33. 33. SPREE_MONETAWEB engine.rb https://github.com/devinterface/spree_monetaweb/blob/master/lib/sp
  34. 34. SPREE_MONETAWEB moneta_web.rb https://github.com/devinterface/spree_monetaweb/blob/master/app/
  35. 35. SPREE_MONETAWEB
  36. 36. SPREE_MONETAWEB checkout_controller_decorator.rb https://github.com/devinterface/spree_monetaweb/blob/master/app/
  37. 37. SPREE_MONETAWEB monetaweb_controller.rb https://github.com/devinterface/spree_monetaweb/blob/master/app/
  38. 38. SPREE_SOLR engine.rb https://github.com/devinterface/spree_solr/blob/2-2- stable/lib/spree_solr/engine.rb
  39. 39. SPREE_SOLR solr.rb https://github.com/devinterface/spree_solr/blob/2-2- stable/lib/spree/search/solr.rb
  40. 40. SPREE_SOLR product_decorator.rb https://github.com/devinterface/spree_solr/blob/2-2- stable/app/models/spree/product_decorator.rb
  41. 41. CONSIDERAZIONI FINALI PRO ottimo (praticamente l'unico) ecommerce per Rails permette dipubblicare soluzionianche molto complesse è estensibile: siadattaalle esigenze più disparate deiclienti API CONTRO pochitemplate html/css giàpronti estensionivalide malimitate (alcune non più aggiornate) è necessario saper mettere le manisulcodice
  42. 42. Q&A
  43. 43. GRAZIE PER L'ATTENZIONE Stefano Mancini DevInterface ( )http://www.devinterface.com

×