Example #1
0
 private function initInformationsForm()
 {
     if (!$this->context->controller->default_form_language) {
         $this->languages = $this->context->controller->getLanguages();
     }
     $app = JFactory::getApplication();
     $product_name_redirected = JeproshopProductModelProduct::getProductName((int) $this->product->product_redirected_id, null, (int) $this->context->language->lang_id);
     $this->assignRef('product_name_redirected', $product_name_redirected);
     /*
      * Form for adding a virtual product like software, mp3, etc...
      */
     $product_download = new JeproshopProductDownloadModelProductDownload();
     $product_download_id = $product_download->getIdFromProductId($this->product->product_id);
     if ($product_download_id) {
         $product_download = new JeproshopProductDownloadModelProductDownload($product_download_id);
     }
     $this->product->productDownload = $product_download;
     $cache_default_attribute = (int) $this->product->cache_default_attribute;
     $product_props = array();
     // global informations
     array_push($product_props, 'reference', 'ean13', 'upc', 'available_for_order', 'show_price', 'online_only', 'manufacturer_id');
     // specific / detailed information
     array_push($product_props, 'width', 'height', 'weight', 'published', 'is_virtual', 'cache_default_attribute', 'uploadable_files', 'text_fields');
     // prices
     array_push($product_props, 'price', 'wholesale_price', 'tax_rules_group_id', 'unit_price_ratio', 'on_sale', 'unity', 'minimal_quantity', 'additional_shipping_cost', 'available_now', 'available_later', 'available_date');
     if (JeproshopSettingModelSetting::getValue('use_eco_tax')) {
         array_push($product_props, 'ecotax');
     }
     $this->product->name['class'] = 'updateCurrentText';
     if (!$this->product->product_id || JeproshopSettingModelSetting::getValue('force_friendly_product')) {
         $this->product->name['class'] .= ' copy2friendlyUrl';
     }
     $images = JeproshopImageModelImage::getImages($this->context->language->lang_id, $this->product->product_id);
     if (is_array($images)) {
         foreach ($images as $k => $image) {
             //$images[$k]->src = $this->context->controller->getImageLink($this->product->link_rewrite[$this->context->language->lang_id], $this->product->product_id.'-'.$image->image_id, 'small_default'); echo $images[$k]->src;
         }
         $this->assignRef('product_images', $images);
     }
     $imagesTypes = JeproshopImageTypeModelImageType::getImagesTypes('products');
     $this->assignRef('imagesTypes', $imagesTypes);
     $this->product->tags = JeproshopTagModelTag::getProductTags($this->product->product_id);
     $product_type = (int) $app->input->get('product_type', $this->product->getType());
     $this->assignRef('product_type', $product_type);
     $is_in_pack = (int) JeproshopProductPack::isPacked($this->product->product_id);
     $this->assignRef('is_in_pack', $is_in_pack);
     $check_product_association_ajax = false;
     if (JeproshopShopModelShop::isFeaturePublished() && JeproshopShopModelShop::getShopContext() != JeproshopShopModelShop::CONTEXT_ALL) {
         $check_product_association_ajax = true;
     }
     $iso_tiny_mce = $this->context->language->iso_code;
     $iso_tiny_mce = file_exists(JURI::base() . '/components/com_jeproshop/assets/javascript/tiny_mce/langs/' . $iso_tiny_mce . '.js') ? $iso_tiny_mce : 'en';
     $this->assignRef('iso_tiny_mce', $iso_tiny_mce);
     $this->assignRef('check_product_association_ajax', $check_product_association_ajax);
     $combinationImageJs = $this->getCombinationImagesJs();
     $this->assignRef('combinationImagesJs', $combinationImageJs);
 }