/**
  * Set default medias for this controller
  */
 public function postProcess()
 {
     if (Tools::getIsset('product_id')) {
         $output = $this->getProductAttributeCombinations(Tools::getValue('product_id'));
         echo json_encode($output);
         parent::postProcess();
         die;
     }
 }
Example #2
0
 public function postProcess()
 {
     parent::postProcess();
     if (Tools::isSubmit('submitReorder') && ($id_order = (int) Tools::getValue('id_order'))) {
         $oldCart = new Cart(Order::getCartIdStatic($id_order, $this->context->customer->id));
         $duplication = $oldCart->duplicate();
         if (!$duplication || !Validate::isLoadedObject($duplication['cart'])) {
             $this->errors[] = $this->trans('Sorry. We cannot renew your order.', array(), 'Shop.Notifications.Error');
         } elseif (!$duplication['success']) {
             $this->errors[] = $this->trans('Some items are no longer available, and we are unable to renew your order.', array(), 'Shop.Notifications.Error');
         } else {
             $this->context->cookie->id_cart = $duplication['cart']->id;
             $context = $this->context;
             $context->cart = $duplication['cart'];
             CartRule::autoAddToCart($context);
             $this->context->cookie->write();
             Tools::redirect('index.php?controller=order');
         }
     }
     $this->bootstrap();
 }