Ejemplo n.º 1
0
 function images($id)
 {
     $this->admin_navigation->module_link('Manage Galleries', site_url('admincp/gallery'));
     $this->admin_navigation->module_link('Edit this Gallery', site_url('admincp/gallery/edit/' . $id));
     $this->load->model('publish/content_model');
     $gallery = $this->content_model->get_content($id);
     // get images
     $this->load->model('gallery/gallery_image_model');
     $gallery['images'] = $this->gallery_image_model->get_images($gallery['id']);
     // gallery
     $this->load->library('image_gallery_form');
     $image_gallery = new Image_gallery_form();
     //$gallery->label('Upload New Images');
     //$gallery->name('product_images');
     $image_gallery->show_upload_button(FALSE);
     $this->load->helper('format_size');
     $this->load->helper('image_thumb');
     $data = array('form_action' => site_url('admincp/gallery/post_images/' . $gallery['id']), 'gallery' => $gallery, 'images' => $image_gallery->display());
     $this->load->view('gallery', $data);
 }
Ejemplo n.º 2
0
 function add()
 {
     $this->load->helper('form');
     // first part of form is generated by Admin_form
     $this->load->library('admin_form');
     $form = new Admin_form();
     $form->fieldset('Basic Information');
     $form->text('Product Name', 'name', '', 'e.g, "Adidas Cross Trainers", or "CRBO2010 Conference Tickets"', TRUE, FALSE, TRUE);
     $form->textarea('Description', 'description', '', 'This description will appear on the product page.', TRUE, 'basic', TRUE);
     $this->load->model('collections_model');
     $collections = $this->collections_model->get_tiered_collections();
     $options = array();
     $options[0] = 'No collections';
     foreach ($collections as $data) {
         $options[$data['id']] = $data['name'];
     }
     $form->dropdown('Collection(s)', 'collections[]', $options, array(), TRUE, FALSE, 'Select multiple collections by holding the CTRL or CMD button and selecting multiple options.', TRUE);
     $form->fieldset('Product Properties');
     $form->text('Price (' . setting('currency_symbol') . ')', 'price', '', FALSE, TRUE, '9.95', FALSE, '60px', 'price');
     $form->text('Weight (' . setting('weight_unit') . ')', 'weight', '0', FALSE, TRUE, '0', FALSE, '60px', 'weight');
     $tax = form_checkbox('taxable', '1', TRUE);
     $form->value_row('&nbsp;', $tax . ' <b><a target="_blank" href="' . site_url('admincp/store/taxes') . '">Tax rules</a> apply to this product</b>');
     $require_shipping = form_checkbox('requires_shipping', '1', TRUE);
     $form->value_row('&nbsp;', $require_shipping . ' <b>Require a shipping address for this product</b> (not necessary for digital products or services)');
     $form->fieldset('Inventory Management');
     $form->text('SKU Number', 'sku', '', '(Optional) Enter a unique identifier of the product for inventory management.', FALSE, FALSE, FALSE, '200px', 'sku');
     $inventory = form_checkbox(array('name' => 'track_inventory', 'value' => '1', 'checked' => FALSE, 'id' => 'track_inventory'));
     $form->value_row('&nbsp;', $inventory . ' <b>Track inventory for this product?</b>');
     $form->text('Quantity in Stock', 'inventory', '', FALSE, FALSE, FALSE, FALSE, '60px', 'inventory');
     $options = array('0' => 'Don\'t sell at zero inventory', '1' => 'Sell at zero inventory');
     $form->radio('&nbsp;', 'inventory_allow_oversell', $options, '1', FALSE, FALSE, FALSE, 'inventory_allow_at_zero');
     // image gallery
     $this->load->library('image_gallery_form');
     $gallery = new Image_gallery_form();
     $gallery->label('Product Images');
     $gallery->name('product_images');
     // custom fields
     if (setting('products_custom_field_group') != '') {
         $this->load->library('custom_fields/form_builder');
         $this->form_builder->build_form_from_group(setting('products_custom_field_group'));
         $custom_fields = $this->form_builder->output_admin();
     } else {
         $custom_fields = FALSE;
     }
     // load usergroups for membership tiers
     $this->load->model('users/usergroup_model');
     $usergroups = $this->usergroup_model->get_usergroups();
     $options = array();
     $options[0] = '';
     foreach ($usergroups as $group) {
         $options[$group['id']] = $group['name'];
     }
     $usergroups = $options;
     // get files from product_files
     $files = $this->map_product_files();
     // get product options that might be re-used
     $this->load->model('store/product_option_model');
     $shared_product_options = $this->product_option_model->get_options(array('shared' => '1'));
     $data = array('form' => $form->display(), 'gallery' => $gallery->display(), 'form_action' => site_url('admincp/store/post_product/new'), 'form_title' => 'Add New Product', 'usergroups' => $usergroups, 'shared_product_options' => $shared_product_options, 'files' => $files, 'custom_fields' => $custom_fields);
     $this->load->view('product_form.php', $data);
 }