Skip to content
This repository has been archived by the owner on Aug 13, 2021. It is now read-only.

only Products beloning to Store are allowed to be populated to an order #93

Open
ghost opened this issue Apr 11, 2014 · 0 comments
Open

Comments

@ghost
Copy link

ghost commented Apr 11, 2014

I'm not good on forking/pushing, so might be please somebody feel free to implement it into the master.

currently we are able to populate EVERY variant_id to an order. customers might play around with it (if you run 5 stores with same products and different prices, that will help you stop losing money).
unless the product doesn't belong to the store, just redirect to startpage.

Spree::OrdersController.class_eval do
  before_filter :product_belongs_to_store, only: [:populate]
  private    
  def product_belongs_to_store
    redirect_to "/", message: "Couldn't find Product" unless Spree::Variant.find(params[:variant_id]).product.store == current_store
   end  
end
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants