Sha256: 3cd6c888fb9ee9a3aad7830a273be4dba62646d02ca5af68a4846d3ae83babdb

Contents?: true

Size: 454 Bytes

Versions: 1

Compression:

Stored size: 454 Bytes

Contents

module Redshop
  module CartsHelper
    # get uniq cart id in redis
    def get_cart_id
      "cart_#{session[:guest_id]}"
    end

    def get_cart_count
      # parse count_name from cart_name
      cart_count_name = CartCountService.new("cart_#{session[:guest_id]}").send(:parse_cart_count_name)
      cart_count = $redis.get cart_count_name

      # if cart hasn't got any products(nil) than set 0
      cart_count ? cart_count : 0
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
redshop-0.0.1 app/helpers/redshop/carts_helper.rb