Example #1
0
 protected function displayEdit()
 {
     $item = $this->getItem();
     if (empty($item) || $item->product_type != 'giftcards') {
         \Dsc\System::addMessage('Item is not a giftcard', 'error');
         $this->app->reroute('/admin/shop/giftcards');
     }
     $f3 = \Base::instance();
     $flash = \Dsc\Flash::instance();
     $variants = array();
     if ($flashed_variants = $flash->old('variants')) {
         foreach ($flashed_variants as $variant) {
             $key = implode("-", (array) $variant['attributes']);
             if (empty($key)) {
                 $key = $variant['id'];
             }
             $variants[$key] = $variant;
         }
     }
     $old = array_merge($flash->get('old'), array('variants' => $variants));
     $flash->store($old);
     $model = new \Shop\Models\Categories();
     $categories = $model->getList();
     \Base::instance()->set('categories', $categories);
     \Base::instance()->set('selected', 'null');
     $all_tags = $this->getModel()->getTags();
     \Base::instance()->set('all_tags', $all_tags);
     $this->app->set('meta.title', 'Edit Gift Card | Shop');
     $view = \Dsc\System::instance()->get('theme');
     $view->event = $view->trigger('onDisplayShopProductsEdit', array('item' => $this->getItem(), 'tabs' => array(), 'content' => array()));
     echo $view->render('Shop\\Admin\\Views::giftcards/edit.php');
 }
Example #2
0
 protected function displayEdit()
 {
     $this->app->set('pagetitle', 'Edit Category');
     $model = new \Shop\Models\Categories();
     $categories = $model->emptyState()->getList();
     \Base::instance()->set('categories', $categories);
     $flash = \Dsc\Flash::instance();
     $selected = $flash->old('parent');
     \Base::instance()->set('selected', $selected);
     $this->app->set('allow_preview', $this->canPreview(true));
     $view = \Dsc\System::instance()->get('theme');
     $view->event = $view->trigger('onDisplayShopCategoriesEdit', array('item' => $this->getItem(), 'tabs' => array(), 'content' => array()));
     $this->app->set('meta.title', 'Edit Category | Shop');
     echo $view->render('Shop/Admin/Views::categories/edit.php');
 }
Example #3
0
 protected function displayCreate()
 {
     $model = new \Shop\Models\Categories();
     $categories = $model->getList();
     $this->app->set('categories', $categories);
     $this->app->set('selected', 'null');
     $item = $this->getItem();
     $selected = array();
     $flash = \Dsc\Flash::instance();
     $use_flash = \Dsc\System::instance()->getUserState('use_flash.' . $this->create_item_route);
     if (!$use_flash) {
         // this is a brand-new create, so store the prefab data
         $flash->store($item->cast());
     }
     $input = $flash->old('category_ids');
     if (!empty($input)) {
         foreach ($input as $id) {
             $id = $this->inputfilter->clean($id, 'alnum');
             $selected[] = array('id' => $id);
         }
     }
     $flash->store($flash->get('old') + array('categories' => $selected));
     $all_tags = $this->getModel()->getTags();
     $this->app->set('all_tags', $all_tags);
     $this->app->set('meta.title', 'Create Product | Shop');
     $view = \Dsc\System::instance()->get('theme');
     $view->event = $view->trigger('onDisplayShopProductsEdit', array('item' => $item, 'tabs' => array(), 'content' => array()));
     switch ($item->product_type) {
         case "giftcard":
         case "giftcards":
             echo $view->render('Shop\\Admin\\Views::giftcards/create.php');
             break;
         default:
             echo $view->render('Shop\\Admin\\Views::products/create.php');
             break;
     }
 }
Example #4
0
 protected function displayEdit()
 {
     $item = $this->getItem();
     $flash = \Dsc\Flash::instance();
     $variants = array();
     if ($flashed_variants = $flash->old('variants')) {
         foreach ($flashed_variants as $variant) {
             $key = implode("-", (array) $variant['attributes']);
             if (empty($key)) {
                 $key = $variant['id'];
             }
             $variants[$key] = $variant;
         }
     }
     $old = array_merge($flash->get('old'), array('variants' => $variants));
     $flash->store($old);
     $model = new \Shop\Models\Categories();
     $categories = $model->getList();
     $this->app->set('categories', $categories);
     $this->app->set('selected', 'null');
     $all_tags = $this->getModel()->getTags();
     $this->app->set('all_tags', $all_tags);
     $this->app->set('meta.title', 'Edit Product | Shop');
     $this->app->set('allow_preview', $this->canPreview(true));
     $view = \Dsc\System::instance()->get('theme');
     $view->event = $view->trigger('onDisplayShopProductsEdit', array('item' => $item, 'tabs' => array(), 'content' => array()));
     switch ($item->product_type) {
         case "giftcard":
         case "giftcards":
             echo $view->render('Shop\\Admin\\Views::giftcards/edit.php');
             break;
         default:
             echo $view->render('Shop\\Admin\\Views::products/edit.php');
             break;
     }
 }