Sha256: feb8970f71a01e9b68e5c6841b1588e2bbc49ff60d90a4fccac391e242dea9be
Contents?: true
Size: 602 Bytes
Versions: 4
Compression:
Stored size: 602 Bytes
Contents
module SpreeMobility::CoreExt::Spree module VariantDecorator module ClassMethods def product_name_or_sku_cont(query) helper = SpreeMobility::TranslationQuery.new( ::Spree::Product.mobility_backend_class(:name)) helper.add_joins(self.joins(:product)). where( "(LOWER(#{helper.col_name(:name)}) LIKE :query) OR (LOWER(#{::Spree::Variant.table_name}.sku) LIKE :query)", query: "%#{query&.downcase}%").distinct end def search_by_product_name_or_sku(query) product_name_or_sku_cont(query) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems