18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
# File 'app/controllers/admin/vouchers_controller.rb', line 18
def new
@default_attributes = %w(price name description weight sku stock product_type_id brand_id).collect do |n|
[t(n, :count => 1), n]
end
@attributes = Attribute.all(:select => 'id, access_method').collect do |a|
[a.name, a.access_method]
end
@cart_attributes = [
[t(:quantity,:scope=>[:special_offer,:cart]),'Total items quantity'],
[t(:weight,:scope=>[:special_offer,:cart]), 'Total weight'],
[t(:price,:scope=>[:special_offer,:cart]),'Total amount'],
[t(:shipping,:scope=>[:special_offer,:cart]),'Shipping method']
]
@disable_attributes = t(:disabled,:scope=>[:special_offer,:attributes])
@for = [
[t(:product_in_cart,:scope=>[:special_offer,:_for]), 'Product'],
[t(:cart,:scope=>[:special_offer,:_for]), 'Cart']
]
@conditions = [
[t(:is,:scope=>[:special_offer,:conditions]), "=="],
[t(:is_not,:scope=>[:special_offer,:conditions]),"not=="],
[t(:equal_or_greater_than,:scope=>[:special_offer,:conditions]),">="],
[t(:equal_or_less_than,:scope=>[:special_offer,:conditions]),"<="],
[t(:greater_than,:scope=>[:special_offer,:conditions]), ">"],
[t(:less_than,:scope=>[:special_offer,:conditions]),"<"]
]
@end = [
[t(:date,:scope=>[:special_offer,:end]),'Date'],
[t(:total_use,:scope=>[:special_offer,:end]),'Total number of offer use'],
[t(:user_total_use,:scope=>[:special_offer,:end]),'Customer number of offer use']
]
@discount_type = [
[t(:percent,:scope=>[:special_offer,:action]),0],
[t(:fixed,:scope=>[:special_offer,:action]),1]
]
@product_attributes = [t(:main,:scope=>[:special_offer,:attributes,:disabled])]+
@default_attributes+
[t(:attribute,:scope=>[:special_offer,:attributes,:disabled])]+
@attributes
@products = Product.actives(:select => 'products.id, sku', :order => 'sku')
end
|