« Back to channel list

#spree - 01 February 2013

« Back 1 day Forward 1 day »
[00:13:00] eduardo: hi, everyone
[00:23:38] GeekOnCoffee: tfitts: store_layout = layout.gsub("layouts/", "layouts/#{current_store.code}/")
[00:24:02] eduardo: does anyone know how to properly list products from 'outside' spree?
[00:24:04] GeekOnCoffee: tfitts: so it should be wherever the layout would normally be, but adding the directory for the code
[00:24:43] Radar: eduardo: Do you just want to query the database for the products, or do you want to use Spree's views?
[00:26:03] eduardo: actually, just trying to pull four random items among the products list
[00:26:41] Radar: eduardo: Just any products in particular?
[00:26:55] Radar: eduardo: how many products do you have total?
[00:27:01] eduardo: no particular filter, just four random products
[00:27:11] eduardo: i have 20 or so
[00:27:33] Radar: Here's how to do it in MySQL: http://davidwalsh.name/mysql-random and here's how to do it in PostgreSQL: http://stackoverflow.com/questions/5297396/quick-random-row-selection-in-postgres
[00:28:04] eduardo: since i'm out of Spree scope, i'm calling this in my application_controller.rb: Spree::Product.last(4)
[00:28:30] Radar: In Spree, that'd be Spree::Product.order("RAND()").limit(4) or Spree::Product.offset("random() * (select count(*) from spree_products)").limit(4)
[00:28:44] eduardo: but that way it keeps showing at least one product, even if i've deleted all of them from the admin panel
[00:29:32] Radar: You may actually want to do Spree::Product.active then those order/offset statements
[00:29:38] travis-ci: [travis-ci] spree/spree_active_shipping#65 (master - c85c26b : Tyler Rick): The build passed.
[00:29:38] travis-ci: [travis-ci] Change view : https://github.com/spree/spree_active_shipping/compare/ea43ab6aad47...c85c26bdbee3
[00:29:38] travis-ci: [travis-ci] Build details : http://travis-ci.org/spree/spree_active_shipping/builds/4507073
[00:30:32] eduardo: oh, i see. let me try that Radar
[00:34:48] eduardo: worked perfectly. thanks a lot!
[11:06:08] lun_: too much steps is required to make a purchase in spree store.
[11:06:33] lun_: anyone know any good plugins to make more 'usable'?
[14:35:15] eduardo_: what's the version this issue has been fixed? https://github.com/spree/spree/issues/1790
[14:35:30] eduardo_: i've tried 1.3.2 and 1.2.3
[14:36:05] eduardo_: and none of them seem to have the fix for that problem with states drop-downs
[14:37:34] GeekOnCoffee: it was fixed in 1-1-stable and master at the time, which would have turned into 1-2-stable
[14:38:01] GeekOnCoffee: eduardo_: there are some issues floating around related to query version
[14:38:52] eduardo_: GeekOnCoffee: is there any workaround?
[14:40:08] GeekOnCoffee: eduardo_: try updating gemfile to gem 'jquery-rails', '~> 2.1.4'
[14:54:34] juancabrito: GeekOnCoffee: Hi. I'm trying to add two fields at checkout, I've created a new table related to Order.... this is what I have: https://gist.github.com/8169e889b1abd0654b49 but I'm getting an error and the new data is not being stored
[15:02:51] eduardo__: GeekOnCoffee: thanks a lot. i'll give it a try as soon as i can run bundle update...
[15:13:15] eduardo__: GeekOnCoffee: hmm... i can't update to jquery-rails 2.1.4. i guess bundle can't find that gem
[15:17:32] eduardo__: should i change the source repo? it seems unable to find it at rubygems.org
[16:15:03] eduardo__: does anyone know how can i get the version 2.1.4 of jquery-rails?
[16:17:55] gmacdougall: eduardo__: you should be able to lock that version by putting the following in your Gemfile
[16:17:59] gmacdougall: gem 'jquery-rails', '~> 2.1.4'
[16:18:06] gmacdougall: then run `bundle update jquery-rails`
[16:18:59] eduardo__: gmacdougall: thanks! but i've tried that already and bundle freezes when trying to reach rubygems.org
[16:20:23] eduardo__: gmacdougall: indeed. i'm gonna keep trying other ways
[20:46:14] TopperH: hi, I'm settin up a spree site for a tire seller. Here in Italy they have a tax called PFU that needs to be applied on each tire but MUST be indicated separately from the price. Is there a clean way to add it to add it to each tire so that is not displayed in price list but is calculated on checkout?
[21:08:14] lun_: anyone know how i can configure PaymentGateway during execution off db:seed? :)
[21:13:26] tfitts: TopperH: Can't you just put the products in a separate tax category?
[21:15:30] TopperH: tfitts: the fact is that the product will have VAT (included in price) and PFU not included, so it might not be really clean
[21:19:14] gmacdougall: TopperH: you should be able to do that with tax categories
[21:19:27] gmacdougall: a tax category has many tax rates
[21:20:09] gmacdougall: so you can apply VAT (included in price) and PFU (not included in price) to all products within that tax category
[21:22:07] TopperH: great, thank you tfitts and gmacdougall for the help