Class: Magento::Category
Instance Attribute Summary
Attributes inherited from Abstract
#attributes
Class Method Summary
collapse
-
.assigned_products(category_id, store_id) ⇒ Object
-
.create(parent_id, category_data, store_view = nil) ⇒ Object
-
.delete(category_id) ⇒ Object
-
.find(category_id, store_view = nil, *args) ⇒ Object
-
.level(website = nil, store_view = nil, parent_category = nil) ⇒ Object
-
.move(category_id, parent_id, after_id) ⇒ Object
-
.tree(category_id = nil, store_view = nil) ⇒ Object
-
.update(parent_id, category_data, store_view = nil) ⇒ Object
Instance Method Summary
collapse
Methods inherited from Abstract
commit, connect, first, #initialize, #method_missing, #object_attributes=
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Magento::Abstract
Class Method Details
.assigned_products(category_id, store_id) ⇒ Object
67
68
69
70
|
# File 'lib/category.rb', line 67
def self.assigned_products(category_id, store_id)
connect
@connection.call("category.assignedProducts",category_id, store_id)
end
|
.create(parent_id, category_data, store_view = nil) ⇒ Object
39
40
41
42
43
44
45
46
|
# File 'lib/category.rb', line 39
def self.create(parent_id, category_data, store_view = nil)
connect
if store_view.nil?
@connection.call("category.create", parent_id, category_data)
else
@connection.call("category.create", parent_id, category_data, store_view)
end
end
|
.delete(category_id) ⇒ Object
62
63
64
65
|
# File 'lib/category.rb', line 62
def self.delete(category_id)
connect
@connection.call("category.delete",category_id)
end
|
.find(category_id, store_view = nil, *args) ⇒ Object
29
30
31
32
33
34
35
36
37
|
# File 'lib/category.rb', line 29
def self.find(category_id, store_view = nil, *args)
connect
fields = [store_view].compact
if fields.empty?
@connection.call("category.info",category_id)
else
@connection.call("category.info",category_id,fields,args)
end
end
|
.level(website = nil, store_view = nil, parent_category = nil) ⇒ Object
19
20
21
22
23
24
25
26
27
|
# File 'lib/category.rb', line 19
def self.level(website = nil, store_view = nil, parent_category = nil)
connect
fields = [website,store_view,parent_category].compact
if fields.empty?
@connection.call("category.level")
else
@connection.call("category.level",fields)
end
end
|
.move(category_id, parent_id, after_id) ⇒ Object
57
58
59
60
|
# File 'lib/category.rb', line 57
def self.move(category_id, parent_id, after_id)
connect
@connection.call("category.move", category_id, parent_id, after_id)
end
|
.tree(category_id = nil, store_view = nil) ⇒ Object
9
10
11
12
13
14
15
16
17
|
# File 'lib/category.rb', line 9
def self.tree(category_id = nil, store_view = nil)
connect
fields = [category_id,store_view].compact
if fields.empty?
@connection.call("category.level")
else
@connection.call("category.level",fields)
end
end
|
.update(parent_id, category_data, store_view = nil) ⇒ Object
48
49
50
51
52
53
54
55
|
# File 'lib/category.rb', line 48
def self.update(parent_id, category_data, store_view = nil)
connect
if store_view.nil?
@connection.call("category.update", parent_id, category_data)
else
@connection.call("category.update", parent_id, category_data, store_view)
end
end
|
Instance Method Details
#assign_product(product_id) ⇒ Object
80
81
82
83
|
# File 'lib/category.rb', line 80
def assign_product(product_id)
connect
@connection.call("category.assignProduct",self.id, product_id)
end
|
#assigned_products(store_id) ⇒ Object
#current_store(store_view = nil) ⇒ Object
4
5
6
7
|
# File 'lib/category.rb', line 4
def current_store(store_view = nil)
connect
@connection.call("category.currentStore",store_view)
end
|
#remove_product(product_id) ⇒ Object
90
91
92
93
|
# File 'lib/category.rb', line 90
def remove_product(product_id)
connect
@connection.call("category.removeProduct",self.id, product_id)
end
|
#update_product(product_id, position = 1) ⇒ Object
85
86
87
88
|
# File 'lib/category.rb', line 85
def update_product(product_id, position = 1)
connect
@connection.call("category.updateProduct",self.id, product_id, position)
end
|