| @@ 172-217 (lines=46) @@ | ||
| 169 | * @param $productClassId | |
| 170 | * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response | |
| 171 | */ | |
| 172 | public function up(Application $app, Request $request, $productClassId) | |
| 173 |     { | |
| 174 | $this->isTokenValid($app); | |
| 175 | ||
| 176 | // FRONT_CART_UP_INITIALIZE | |
| 177 | $event = new EventArgs( | |
| 178 | array( | |
| 179 | 'productClassId' => $productClassId, | |
| 180 | ), | |
| 181 | $request | |
| 182 | ); | |
| 183 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_CART_UP_INITIALIZE, $event); | |
| 184 | ||
| 185 |         try { | |
| 186 | ||
| 187 |             $productClassId = $event->getArgument('productClassId'); | |
| 188 | ||
| 189 | $app['eccube.service.cart']->upProductQuantity($productClassId)->save(); | |
| 190 | ||
| 191 | // FRONT_CART_UP_COMPLETE | |
| 192 | $event = new EventArgs( | |
| 193 | array( | |
| 194 | 'productClassId' => $productClassId, | |
| 195 | ), | |
| 196 | $request | |
| 197 | ); | |
| 198 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_CART_UP_COMPLETE, $event); | |
| 199 | ||
| 200 |             if ($event->hasResponse()) { | |
| 201 | return $event->getResponse(); | |
| 202 | } | |
| 203 | ||
| 204 |         } catch (CartException $e) { | |
| 205 | ||
| 206 | // FRONT_CART_UP_EXCEPTION | |
| 207 | $event = new EventArgs( | |
| 208 | array( | |
| 209 | 'exception' => $e, | |
| 210 | ), | |
| 211 | $request | |
| 212 | ); | |
| 213 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_CART_UP_EXCEPTION, $event); | |
| 214 | ||
| 215 |             if ($event->hasResponse()) { | |
| 216 | return $event->getResponse(); | |
| 217 | } | |
| 218 | ||
| 219 | $app->addRequestError($e->getMessage()); | |
| 220 | } | |
| @@ 234-277 (lines=44) @@ | ||
| 231 | * @param $productClassId | |
| 232 | * @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response | |
| 233 | */ | |
| 234 | public function down(Application $app, Request $request, $productClassId) | |
| 235 |     { | |
| 236 | $this->isTokenValid($app); | |
| 237 | ||
| 238 | // FRONT_CART_DOWN_INITIALIZE | |
| 239 | $event = new EventArgs( | |
| 240 | array( | |
| 241 | 'productClassId' => $productClassId, | |
| 242 | ), | |
| 243 | $request | |
| 244 | ); | |
| 245 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_CART_DOWN_INITIALIZE, $event); | |
| 246 | ||
| 247 |         try { | |
| 248 |             $productClassId = $event->getArgument('productClassId'); | |
| 249 | $app['eccube.service.cart']->downProductQuantity($productClassId)->save(); | |
| 250 | ||
| 251 | // FRONT_CART_UP_COMPLETE | |
| 252 | $event = new EventArgs( | |
| 253 | array( | |
| 254 | 'productClassId' => $productClassId, | |
| 255 | ), | |
| 256 | $request | |
| 257 | ); | |
| 258 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_CART_DOWN_COMPLETE, $event); | |
| 259 | ||
| 260 |             if ($event->hasResponse()) { | |
| 261 | return $event->getResponse(); | |
| 262 | } | |
| 263 | ||
| 264 |         } catch (CartException $e) { | |
| 265 | ||
| 266 | // FRONT_CART_DOWN_EXCEPTION | |
| 267 | $event = new EventArgs( | |
| 268 | array( | |
| 269 | 'exception' => $e, | |
| 270 | ), | |
| 271 | $request | |
| 272 | ); | |
| 273 | $app['eccube.event.dispatcher']->dispatch(EccubeEvents::FRONT_CART_DOWN_EXCEPTION, $event); | |
| 274 | ||
| 275 |             if ($event->hasResponse()) { | |
| 276 | return $event->getResponse(); | |
| 277 | } | |
| 278 | ||
| 279 | $app->addRequestError($e->getMessage()); | |
| 280 | } | |