|
@@ 54-63 (lines=10) @@
|
| 51 |
|
* - (string) errors: message of error |
| 52 |
|
* @copyright (c) 2013, ImageCMS |
| 53 |
|
*/ |
| 54 |
|
public function createBrandDiscount($data) { |
| 55 |
|
|
| 56 |
|
if (!$this->discount_model_admin->checkEntityExists('brand', $data['brand_id'])) { |
| 57 |
|
$this->error[] = lang('Entity does not exists!', 'mod_discount'); |
| 58 |
|
} |
| 59 |
|
$data['type_discount'] = 'brand'; |
| 60 |
|
$data['brand']['brand_id'] = $data['brand_id']; |
| 61 |
|
unset($data['brand_id']); |
| 62 |
|
return $this->create($data); |
| 63 |
|
} |
| 64 |
|
|
| 65 |
|
/** |
| 66 |
|
* create category discount |
|
@@ 116-125 (lines=10) @@
|
| 113 |
|
* - (string) errors: message of error |
| 114 |
|
* @copyright (c) 2013, ImageCMS |
| 115 |
|
*/ |
| 116 |
|
public function createProductDiscount($data) { |
| 117 |
|
|
| 118 |
|
if (!$this->discount_model_admin->checkEntityExists('product', $data['product_id'])) { |
| 119 |
|
$this->error[] = lang('Entity does not exists!', 'mod_discount'); |
| 120 |
|
} |
| 121 |
|
$data['type_discount'] = 'product'; |
| 122 |
|
$data['product']['product_id'] = $data['product_id']; |
| 123 |
|
unset($data['product_id']); |
| 124 |
|
return $this->create($data); |
| 125 |
|
} |
| 126 |
|
|
| 127 |
|
/** |
| 128 |
|
* create user discount |
|
@@ 146-155 (lines=10) @@
|
| 143 |
|
* - (string) errors: message of error |
| 144 |
|
* @copyright (c) 2013, ImageCMS |
| 145 |
|
*/ |
| 146 |
|
public function createUserDiscount($data) { |
| 147 |
|
|
| 148 |
|
if (!$this->discount_model_admin->checkEntityExists('user', $data['user_id'])) { |
| 149 |
|
$this->error[] = lang('Entity does not exists!', 'mod_discount'); |
| 150 |
|
} |
| 151 |
|
$data['type_discount'] = 'user'; |
| 152 |
|
$data['user']['user_id'] = $data['user_id']; |
| 153 |
|
unset($data['user_id']); |
| 154 |
|
return $this->create($data); |
| 155 |
|
} |
| 156 |
|
|
| 157 |
|
/** |
| 158 |
|
* create user group discount discount |
|
@@ 176-185 (lines=10) @@
|
| 173 |
|
* - (string) errors: message of error |
| 174 |
|
* @copyright (c) 2013, ImageCMS |
| 175 |
|
*/ |
| 176 |
|
public function createUserGroupDiscount($data) { |
| 177 |
|
|
| 178 |
|
if (!$this->discount_model_admin->checkEntityExists('group_user', $data['group_id'])) { |
| 179 |
|
$this->error[] = lang('Entity does not exists!', 'mod_discount'); |
| 180 |
|
} |
| 181 |
|
$data['type_discount'] = 'group_user'; |
| 182 |
|
$data['group_user']['group_id'] = $data['group_id']; |
| 183 |
|
unset($data['group_id']); |
| 184 |
|
return $this->create($data); |
| 185 |
|
} |
| 186 |
|
|
| 187 |
|
/** |
| 188 |
|
* create comulativ discount |