Skip to content

Commit

Permalink
Checking in the missing file and optimizing the code
Browse files Browse the repository at this point in the history
  • Loading branch information
Kanwal committed Nov 20, 2014
1 parent 7fef749 commit d26072e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
10 changes: 5 additions & 5 deletions promo/app/controllers/spree/store_controller_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ def apply_coupon_code
elsif previous_promo.present? and promo.present?
flash[:error] = t(:coupon_code_better_exists)
false
elsif (promo.id == 89 and exclusion_rule.present? and !exclusion_rule.eligible?(@order))
items = exclusion_eligible_products && @order.products.map(&:name)
flash["product-exclusion-preorder-warning"] = "#{t(:coupon_code_not_for_preorders)}, #{t(:go_back_to)} <a href='#{spree.cart_path}'>#{t(:shopping_cart)}</a> #{t(:remove_items)}: #{items.join(', ')}".html_safe
false
elsif (exclusion_rule.present? and !exclusion_rule.eligible?(@order))
items = exclusion_eligible_products && @order.products.map(&:name)
flash["product-exclusion-warning"] = "#{t(:product_exclusion_rule_warning)} #{t(:listed_items)}: #{items.join(', ')}"
if promo.id == 89
flash["product-exclusion-preorder-warning"] = "#{t(:coupon_code_not_for_preorders)}, #{t(:go_back_to)} <a href='#{spree.cart_path}'>#{t(:shopping_cart)}</a> #{t(:remove_items)}: #{items.join(', ')}".html_safe
else
flash["product-exclusion-warning"] = "#{t(:product_exclusion_rule_warning)} #{t(:listed_items)}: #{items.join(', ')}"
end
false
elsif promo.present?
flash[:error] = t(:coupon_code_not_eligible)
Expand Down
7 changes: 6 additions & 1 deletion promo/config/locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,16 @@ en:
coupon_code_already_applied: The coupon code has already been applied to this order
coupon_code_better_exists: The previously applied coupon code results in a better deal
coupon_code_not_found: The coupon code you entered doesn't exist. Please try again.
coupon_code_not_for_preorders: You can't use a free shipping coupon on an order that contains one of the new pre-order items. Please place a separate order for the pre-order items.
coupon_code_not_for_preorders: Oops! The Free Shipping coupon doesn't apply to the new pre-order items in your cart. You will need to place a separate order for the pre-order items. To get the Free Shipping discount on this order
coupon_code_max_usage: Coupon code usage limit exceeded
coupon_code_not_eligible: This coupon code is not eligible for this order
product_exclusion_rule_warning: Oops! Your cart contains item(s) that will not work with this promotion.
listed_items: The listed item(s) must be removed before the discount can apply
editing_promotion: Editing Promotion
current_promotion_usage: 'Current Usage: %{count}'
go_back_to: please go back to the
remove_items: and remove the following items
shopping_cart: Shopping Cart
events:
spree:
checkout:
Expand Down

0 comments on commit d26072e

Please sign in to comment.