Exemple #1
0
 public function renderEditForm($tpl = null)
 {
     if (!isset($this->context)) {
         $this->context = JeproshopContext::getContext();
     }
     $attributes_groups = JeproshopAttributeGroupModelAttributeGroup::getAttributesGroups($this->context->language->lang_id);
     $this->assignRef('attribute_groups', $attributes_groups);
     $helper = new JeproshopHelper();
     $this->assignRef('helper', $helper);
     $this->addToolBar();
     $this->sideBar = JHtmlSideBar::render();
     parent::display($tpl);
 }
Exemple #2
0
 private function initAttributesForm()
 {
     if (!JeproshopCombinationModelCombination::isFeaturePublished()) {
         $settingPanelLink = '<a href="#" >' . JText::_('COM_JEPROSHOP_PERFORMANCE_LABEL') . '</a>';
         JError::raiseWarning(500, JText::_('COM_JEPROSHOP_FEATURE_HAS_BEEN_DISABLED_MESSAGE') . $settingPanelLink);
     } elseif (JeproshopTools::isLoadedObject($this->product, 'product_id')) {
         if ($this->product_exists_in_shop) {
             if ($this->product->is_virtual) {
                 JError:
                 raiseWarning(500, JText::_('COM_JEPROSHOP_VIRTUAL_PRODUCT_CANNOT_HAVE_COMBINATIONS'));
             } else {
                 $attribute_js = array();
                 $attributes = JeproshopAttributeModelAttribute::getAttributes($this->context->language->lang_id, true);
                 if ($attributes) {
                     foreach ($attributes as $key => $attribute) {
                         $attribute_js[$attribute->attribute_group_id][$attribute->attribute_id] = $attribute->name;
                     }
                 }
                 $this->assignRef('attributeJs', $attribute_js);
                 $attributes_groups = JeproshopAttributeGroupModelAttributeGroup::getAttributesGroups($this->context->language->lang_id);
                 $this->assignRef('attributes_groups', $attributes_groups);
                 $images = JeproshopImageModelImage::getImages($this->context->language->lang_id, $this->product->product_id);
                 $weight_unit = JeproshopSettingModelSetting::getValue('weight_unit');
                 $this->assignRef('weight_unit', $weight_unit);
                 $reasons = JeproshopStockMovementReasonModelStockMovementReason::getStockMovementReasons();
                 $this->assignRef('reasons', $reasons);
                 //$this->assignRef('minimal_quantity', );
                 $this->assignRef('available_date', $available_date);
                 $stock_mvt_default_reason = JeproshopSettingModelSetting::getValue('default_stock_mvt_reason');
                 $this->assignRef('default_stock_mvt_reason', $stock_mvt_default_reason);
                 $i = 0;
                 /*$type = JeproshopImageTypeModelImageType::getByNameNType('%', 'products', 'height');
                   if (isset($type->name)){
                       $data->assign('imageType', $type['name']);
                   }else
                       $data->assign('imageType', 'small_default'); */
                 //$this->assignRef('imageWidth', (isset($image_type->width) ? (int)($image_type->width) : 64) + 25);
                 foreach ($images as $k => $image) {
                     $images[$k]->obj = new JeproshopImageModelImage($image->image_id);
                     ++$i;
                 }
                 $this->assignRef('attribute_images', $images);
                 $attributeList = $this->renderAttributesList($this->product, $this->currency);
                 $this->assignRef('list', $attributeList);
                 $combination_exists = JeproshopShopModelShop::isFeaturePublished() && JeproshopShopModelShop::getContextShopGroup()->share_stock && count(JeproshopAttributeGroupModelAttributeGroup::getAttributesGroups($this->context->language->lang_id)) > 0 && $this->product->hasAttributes();
                 $this->assignRef('combination_exists', $combination_exists);
             }
         }
     }
 }