search for: cart_item

Displaying 19 results from an estimated 19 matches for "cart_item".

2006 Jul 07
5
Can a route require POST or GET? / REST problem with routing
Hi, A store front a customer wants to GET /product/5/show. But for the application this is really GET /cart_item/new/5 or even better /cart_item/new?cart_item[product_id]=5 When the customer clicks add_to_cart they POST /product/5/show so that the url doesn''t confuse the user when any validation errors occur. But for the applicaiton this should be POST /cart_item/create?cart_item[quantity]=23 Can I...
2006 Jul 24
1
Newbie error: undefined local variable or method
When I add an item to the shopping cart, I get an error: undefined local variable or method `cart_item'' for #<#<Class:0x3715a78>:0x3715a48> Session info says the cart being updated properly. I''m just not able to output two variables: <%= cart_item.quantity %> &times; <%= h(cart_item.title) %> I did some research, and I can grasp that local variables...
2006 Jul 18
15
Agile Web Developement with Rails
I recently got a copy of the second addition in PDF and got stuck on the Ajax portion using highlighting page 128. While trying to make my cart flash I got an RJS error when I click add to cart. I have gone back and made sure my code matched what was in the book but no help. I sent Dave an email and he rec''d this list. Anybody got any good links for troubleshooting Ajax or maybe have see
2006 Jul 03
0
Page 129 of Agile Web Dev on Rails (or pg141 of pdf!)
...egin @product = Product.find(params[:id]) rescue logger.error("Attempt to access invalid product #{params[:id]}") redirect_to_index("Invalid product") else @cart = find_cart @current_item = @cart.add_product(@product) end end Code in _cart_item.rhtml: <% if cart_item == @current_item %> <tr id="current_item"> <% else %> <tr> <% end %> <td><%= cart_item.quantity %>&times;</td> <td><%= h(cart_item.title) %></td> <td class="item-price">&...
2007 Oct 17
9
@session['user'] vs session[:user]
This might seem really simple to some but just wanted to ask: what is the difference between @session[''user''] and session[:user] ? and how would you use each? And another question, I have the following code: def get_customer if @session[''customer''] @c = Customer.find(@session[''customer'']) end end private def
2006 Jul 10
2
cross controller functional tests?
Hi, I have an online store and I would like to simulate a complete shopping trip which involves several controllers? How can I write a test that calls actions from different controllers in a particular sequence? Something like the following which involves department, product, cart_item, and cart controllers. get department 5 check it has a link to product 4 get product 4 post cartitem/create get cart see that product 4 in in the cart Thanks, Peter
2010 Oct 11
0
undefined method `includes_values' for :conditions:Symbol
...pp.com/projects/45560-acts-as-ferret/tickets/176-aaf-051-undefined-method-includes_values-for-conditionssymbol#ticket-176-4 Anyway, i fixed the query and moved on. Today I hit the error again but I do not have any include queries. It seems that rails is generating it. I have a cart that has many cart_items and a cart item belongs to a domain. When I try to access the domain in my cart view I get the ''includes_values'' error on this item (item.domain.id) <% @cart.cart_items.each{|item| %> <li id="cart_domain_id_<%=item.domain.id%>" class="cart-it...
2007 Oct 18
0
REST help
...trying to build a RESTful shopping cart and I have hit a small wall, but before I get to that let me explain what I have done thus far. I have two RESTful controllers, CartController and CartItemsController with a nested routes setup like so map.resources :carts do |carts| carts.resources :cart_items, :collection => {:empty => :delete} end (I added a custom route to the for emptying the cart as it seemed to me that when I clear the cart I am operating on the items which is why I added that action to the CartItemsController. If this is not RESTfully "correct" I would love to...
2006 Jul 16
17
AWDWR question
In an early section on Action View, showing code being put directly into the rhtml file: <% require ''date'' DAY_NAMES = %w{ Sunday Monday Tuesday Wednesday Thursday Friday Saturday } today = Date.today %> <h1>Hello, Dave</h1> <p> It''s <%= DAY_NAMES[today.wday] %>. Tomorrow is <%= DAY_NAMES[(today + 1).wday %>. </p> I get this
2008 Oct 24
4
Railscast 75, Observe_field and Shopping Cart
Hi all, I have the shopping cart page where a user can add items dynamically through ajax as explained in Railscast episode 75. I am using observe_field to observe the ''quantity'' and ''cost'' fields to update the total field for each item. This does not work however, for records that are added through the Ajax. How can i name the fields and observe them as i have
2007 Oct 15
4
ArgumentError in StoreController#add_to_cart: wrong number of arguments (1 for 0)
I am really new to Ruby and Rails but as you probably see I am trying to get the shopping card working from the book. I am getting this error but I really don''t know what to do. I have looked up several of topics that stated the same problem but as far as I am, nothing has helped me out yet. Is there something wrong with the Product model? This is in the StoreController and I believe it
2006 Feb 27
1
Nested hash from form params into create()?
...nds it to my add_to_cart controller method. Params contains a product variation_id and a list of chosen options (eg. color, size, etc). Any help greatly appreciated. Thanks, Peter params = { "commit"=>"Add To Cart", "variation_id"=>"1", "cart_item_options"=>{"6"=>{"option_id"=>"74"}, "7"=>{"option_id"=>"97"}, "5"=>{"option_id"=>"47"}} } ## CONTROLLER ## def add_to_cart...
2007 May 30
2
Depot - empty_cart with ajax
...ew::TemplateError (You have a nil object when you didn''t expect it! The error occurred while evaluating nil.items) on line #8 of app/views/ store/_cart.rhtml: 5: --> 6: <div class="cart-title">Your Cart</div> 7: <table> 8: <%= render(:partial => "cart_item", :collection => cart.items) %> 9: 10: <tr class="total-line"> 11: <td colspan="2">Total</td> Then my question: The first time the store loads, there is no "cart.items" collection, and it doesnt throw an exeption on nil render. How...
2006 Apr 10
4
Many To Many''s Join table attributes + migrations
Hi all, just joined and have only just kicked off with Rails (coming, but not departing, from WebObjects development). And so far there seems to be a lot of promise except for one thing I can''t figure out as yet -- the above problem. Say I have the following conceptual relationships: ITEMS <<--->> CARTS i.e., each item can belong to one or more categories. So really
2006 Aug 04
6
Errors ... errors and errors.
...:items def initialize @items = [] end def add_product(product) existing_product = @items.find {|item| item.product == product} if existing_product existing_product.increment_quantity else @items << Cart.new(product) end end end [CODE] And here is the cart_item.rb [CODE] class CartItem include Reloadable attr_reader :product, :quantity def initialize(product) @product = product @quantity = 1 end def increment_quantity @quantity += 1 end def title @product.title end def price @product.price * @quantity end end...
2007 Jun 06
0
uninitialized constant Cart::CartItem
I am following a tutorial and get thar error creating a cart, and can''t figure it out, uninitialized constant Cart::CartItem Extracted source (around line #8): 5: <h3>Your Shopping Cart</h3> 6: 7: <ul> 8: <% for item in @cart.cart_items %> 9: <li id="cart_item_<%= item.book.id %>"> 10: <%= render :partial => "cart/item", :object => item %> 11: </li> -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this messa...
2007 Jan 12
9
Nil object in E1 capture the order
I''m following the depot application in the rails bible Agile Web Development with Rails. In interation E1 NoMethodError in Admin#checkout Showing app/views/admin/checkout.rhtml where line #12 raised: You have a nil object when you didn''t expect it! You might have expected an instance of Array. The error occured while evaluating nil.include? Extracted source (around line #12):
2006 Jul 31
4
RJS to find an element
I''m trying to implement a remove from cart method based on the examples in the second edition Agile book. I have everything working except for the RJS that removes items from the cart. Ideally what I''d like to do is highlight an element that I am deleting only if there is more than one of that particular item in the cart. If the item deleted is the only of
2006 Jun 18
13
Currency calculation
I''m thinking of experimenting with some currency conversion. However, I''d like the conversions to be in synch with the current rates. Anyone know (and this maybe out in left field) if there is some online (perhaps xml) or other data stream I can connect with in my code to output values based on user selection ? TIA Stuart