Tag: 狂欢

我想在我的spree扩展中添加新的javascript文件

我是铁杆新手。 我正在尝试构建Spree扩展以使用Braintree的插入式UI。 我正在尝试将新的braintree.js添加到我的扩展程序中。 这些是我到目前为止所做的步骤。 将/app/assets/javascripts/spree/frontend/添加到/app/assets/javascripts/spree/frontend/ 添加了//= require spree/frontend/braintree到app/assets/javascripts/spree/frontend/.js 。 在/config/initializers/创建了braintree.rb 。 该文件的内容: Braintree::Configuration.environment = :sandbox Braintree::Configuration.merchant_id = “merchant_id” Braintree::Configuration.public_key = “public_key” Braintree::Configuration.private_key = “private_key” 从我的狂欢商店我运行bundle install ,这是成功的。 Ran rails g :install ,它给出了以下错误: append vendor/assets/javascripts/spree/frontend/all.js append vendor/assets/javascripts/spree/backend/all.js insert vendor/assets/stylesheets/spree/frontend/all.css insert vendor/assets/stylesheets/spree/backend/all.css run bundle exec rake railties:install:migrations FROM=spree_hello_ext from “.” Would you like to run the migrations […]

根据操作的ID渲染rails部分

我正在建立一个小型电子商务网站,销售各种男装和女装。 我想基于用户所在的分类法来呈现部分内容。例如,如果用户位于mysite.com/t/women/pants,我想呈现_women.html.erb,或者,如果用户是在mysite.com/t/men/shirts我想呈现_men.html.erb。 我有一个分类模型,包含多个分类,而Taxon模型有多个产品。 在taxons_controller.rb我有: def show @taxon = Taxon.find_by_permalink(params[:id]) return unless @taxon @taxonomy = Spree::Taxonomy.all @taxon_title = Spree::Taxon.all @searcher = Spree::Config.searcher_class.new(params.merge(:taxon => @taxon.id)) @searcher.current_user = try_spree_current_user @searcher.current_currency = current_currency @products = @searcher.retrieve_products respond_with(@taxon) end 在分类单位#show我有:(我知道这是错的) 当我访问mysite.com/t/women/long-sleeve时,rails调试器显示: controller: spree/taxons action: show id: women/long-sleeve 如何在内部访问动作的id,以便在控制器/视图中我可以执行以下操作: ‘如果id等于’女’渲染“spree / shared /#{title.name.downcase}”’ title是分类标准的名称? 我想我需要在控制器的演出动作中找到(params [:something],但我对params有点不清楚。 * * * @ beck03076这是一个很棒的技巧。 […]

使用facebook登录集成键的spree_social gem的初始化程序

我有一个基于狂欢的应用程序,应该与Facebook集成。 我这样做是通过spree_social gem工作正常,但我需要一些配置文件,所以我不必每次点击管理面板。 我添加了ne初始化程序: /config/initializers/devise.rb require ‘omniauth-facebook’ Devise.setup do |config| config.omniauth :facebook, KEY, SECRET end 但这没有任何作用。 我在网上尝试了所有可能的教程和示例,即https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview或http://sleekd.com/tutorials/setting-up-omniauth-authentication-with- Facebook的/ 但没有任何作用,所以必须有一些我看不到的其他错误。 唯一有效的方法是: ActiveRecord::Base.connection.execute(SQL query here) 它更新了db中的正确列,但这可能完全不是Ruby方式,它看起来很糟糕。 我在spree_social gem挖了,有这样的方法: def update_oauth_method auth_method = params[:authentication_method] if auth_method[:active] == “true” && auth_method[:environment] == ::Rails.env Devise.setup do |config| config.omniauth auth_method[:provider], auth_method[:api_key], auth_method[:api_secret] end end end 但我找不到任何方法将它保存到数据库中。 不幸的是我无法在配置/初始化器中设置断点,所以我无法完成它,因为我必须盲目地测试配置。

Spree 1.3.2没有显示我的帐户和登录/注销链接,以及控制台中的Spree :: User对象

我在一个新的rails项目中安装了spree 1.3.2。 在捆绑安装之后,我运行了spree install cmd,它运行得很好。 在我的本地服务器上启动应用程序后,我获得了示例数据和产品。 但我没有得到任何与帐户相关的链接。 例如/ account,或/ login 在控制台中,当我查找Spree :: User Object时出现错误。 我无法弄清楚为什么对象不会出现以及为什么有些url丢失了。 任何人都可以提供一些指示吗? 谢谢,高拉夫

在Spree Store中添加Braintree Drop-in UI时,选择付款方式时出现问题

当客户选择Braintree作为付款方式时,我正在尝试实施扩展以适应braintree的插入式UI。 如果我将braintree js代码添加到_gateway.html.erb中,那么所有其他付款方式都会停止工作。 如果我选择除braintree之外的任何其他方法并单击“保存并继续”,则没有任何反应。 “保存并继续”按钮被禁用。 我已经覆盖了spree / frontend / app / views / spree / checkout / _gateway.html.erb。 ‘credit-card-image’, :class => ‘pull-right’, :width => ‘170’, :height => ’28’ %> * ‘form-control required’} %> * ‘off’} : {} %> ‘card_number’, :class => ‘form-control required cardNumber’, :size => 19, :maxlength => 19, :autocomplete => “off”) %>   […]

Gem Spree_i18n在服务器启动时抛出错误:无法加载翻译

的Gemfile: gem ‘spree’, ‘1.2.0’ #:git => ‘git://github.com/spree/spree.git’ gem ‘spree_auth_devise’, :git => ‘git://github.com/spree/spree_auth_devise’ # original repository not compatible at the moment, use fork # gem ‘spree_i18n’, :git => ‘git://github.com/spree/spree_i18n.git’ gem ‘spree_i18n’, :git => ‘git://github.com/kares/spree_i18n.git’ application.rb中: config.i18n.default_locale = :de Spree.rb :(初学者 ) Spree.config do |config| … config.default_locale = “de” end 还有什么: 我已将所有可能的语言yml文件复制到app / config / locale 我跑了“ […]

使用Spree,如何从rails控制台中的订单中查找产品选项值?

我能够从订单中获取产品,但我仍然没有找到一种方法来获取它的option_values以便生成它。 这就是我发现产品的方式: p = Order.find_by_number(“R326153622”).products.first 然后,我通过p.option_types获得了p.option_types ,它给了我: => [#, #, #] 好! 现在我的头痛开始了。 我无法意识到在将产品放入购物车时由顾客选择的产品的性别,尺寸和颜色在哪里。 我正在放弃并立即打电话给客户,但仍然想要理解它= D.

Spree,Ruby on Rails – 添加到购物车同一产品的多个变种

我希望允许客户在同一页面上添加同一产品的多个变体。 现在我有一个带有单选按钮的变种列表,如何使它们成为复选框 ? 当然,将“radio_button_tag”更改为“check_box_tag”无济于事 variant.price_in(current_currency).display_price %>

狂欢 – 在同一页面上将多个变体添加到购物车

我正在将Spree用于ecommerece网站,每种产品都将以大量颜色出售,大多数客户都希望购买相同产品的不同颜色(例如变体)。 我希望允许客户在同一页面上添加同一产品的多个变体,我目前有一个带有单选按钮的变体列表,可以选择购买变体和数量。 相反,我只想要一些默认为零的数量框,以便客户可以简单地将他们想要的数字添加到每个变体中,然后单击添加到购物车。 看完订单控制器后,我想出了这个 <label for="”> “title”, :size => 3 %> 它的工作原理是它显示了我想要的东西,变量和数量框列表,但每当我添加数量并将它们添加到购物车时,它只是默认为列表中的最后一项和最后一个数量框中的数量。 我尝试了一些但没有一个正确,有谁知道我会怎么做呢?

渲染部分时无法找到“堆栈级太深”的根

我一直坚持这个问题一个星期。 如果你能搞清楚的话,我会给你寄一瓶苏格兰威士忌。 说真的,它来了贿赂。 关于taxons#show我正在渲染产品partial, _products.html.erb ,它将表格中的所有产品列出到taxons控制器的show视图。 单击某个产品时,默认情况下,该应用会将用户重定向到products#show _cart_local.html.erb ,其中_cart_local.html.erb部分呈现为显示“添加到购物车”选项。 但是对于taxons#show ,当点击产品时,我会调出一个灯箱,这样用户就不必离开页面了。 灯箱代码在_products.html.erb ,我正在尝试在_cart_form.html.erb内渲染_cart_form.html.erb 。 当我这样做时,我得到’堆栈级别太深’的错误,而且taxons#show将不会渲染。 但购物车在products#how #how中表现良好。 我将部分product改为@product 。 这没有用。 我渲染了一个空的部分,页面加载,这让我觉得问题是_cart_local (但为什么它会渲染products#show _cart_local ?)。 然后我拿出了开始表单标签和结束的div / end标签之间的所有代码,并且还渲染了页面,这让我认为它在那个区块中,但我不能再进一步了解它。 我被卡住了 这是_cart_local的代码,如果我取出和注释之间的代码,页面呈现: populate_orders_path do |f| %> !v.in_stock && !Spree::Config[:allow_backorders], ‘data-price’ => v.price_in(current_currency).display_price %> <label for="”> <div data-hook="product_price" class="columns five alpha omega “> ‘title’, :in => 1..product.on_hand, :min => […]