Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. require 'spree/product'
  2. require 'solidus_globalize/fallbacks'
  3.  
  4. module Spree
  5. Product.class_eval do
  6. # Fix for method not found find_by_slug
  7. def self.find_by_slug(slug)
  8. translation = Product::Translation.find_by_slug(slug)
  9. find(translation.spree_product_id)
  10. end
  11. end
  12. Taxon.class_eval do
  13. # Fix for method not found find_by_permalink!
  14. def self.find_by_permalink!(permalink)
  15. translation = Spree::Taxon::Translation.find_by_permalink!(permalink)
  16. find(translation.spree_taxon_id)
  17. end
  18. end
  19. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement