spree

How to make dynamic dropdown in Rails?

瘦欲@ 提交于 2019-12-10 10:46:54
问题 I'm working on a e-commerce project where there will be radio buttons for size selection. I have a dropdown for quantity. I want to make this dropdown dynamic based on stock available for the user selected size. Can anyone tell me how this can be done on Rails? without cluttering my view file with lot of javascript!? 回答1: If you are using Rails 3 with prototype (default afaik), you could use the prototype legacy helpers (Link on Github) to add an observer and render a partial view for your

Spree Custom Roles Permissions

本小妞迷上赌 提交于 2019-12-09 07:05:13
问题 I am trying to give some custom roles within spree specific permissions. Cant find this answer anywhere role_ability.rb class RoleAbility include CanCan::Ability def initialize(user) user || User.new # for guest if user.has_role? "admin" can :manage, :all elsif user.has_role? "retailer" can :manage, Product else can :read, :all end end end I thought this might be a popular idea, of letting a user with role 'manager' manage only products and other certain Models... if I change elsif user.has

Adding multiple products to spree cart with single click

ⅰ亾dé卋堺 提交于 2019-12-08 18:15:35
I'm using spree 3.0 with ROR 4, and in our ecommerce site we want to be able to make recommendations to our customers for pairing of items. like shirt pants combinations. so the customer will answer a couple of questions and then we show them a list of product combinations (taxons i would assume), but then when they click on the choice, its takes them to a page with BOTH items where they can choose the size of each item individually, but add them both to the cart with ONE click 'add to cart'. has anybody solved this with spree yet? 来源: https://stackoverflow.com/questions/30941045/adding

Configuring or adapting Spree or another solution to create a multi-vendor, single domain marketplace (similar to etsy) in Ruby on Rails

我是研究僧i 提交于 2019-12-08 14:05:08
问题 I am trying to create a Rails based multi-vendor e-marketplace, similar to Etsy (but for my specific niche). I did see a similar question at Etsy-like marketplace with Activemerchant? (Rails), but my needs are more than a simple payment processor as that question seems to be discussing. Vendors would need: Customer order management system CMS (e.g. adding & updating products) Invoicing system Ability receive payments directly from customers and the marketplace management would need: Vendor

Show all spree ecommerce products together with their count-on-hand displayed

走远了吗. 提交于 2019-12-08 07:06:35
问题 How can I show all products and their counts together in one place in Spree Commerce? The only place I see the count_on_hand implemented is in admin/stock_transfers and even then it's several clicks deep for the administrator. admin --> configuration --> stock transfers --> view transfer and then you can see a count on hand variable displayed per item. 回答1: Each product has a total on hand method defined here: https://github.com/spree/spree/blob/v2.2.2/core/app/models/spree/product.rb#L200

Can't create a new Spree app: “undefined method `raise_in_transactional_callbacks='”

て烟熏妆下的殇ゞ 提交于 2019-12-08 00:46:38
问题 I had this issue a couple of months ago, posted it on Spree's GitHub page, then figured out the solution myself and posted it on that same issue. Two months later, I'm still getting comments on that same issue from Googlers who had the same error message, so I figure it's worth posting my solution on this website as well just in case anyone is having the same problem but isn't looking on GitHub. The issue: trying to create a brand new Spree app, following the exact instructions in Spree's

Show all spree ecommerce products together with their count-on-hand displayed

时间秒杀一切 提交于 2019-12-07 08:48:27
How can I show all products and their counts together in one place in Spree Commerce? The only place I see the count_on_hand implemented is in admin/stock_transfers and even then it's several clicks deep for the administrator. admin --> configuration --> stock transfers --> view transfer and then you can see a count on hand variable displayed per item. Each product has a total on hand method defined here: https://github.com/spree/spree/blob/v2.2.2/core/app/models/spree/product.rb#L200-L206 You can iterate through all products, and call total_on_hand to find the number of those products on hand

RSpec throws segmentation fault

那年仲夏 提交于 2019-12-07 07:47:49
问题 sometimes my test suite throws a segmentation fault for no reasons. Here is the output: /Users/Test/.rvm/gems/ruby-1.9.3-p392/gems/activerecord-3.2.9/lib/active_record/relation/query_methods.rb:268: [BUG] Bus Error ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin12.3.0] -- Control frame information ----------------------------------------------- c:0209 p:---- s:0839 b:0839 l:000838 d:000838 CFUNC :- c:0208 p:0068 s:0835 b:0833 l:000832 d:000832 METHOD /Users/Test/.rvm/gems/ruby-1.9.3

Spree how to display variants in drop down Ruby on Rails?

假装没事ソ 提交于 2019-12-07 05:51:26
问题 I'm using spree 2.0.0 stable in my application. On product show page all variants display as a radio buttons. I just want to show them in a drop down. Any thoughts on this? Thanks. 回答1: Note: This solution implements Spree "Template Replacement method" especially, when u have extensive design change in your application design or using your custom design. See here http://guides.spreecommerce.com/developer/view.html Otherwise use "deface" method if u are using default design of Spree store or

Is there a way to check if part of the URL contains a certain string

ε祈祈猫儿з 提交于 2019-12-07 04:29:22
问题 Is there a way to check if part of the URL contains a certain string: Eg. <% if current_spree_page?("/products/*") %> , where * could be anything? 回答1: I tested, and gmacdougall's answer works, I had already found a solution though. This is what I used to render different layouts depending on what the url is: url = request.path_info if url.include?('products') render :layout => 'product_layout' else render :layout => 'layout' end The important thing to note is that different pages will call