示例#1
0
 public function renderEditForm($tpl = null)
 {
     if (!isset($this->context)) {
         $this->context = JeproshopContext::getContext();
     }
     $image = COM_JEPROSHOP_SUPPLIER_IMAGE_DIR . $this->supplier->supplier_id . '.jpg';
     $imageUrl = JeproshopImageManager::thumbnail($image, 'supplier_' . $this->supplier->supplier_id . '.' . $this->imageType, 350, $this->imageType, true, true);
     $imageSize = file_exists($image) ? filesize($image) / 1000 : false;
     $helper = new JeproshopHelper();
     $this->assignRef('helper', $helper);
     $address = $this->supplier->getSupplierAddress();
     $this->assignRef('address', $address);
     $countries = JeproshopCountryModelCountry::getStaticCountries($this->context->language->lang_id, false);
     $this->assignRef('countries', $countries);
     $this->addToolBar();
     $this->sideBar = JHtmlSideBar::render();
     parent::display($tpl);
 }
示例#2
0
 protected function getProducts($order)
 {
     $products = $order->getProducts();
     foreach ($products as &$product) {
         if ($product->image != null) {
             $name = 'product_mini_' . (int) $product->product_id . (isset($product->product_attribute_id) ? '_' . (int) $product->product_attribute_id : '') . '.jpg';
             // generate image cache, only for back office
             $product->image_tag = JeproshopImageManager::thumbnail(COM_JEPROSHOP_IMAGE_DIR . 'products/' . $product->image->getExistingImagePath() . '.jpg', $name, 45, 'jpg');
             if (file_exists(COM_JEPROSHOP_IMAGE_DIR . $name)) {
                 $product->image_size = getimagesize(COM_JEPROSHOP_IMAGE_DIR . $name);
             } else {
                 $product->image_size = false;
             }
         }
     }
     return $products;
 }
示例#3
0
 public function renderEditForm($tpl = null)
 {
     $this->loadObject(true);
     $app = JFactory::getApplication();
     if (!isset($this->context)) {
         $this->context = JeproshopContext::getContext();
     }
     $shop_id = JeproshopContext::getContext()->shop->shop_id;
     $selected_categories = array(isset($this->context->controller->category->parent_id) && $this->context->controller->category->isParentCategoryAvailable($shop_id) ? (int) $this->context->controller->category->parent_id : $app->input->get('parent_id', JeproshopCategoryModelCategory::getRootCategory()->category_id));
     $unidentified = new JeproshopGroupModelGroup(JeproshopSettingModelSetting::getValue('unidentified_group'));
     $guest = new JeproshopGroupModelGroup(JeproshopSettingModelSetting::getValue('guest_group'));
     $default = new JeproshopGroupModelGroup(JeproshopSettingModelSetting::getValue('customer_group'));
     $unidentified_group_information = '<b>' . $unidentified->name[$this->context->language->lang_id] . '</b> ' . JText::_('COM_JEPROSHOP_ALL_PEOPLE_WITHOUT_A_VALID_CUSTOMER_ACCOUNT_MESSAGE');
     $guest_group_information = '<b>' . $guest->name[$this->context->language->lang_id] . '</b> ' . JText::_('COM_JEPROSHOP_CUSTOMER_WHO_PLACED_AN_ORDER_WITH_THE_GUEST_CHECKOUT_MESSAGE');
     $default_group_information = '<b>' . $default->name[$this->context->language->lang_id] . '</b> ' . JText::_('COM_JEPROSHOP_ALL_PEOPLE_WHO_HAVE_CREATED_AN_CREATED_AN_ACCOUNT_ON_THIS_SITE_MESSAGE');
     $this->assignRef('unidentified_group_information', $unidentified_group_information);
     $this->assignRef('guest_group_information', $guest_group_information);
     $this->assignRef('default_group_information', $default_group_information);
     $image = COM_JEPROSHOP_CATEGORY_IMAGE_DIR . $this->context->controller->category->category_id . '.jpg';
     $image_url = JeproshopImageManager::thumbnail($image, 'category_' . $this->context->controller->category->category_id . '.jpg', 350, 'jpg', true, true);
     $imageSize = file_exists($image) ? filesize($image) / 1000 : false;
     $shared_category = JeproshopTools::isLoadedObject($this->context->controller->category, 'category_id') && $this->context->controller->category->hasMultishopEntries();
     $this->assignRef('shared_category', $shared_category);
     $allow_accented_chars_url = (int) JeproshopSettingModelSetting::getValue('allow_accented_chars_url');
     $this->assignRef('allow_accented_chars_url', $allow_accented_chars_url);
     //$this->assignRef('selected_categories', $selected_categories);
     $categories_tree = new JeproshopCategoriesTree('jform_categories_tree', JText::_('COM_JEPROSHOP_CATEGORIES_LABEL'), null, $this->context->language->lang_id);
     $categories_tree->setTreeTemplate('associated_categories')->setSelectedCategories($selected_categories)->setUseCheckBox(true)->setInputName('parent_id');
     $categories_data = $categories_tree->render();
     $this->assignRef('categories_tree', $categories_data);
     $image = JeproshopImageManager::thumbnail(COM_JEPROSHOP_CATEGORY_IMAGE_DIR . '/' . $this->context->controller->category->category_id . '.jpg', 'category_' . (int) $this->context->controller->category->category_id . '.jpg', 350, 'jpg', true);
     $this->assignRef('image', $image ? $image : false);
     $size = $image ? filesize(COM_JEPROSHOP_CATEGORY_IMAGE_DIR . '/' . $this->context->controller->category->category_id . 'jpg') / 1000 : false;
     $this->assignRef('size', $size);
     $category_group_ids = $this->context->controller->category->getGroups();
     $groups = JeproshopGroupModelGroup::getGroups($this->context->language->lang_id);
     //if empty $carrier_groups_ids : object creation : we set the default groups
     if (empty($category_group_ids)) {
         $preSelected = array(JeproshopSettingModelSetting::getValue('unidentified_group'), JeproshopSettingModelSetting::getValue('guest_group'), JeproshopSettingModelSetting::getValue('customer_group'));
         $category_group_ids = array_merge($category_group_ids, $preSelected);
     }
     foreach ($groups as $group) {
         $groupBox = $app->input->get('group_box_' . $group->group_id, in_array($group->group_id, $category_group_ids));
         $this->assignRef('group_box_' . $group->group_id, $groupBox);
     }
     $is_root_category = (bool) $app->input->get('is_root_category');
     $this->assignRef('is_root_category', $is_root_category);
     $helper = new JeproshopHelper();
     $this->assignRef('helper', $helper);
     $this->assignRef('groups', $groups);
     $this->addToolBar();
     $this->sideBar = JHtmlSideBar::render();
     parent::display($tpl);
 }
示例#4
0
 public function renderView($tpl = null)
 {
     if (!$this->loadObject(true)) {
         return;
     }
     if (!isset($this->context)) {
         $this->context = JeproshopContext::getContext();
     }
     $customer = new JeproshopCustomerModelCustomer($this->cart->customer_id);
     $currency = new JeproshopCurrencyModelCurrency($this->cart->currency_id);
     $this->context->cart = $this->cart;
     $this->context->currency = $currency;
     $this->context->customer = $customer;
     //$this->toolbar_title = sprintf($this->l('Cart #%06d'), $this->context->cart->cart_id);
     $products = $this->cart->getProducts();
     $customized_datas = JeproshopProductModelProduct::getAllCustomizedDatas((int) $this->cart->cart_id);
     JeproshopProductModelProduct::addCustomizationPrice($products, $customized_datas);
     $summary = $this->cart->getSummaryDetails();
     /* Display order information */
     $order_id = (int) JeproshopOrderModelOrder::getOrderIdByCartId($this->cart->cart_id);
     $order = new JeproshopOrderModelOrder($order_id);
     if (JeproshopTools::isLoadedObject($order, 'order_id')) {
         $tax_calculation_method = $order->getTaxCalculationMethod();
         $shop_id = (int) $order->shop_id;
     } else {
         $shop_id = (int) $this->cart->shop_id;
         $tax_calculation_method = JeproshopGroupModelGroup::getPriceDisplayMethod(JeproshopGroupModelGroup::getCurrent()->group_id);
     }
     if ($tax_calculation_method == COM_JEPROSHOP_TAX_EXCLUDED) {
         $total_products = $summary->total_products;
         $total_discounts = $summary->total_discounts_tax_exc;
         $total_wrapping = $summary->total_wrapping_tax_exc;
         $total_price = $summary->total_price_without_tax;
         $total_shipping = $summary->total_shipping_tax_exc;
     } else {
         $total_products = $summary->total_products_wt;
         $total_discounts = $summary->total_discounts;
         $total_wrapping = $summary->total_wrapping;
         $total_price = $summary->total_price;
         $total_shipping = $summary->total_shipping;
     }
     foreach ($products as $k => &$product) {
         if ($tax_calculation_method == COM_JEPROSHOP_TAX_EXCLUDED) {
             $product->product_price = $product->price;
             $product->product_total = $product->total;
         } else {
             $product->product_price = $product->price_wt;
             $product->product_total = $product->total_wt;
         }
         $image = array();
         $db = JFactory::getDBO();
         if (isset($product->product_attribute_id) && (int) $product->product_attribute_id) {
             $query = "SELECT " . $db->quoteName('image_id') . " FROM " . $db->quoteName('#__jeproshop_product_attribute_image') . " WHERE product_attribute_id = " . (int) $product->product_attribute_id;
             $db->setQuery($query);
             $image = $db->loadObject();
         }
         if (!isset($image->image_id)) {
             $query = "SELECT " . $db->quoteName('image_id') . " FROM " . $db->quoteName('#__jeproshop_image') . " WHERE " . $db->quoteName('product_id') . " = " . (int) $product->product_id . " AND cover = 1 ";
             $db->setQuery($query);
             $image = $db->loadObject();
         }
         $product_obj = new JeproshopProductModelProduct($product->product_id);
         $product->qty_in_stock = JeproshopStockAvailableModelStockAvailable::getQuantityAvailableByProduct($product->product_id, isset($product->product_attribute_id) ? $product->product_attribute_id : null, (int) $shop_id);
         $image_product = new JeproshopImageModelImage($image->image_id);
         $product->image = isset($image->image_id) ? JeproshopImageManager::thumbnail(COM_JEPROSHOP_IMAGE_DIR . 'products/' . $image_product->getExistingImagePath() . '.jpg', 'product_mini_' . (int) $product->product_id . (isset($product->product_attribute_id) ? '_' . (int) $product->product_attribute_id : '') . '.jpg', 45, 'jpg') : '--';
     }
     /*$helper = new HelperKpi();
       $helper->id = 'box-kpi-cart';
       $helper->icon = 'icon-shopping-cart';
       $helper->color = 'color1';
       $helper->title = $this->l('Total Cart', null, null, false);
       $helper->subtitle = sprintf($this->l('Cart #%06d', null, null, false), $cart->id);
       $helper->value = Tools::displayPrice($total_price, $currency);
       $kpi = $helper->generate(); */
     //$this->assignRef('kpi', $kpi);
     $this->assignRef('products', $products);
     $discounts = $this->cart->getCartRules();
     $this->assignRef('discounts', $discounts);
     $this->assignRef('order', $order);
     $this->assignRef('currency', $currency);
     $this->assignRef('customer', $customer);
     $customerStats = $customer->getStats();
     $this->assignRef('customer_stats', $customerStats);
     $this->assignRef('total_products', $total_products);
     $this->assignRef('total_discounts', $total_discounts);
     $this->assignRef('total_wrapping', $total_wrapping);
     $this->assignRef('total_price', $total_price);
     $this->assignRef('total_shipping', $total_shipping);
     $this->assignRef('customized_datas', $customized_datas);
     if ($this->getLayout() != 'modal') {
         $this->addToolBar();
         $this->sideBar = JHtmlSidebar::render();
     }
     parent::display($tpl);
 }