Ejemplo n.º 1
0
 public function renderEditForm($tpl = null)
 {
     if ($this->context == null) {
         $this->context = JeproshopContext::getContext();
     }
     $app = JFactory::getApplication();
     $this->addToolBar();
     $this->sideBar = JHtmlSidebar::render();
     $bullet_common_field = false;
     if (JeproshopShopModelShop::isFeaturePublished()) {
         if (JeproshopShopModelShop::getContext() != JeproshopShopModelShop::CONTEXT_SHOP) {
             $display_multishop_checkboxes = true;
             $multishop_check = $app->input->get('multishop_check');
         }
         if (JeproshopShopModelShop::getContext() != JeproshopShopModelShop::CONTEXT_ALL) {
             $bullet_common_field = '<i class="icon-circle text-orange"></i>';
             $display_common_field = true;
         }
     }
     $this->languages = $this->context->controller->getLanguages();
     $default_language_id = JeproshopSettingModelSetting::getValue('default_lang');
     $display_multishop_checkboxes = JeproshopShopModelShop::isFeaturePublished() && JeproshopShopModelShop::getShopContext() != JeproshopShopModelShop::CONTEXT_SHOP;
     $combination_images_js = $this->getCombinationImagesJs();
     $this->assignRef('bullet_common_field', $bullet_common_field);
     if (JeproshopTools::isLoadedObject($this->product, 'product_id')) {
         $product_id = (int) $this->product->product_id;
     } else {
         $product_id = (int) $app->input->get('product_id');
     }
     $upload_max_file_size = JeproshopTools::getOctets(ini_get('upload_max_filesize'));
     $upload_max_file_size = $upload_max_file_size / 1024 / 1024;
     $country_display_tax_label = $this->context->country->display_tax_label;
     $has_combinations = $this->product->hasAttributes();
     $this->product_exists_in_shop = true;
     if (JeproshopTools::isLoadedObject($this->product, 'product_id') && JeproshopShopModelShop::isFeaturePublished() && JeproshopShopModelShop::getShopContext() == JeproshopShopModelShop::CONTEXT_SHOP && !$this->product->isAssociatedToShop($this->context->shop->shop_id)) {
         $this->product_exists_in_shop = false;
         $default_product = new JeproshopProductModelProduct();
     }
     if ($this->context->controller->default_form_language) {
         $this->languages = $this->context->controller->getLanguages();
     }
     if ($app->input->get('submit_form_ajax')) {
         $this->context->controller->use_ajax = true;
     }
     $this->helper = new JeproshopHelper();
     /** prepare fields data **/
     $this->initInformationsForm();
     $this->initPriceForm();
     $this->initAssociationsForm();
     $this->initAttributesForm();
     $this->initQuantitiesForm();
     $this->initImagesForm();
     $this->initCustomizationsForm();
     $this->initFeaturesForm();
     $this->initSuppliersForm();
     $this->initShippingForm();
     $this->initAttachmentForm();
     $this->assign('current_shop_url', $this->context->shop->getBaseURL());
     parent::display($tpl);
 }