public static function addShopRestriction($shop = NULL, $alias = NULL) { $context = JeproshopContext::getContext(); if (!empty($alias)) { $alias .= '.'; } /** If there is no shop id, get the context one **/ if ($shop === null) { if (JeproshopShopModelShop::getShopContext() == JeproshopShopModelShop::CONTEXT_GROUP) { $shop_group = JeproshopShopModelShop::getContextShopGroup(); } else { $shop_group = $context->shop->getShopGroup(); } $shop = $context->shop; } elseif (is_object($shop)) { $shop_group = $shop->getShopGroup(); } else { $shop = new JeproshopShopModelShop($shop); $shop_group = $shop->getShopGroup(); } /* if quantities are shared between shops of the group */ $db = JFactory::getDBO(); if ($shop_group->share_stock) { $query = " AND " . $db->escape($alias) . "shop_group_id = " . (int) $shop_group->shop_group_id . " AND " . $db->escape($alias) . "shop_id = 0 "; } else { $query = " AND " . $db->escape($alias) . "shop_id = " . (int) $shop->shop_id . ' '; } return $query; }
public function display($tpl = null) { if (!isset($this->context) || $this->context == null) { $this->context = JeproshopContext::getContext(); } if (!$this->context->controller->isInitialized()) { $this->context->controller->initialize(); } $app = JFactory::getApplication(); $useSSL = isset($this->context->controller->ssl_enabled) && $this->context->conteoller->ssl_enabled && $app->input->get('enable_ssl') || JeproshopTools::usingSecureMode() ? true : false; $protocol_content = $useSSL ? 'https://' : 'http://'; /*$contextParams = $this->context->controller->getContextParams(); foreach ($contextParams as $assign_key => $assign_value){ if (!is_array($assign_value) && mb_substr($assign_value, 0, 1, 'utf-8') == '/' || $protocol_content == 'https://'){ $this->assignRef($assign_key, $protocol_content.JeproshopTools::getMediaServer($assign_value).$assign_value); }else{ $this->assignRef($assign_key, $assign_value); } }*/ if (!isset(self::$cache_products)) { $category = new JeproshopCategoryModelCategory(JeproshopContext::getContext()->shop->getCategoryId(), (int) JeproshopContext::getContext()->language->lang_id); $nb = (int) JeproshopSettingModelSetting::getValue('number_of_products_on_page'); self::$cache_products = JeproshopDefaultModelDefault::getProducts((int) JeproshopContext::getContext()->language->lang_id, 0, $nb ? $nb : 8, 'position'); } if (self::$cache_products === false || empty(self::$cache_products)) { self::$cache_products = false; } $this->assignRef('products', self::$cache_products); $display_add_product = JeproshopSettingModelSetting::getValue('display_category_attribute'); $this->assignRef('display_add_product', $display_add_product); $homeSize = JeproshopImageModelImage::getSize(JeproshopImageTypeModelImageType::getFormatName('home')); $this->assignRef('homeSize', $homeSize); $this->assignRef('pagination', JeproshopDefaultModelDefault::$_pagination); parent::display($tpl); }
public function renderEditForm($tpl = null) { $helper = new JeproshopHelper(); $this->assignRef('helper', $helper); $tax_rules_groups = JeproshopTaxRulesGroupModelTaxRulesGroup::getTaxRulesGroups(true); $this->assignRef('tax_rules_groups', $tax_rules_groups); $carrier_logo = JeproshopTools::isLoadedObject($this->carrier, 'carrier_id') && file_exists(COM_JEPROSHOP_CARRIER_IMAGE_DIR . $this->carrier->carrier_id . '.jpg') ? COM_JEPROSHOP_CARRIER_IMAGE_DIR . $this->carrier->carrier_id . '.jpg' : false; $this->assignRef('carrier_logo', $carrier_logo); $groups = JeproshopGroupModelGroup::getGroups(JeproshopContext::getContext()->language->lang_id); $this->assignRef('groups', $groups); $zones = JeproshopZoneModelZone::getZones(); $this->assignRef('zones', $zones); $carrierZones = $this->carrier->getZones(); $carrier_zones_ids = array(); if (is_array($carrierZones)) { foreach ($carrierZones as $carrier_zone) { $carrier_zones_ids[] = $carrier_zone->zone_id; } } $this->assignRef('selected_zones', $carrier_zones_ids); if ($this->getLayout() != 'modal') { $this->addToolBar(); $this->sideBar = JHtmlSidebar::render(); } parent::display($tpl); }
/** * Get all scenes of a category * * @param $category_id * @param null $lang_id * @param bool $only_published * @param bool $lite_result * @param bool $hide_scene_position * @param JeproshopContext $context * @return array Products */ public static function getScenes($category_id, $lang_id = null, $only_published = true, $lite_result = true, $hide_scene_position = true, JeproshopContext $context = null) { if (!JeproshopSceneModelScene::isFeaturePublished()) { return array(); } $cache_key = 'jeproshop_scene_get_scenes_' . $category_id . '_' . (int) $lite_result; if (!JeproshopCache::isStored($cache_key)) { if (!$context) { $context = JeproshopContext::getContext(); } $lang_id = is_null($lang_id) ? $context->language->lang_id : $lang_id; $db = JFactory::getDBO(); $query = "SELECT scene.* FROM " . $db->quoteName('#__jeproshop_scene_category') . " scene_category LEFT JOIN " . $db->quoteName('#__jeproshop_scene'); $query .= " AS scene ON (scene_category.scene_id = scene.scene_id) " . JeproshopShopModelShop::addSqlAssociation('scene') . " LEFT JOIN "; $query .= $db->quoteName('#__jeproshop_scene_lang') . " AS scene_lang ON (scene_lang.scene_id = scene.scene_id) WHERE scene_category.category_id = "; $query .= (int) $category_id . "\tAND scene_lang.lang_id = " . (int) $lang_id . ($only_published ? " AND scene.published = 1" : "") . " ORDER BY scene_lang.name ASC"; $db->setQuery($query); $scenes = $db->loadObjectList(); if (!$lite_result && $scenes) { foreach ($scenes as &$scene) { $scene = new Scene($scene->scene_id, $lang_id, false, $hide_scene_position); } } JeproshopCache::store($cache_key, $scenes); } $scenes = JeproshopCache::retrieve($cache_key); return $scenes; }
protected function getWarningDomainName() { $warning = false; if (JeproshopShopModelShop::isFeaturePublished()) { return null; } $shop = JeproshopContext::getContext()->shop; return $warning; }
public function renderView($tpl = null) { $app = JFactory::getApplication(); $this->context = JeproshopContext::getContext(); $customerList = $this->group->getCustomersList(); $this->assignRef('customers', $customerList); $categoryReductions = $this->formatCategoryDiscountList($this->group->group_id); $this->assignRef('category_reductions', $categoryReductions); $this->addToolBar(); $this->sideBar = JHtmlSidebar::render(); parent::display($tpl); }
public function addFeatureValue($tpl = null) { if (!isset($this->context)) { $this->context = JeproshopContext::getContext(); } $helper = new JeproshopHelper(); $this->assignRef('helper', $helper); $features = JeproshopFeatureModelFeature::getFeatures($this->context->language->lang_id); $this->assignRef('features', $features); $this->addToolBar(); $this->sideBar = JHtmlSideBar::render(); parent::display($tpl); }
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); }
/** * Get minimal quantity for product with attributes quantity * * @acces public static * @param integer $id_product_attribute * @return mixed Minimal Quantity or false */ public static function getAttributeMinimalQty($product_attribute_id) { $db = JFactory::getDBO(); $query = "SELECT " . $db->quoteName('minimal_quantity') . " FROM " . $db->quoteName('#__jeproshop_product_attribute_shop') . " AS product_attribute_shop "; $query .= " WHERE " . $db->quoteName('shop_id') . " = " . (int) JeproshopContext::getContext()->shop->shop_id . " AND " . $db->quoteName('product_attribute_id'); $query .= (int) $product_attribute_id; $db->setQuery($query); $minimal_quantity = $db->loaResult(); if ($minimal_quantity > 1) { return (int) $minimal_quantity; } return false; }
public function initialize() { parent::initialize(); $app = JFactory::getApplication(); $context = JeproshopContext::getContext(); // Get address ID $address_id = 0; $type = $app->input->get('type'); if ($this->use_ajax && isset($type)) { if ($type == 'delivery' && isset($context->cart->address_delivery_id)) { $address_id = (int) $context->cart->address_delivery_id; } else { if ($type == 'invoice' && isset($context->cart->address_invoice_id) && $context->cart->id_address_invoice != $context->cart->address_delivery_id) { $address_id = (int) $context->cart->address_invoice_id; } } } else { $address_id = (int) $app->input->get('address_id', 0); } // Initialize address if ($address_id) { $address = new JeproshopAddressModelAddress($address_id); $view = $app->input->get('view'); $viewClass = $this->getView($view, JFactory::getDocument()->getType()); if (JeproshopTools::isLoadedObject($address, 'address_id') && JeproshopCustomerModelCustomer::customerHasAddress($context->customer->customer_id, $address_id)) { $task = $app->input->get('task'); if (isset($task) && $task == 'delete') { if ($address->delete()) { if ($context->cart->address_invoice_id == $address->address_id) { unset($context->cart->address_invoice_id); } if ($context->cart->id_address_delivery == $address->address_id) { unset($context->cart->id_address_delivery); $context->cart->updateAddressId($address->address_id, (int) JeproshopAddressModelAddress::getCustomerFirstAddressId($context->customer->customer_id)); } $app->redirect('index.php?option=com_jeproshop&view=address'); } $this->has_errors = true; JError::raiseError(500, 'This address cannot be deleted.'); } } elseif ($this->use_ajax) { $app->close; } else { $app->redirect('index.php?option=com_jeproshop&view=address'); } } }
public function addShop($tpl = null) { if ($this->context == null) { $this->context = JeproshopContext::getContext(); } $display_group_list = true; if ($display_group_list) { $shop_groups = JeproshopShopGroupModelShopGroup::getShopGroups(); $this->assignRef('shop_groups', $shop_groups); } $categories = JeproshopCategoryModelCategory::getRootCategories($this->context->language->lang_id); $themes = JeproshopThemeModelTheme::getThemes(); $this->assignRef('themes', $themes); $this->assignRef('categories', $categories); $this->addToolBar(); $this->sideBar = JHtmlSidebar::render(); parent::display($tpl); }
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); }
/** * Assign template vars related to countries display */ protected function assignCountries() { $context = JeproshopContext::getContext(); $app = JFactory::getApplication(); $country_id = $app->input->get('country_id'); // Get selected country if (isset($country_id) && !is_null($country_id) && is_numeric($country_id)) { $selected_country = (int) $country_id; } else { if (isset($this->address) && isset($this->address->country_id) && !empty($this->address->country_id) && is_numeric($this->address->country_id)) { $selected_country = (int) $this->address->country_id; } else { if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { // get all countries as language (xy) or language-country (wz-XY) $array = array(); preg_match("#(?<=-)\\w\\w|\\w\\w(?!-)#", $_SERVER['HTTP_ACCEPT_LANGUAGE'], $array); if (!JeproshopTools::isLanguageIsoCode($array[0]) || !($selected_country = JeproshopCountryModelCountry::getByIso($array[0]))) { $selected_country = (int) JeproshopSettingModelSetting::getValue('default_country'); } } else { $selected_country = (int) JeproshopSettingModelSetting::getValue('default_country'); } } } // Generate countries list if (JeproshopSettingModelSetting::getValue('restrict_delivered_countries')) { $countries = JeproshopCarrierModelCarrier::getDeliveredCountries($context->language->lang_id, true, true); } else { $countries = JeproshopCountryModelCountry::getCountries($context->language->lang_id, true); } // @todo use helper $list = ''; foreach ($countries as $country) { $selected = $country->country_id == $selected_country ? 'selected="selected"' : ''; $list .= '<option value="' . (int) $country->country_id . '" ' . $selected . '>' . htmlentities(ucfirst($country->name)) . '</option>'; } // Assign vars $this->assignRef('countries_list', $list); $this->assignRef('countries', $countries); }
public function initialize() { $app = JFactory::getApplication(); $context = JeproshopContext::getContext(); parent::initialize(); $category_id = $app->input->get('category_id'); $task = $app->input->get('task'); if ($category_id && $task != 'delete') { $this->category = new JeproshopCategoryModelCategory($category_id); } else { if (JeproshopShopModelShop::isFeaturePublished() && JeproshopShopModelShop::getShopContext() == JeproshopShopModelShop::CONTEXT_SHOP) { $this->category = new JeproshopCategoryModelCategory($context->shop->category_id); } elseif (count(JeproshopCategoryModelCategory::getCategoriesWithoutParent()) > 1 && JeproshopSettingModelSetting::getValue('multishop_feature_active') && count(JeproshopShopModelShop::getShops(true, null, true)) != 1) { $this->category = JeproshopCategoryModelCategory::getTopCategory(); } else { $this->category = new JeproshopCategoryModelCategory(JeproshopSettingModelSetting::getValue('root_category')); } } if (JeproshopTools::isLoadedObject($this->category, 'category_id') && !$this->category->isAssociatedToShop() && JeproshopShopModelShop::getShopContext() == JeproshopShopModelShop::CONTEXT_SHOP) { $app->redirect('index.php?option=com_jeproshop&view=category&task=edit&category_id=' . (int) $context->shop->getCategoryId() . '&' . JeproshopTools::getCategoryToken() . '=1'); } }
/** * For a given {product, product attribute} gets warehouse list * * @param int $product_id ID of the product * @param int $product_attribute_id Optional, uses 0 if this product does not have attributes * @param int $shop_id Optional, ID of the shop. Uses the context shop id (@see JeproshopContext::shop) * @return array Warehouses (ID, reference/name concatenated) */ public static function getProductWarehouseList($product_id, $product_attribute_id = 0, $shop_id = null) { $db = JFactory::getDBO(); // if it's a pack, returns warehouses if and only if some products use the advanced stock management if (JeproshopProductPack::isPack($product_id)) { $warehouses = JeproshopWarehouseModelWarehouse::getPackWarehouses($product_id); /*$res = array(); foreach ($warehouses as $warehouse) $res[]['id_warehouse'] = $warehouse; */ return $warehouses; } $share_stock = false; if ($shop_id === null) { if (JeproshopShopModelShop::getShopContext() == JeproshopShopModelShop::CONTEXT_GROUP) { $shop_group = JeproshopShopModelShop::getContextShopGroup(); } else { $shop_group = JeproshopContext::getContext()->shop->getShopGroup(); $shop_id = (int) JeproshopContext::getContext()->shop->shop_id; } $share_stock = $shop_group->share_stock; } else { $shop_group = JeproshopShopModelShop::getGroupFromShop($shop_id); $share_stock = $shop_group->share_stock; } if ($share_stock) { $shop_ids = JeproshopShopModelShop::getShops(true, (int) $shop_group->shop_group_id, true); } else { $shop_ids = array((int) $shop_id); } $query = "SELECT warehouse_product_location.warehouse_id, CONCAT(warehouse.reference, ' - ', warehouse.name)"; $query .= " AS name FROM " . $db->QuoteName('#__jeproshop_warehouse_product_location') . " AS warehouse_product_location"; $query .= " INNER JOIN " . $db->quoteName('#__jeproshop_warehouse_shop') . " AS warehouse_shop ON(warehouse_shop."; $query .= "warehouse_id = warehouse_product_location.warehouse_id AND shop_id IN (" . implode(',', array_map('intval', $shop_ids)); $query .= " )) INNER JOIN " . $db->quoteName('#__jeproshop_warehouse') . " AS warehouse ON (warehouse.warehouse_id = warehouse_shop."; $query .= "warehouse_id ) WHERE product_id = " . (int) $product_id . " AND product_attribute_id = " . (int) $product_attribute_id; $query .= " AND warehouse.deleted = 0 GROUP BY warehouse_product_location.warehouse_id"; $db->setQuery($query); return $db->loadObjectList(); }
/** * Generate a cached thumbnail for object lists (eg. carrier, order statuses...etc) * * @param string $image Real image filename * @param string $cache_image Cached filename * @param int $size Desired size * @param string $image_type Image type * @param bool $disable_cache When turned on a timestamp will be added to the image URI to disable the HTTP cache * @param bool $regenerate When turned on and the file already exist, the file will be regenerated * @return string */ public static function thumbnail($image, $cache_image, $size, $image_type = 'jpg', $disable_cache = true, $regenerate = false) { if (!file_exists($image)) { return ''; } if (file_exists(COM_JEPROSHOP_TMP_IMG_DIR . $cache_image) && $regenerate) { @unlink(COM_JEPROSHOP_TMP_IMG_DIR . $cache_image); } if ($regenerate || !file_exists(COM_JEPROSHOP_TMP_IMG_DIR . $cache_image)) { $infos = getimagesize($image); // Evaluate the memory required to resize the image: if it's too much, you can't resize it. if (!JeproshopImageManager::checkImageMemoryLimit($image)) { return false; } $x = $infos[0]; $y = $infos[1]; $max_x = $size * 3; // Size is already ok if ($y < $size && $x <= $max_x) { copy($image, COM_JEPROSHOP_TMP_IMG_DIR . $cache_image); // We need to resize */ } else { $ratio_x = $x / ($y / $size); if ($ratio_x > $max_x) { $ratio_x = $max_x; $size = $y / ($x / $max_x); } JeproshopImageManager::resize($image, COM_JEPROSHOP_TMP_IMG_DIR . $cache_image, $ratio_x, $size, $image_type); } } // Relative link will always work, whatever the base uri set in the admin if (JeproshopContext::getContext()->controller->controller_type == 'admin') { return '<img src="../img/tmp/' . $cache_image . ($disable_cache ? '?time=' . time() : '') . '" alt="" class="imgm img-thumbnail" />'; } else { return '<img src="' . _PS_TMP_IMG_ . $cache_image . ($disable_cache ? '?time=' . time() : '') . '" alt="" class="imgm img-thumbnail" />'; } }
public function display($tpl = null) { if (!isset($this->context) && $this->context == null) { $this->context = JeproshopContext::getContext(); } /*if($this->context->controller->isInitialized()){*/ $this->init(); //} if (!$this->customer_access) { return; } if (isset($this->context->cookie->compare_id)) { $this->assignRef('compare_products', JeproshopCompareProductModelCompareProduct::getCompareProducts((int) $this->context->cookie->compare_id)); } $this->assignScenes(); $this->sortProducts(); $subCategories = $this->category->getSubCategories($this->context->language->lang_id); if (count($subCategories)) { $this->assignRef('sub_categories', $subCategories); $this->assignRef('sub_categories_total', count($subCategories)); $this->assignRef('sub_categories_half', ceil(count($subCategories) / 2)); } $this->assignProducts(); $catalog_mode = (bool) (JeproshopSettingModelSetting::getValue('catalog_mode') || !JeproshopGroupModelGroup::getCurrent()->show_prices); $this->assignRef('catalog_mode', $catalog_mode); $this->assignRef('allow_out_of_stock_ordering', JeproshopSettingModelSetting::getValue('allow_out_of_stock_ordering')); $comparator_max_item = (int) JeproshopSettingModelSetting::getValue('comparator_max_item'); $this->assignRef('comparator_max_item', $comparator_max_item); $compared_products = array(); if (JeproshopSettingModelSetting::getValue('comparator_max_item') && isset($this->context->cookie->compare_id)) { $compared_products = JeproshopProductCompareModelProductCompare::getCompareProducts($this->context->cookie->compare_id); } $this->assignRef('compared_products', is_array($compared_products) ? $compared_products : array()); $this->assignRef('display_price', JeproshopSettingModelSetting::getValue('display_price')); parent::display($tpl); }
/** * Return messages from Order ID * * @param integer $order_id Order ID * @param boolean $private return WITH private messages * @param JeproshopContext $context * @return array Messages */ public static function getMessagesByOrderId($order_id, $private = false, JeproshopContext $context = null) { if (!JeproshopTools::isBool($private)) { die(JError::raiseError()); } if (!$context) { $context = JeproshopContext::getContext(); } $db = JFactory::getDBO(); $query = "SELECT message.*, customer." . $db->quoteName('firstname') . " AS customer_firstname, customer."; $query .= $db->quoteName('lastname') . " AS customer_lastname, employee." . $db->quoteName('name') . " AS employee_name, "; $query .= "employee." . $db->quoteName('username') . " AS employee_user_name, (COUNT(message_readed.message_id) = 0 AND "; $query .= "message.customer_id != 0) AS is_new_for_me FROM " . $db->quoteName('#__jeproshop_message') . " AS message LEFT JOIN "; $query .= $db->quoteName('#__jeproshop_customer') . " AS customer ON message." . $db->quoteName('customer_id') . " = "; $query .= "customer." . $db->quoteName('customer_id') . " LEFT JOIN " . $db->quoteName('#__jeproshop_message_readed'); $query .= " AS message_readed ON message_readed." . $db->quoteName('message_id') . " = message." . $db->quoteName('message_id'); $query .= " AND message_readed." . $db->quoteName('employee_id') . " = " . (isset($context->employee) ? (int) $context->employee->employee_id : ""); $query .= " LEFT OUTER JOIN " . $db->quoteName('#__users') . " AS employee ON employee." . $db->quoteName('id'); $query .= " = message." . $db->quoteName('employee_id') . "\tWHERE order_id = " . (int) $order_id; $query .= (!$private ? " AND message." . $db->quoteName('private') . " = 0" : "") . " GROUP BY message.message_id"; $query .= " ORDER BY message.date_add DESC"; $db->setQuery($query); return $db->loadObjectList(); }
/** * Get data if the cookie exists and else initialize an new one * * @param String $name * @param String $path * @param String $expire * @param String $shared_urls */ public function __construct($name, $path = '', $expire = null, $shared_urls = null) { $this->_content = array(); $this->_expire = is_null($expire) ? time() + 1728000 : (int) $expire; $this->_name = md5(COM_JEPROSHOP_VERSION . $name); $this->_path = trim(JeproshopContext::getContext()->shop->physical_uri . $path, '/\\') . '/'; if ($this->_path[0] != '/') { $this->_path = '/' . $this->_path; } $this->_path = rawurlencode($this->_path); $this->_path = str_replace('%2F', '/', $this->_path); $this->_path = str_replace('%7E', '~', $this->_path); $this->_key = COM_JEPROSHOP_COOKIE_KEY; $this->_iv = COM_JEPROSHOP_COOKIE_IV; $this->_domain = $this->getDomain($shared_urls); $this->_allow_writing = TRUE; if (JeproshopSettingModelSetting::getValue('cipher_algorithm')) { $this->_cipherTool = new Rijndael(COM_JEPROSHOP_RIJNDAEL_KEY, COM_JEPROSHOP_RIJNDAEL_IV); } else { $this->_cipherToll = new BlowFish($this->_key, $this->_iv); } $this->lang_id = (int) JeproshopSettingModelSetting::getValue('default_lang'); $this->update(); }
public function update_status() { $app = JFactory::getApplication(); $order_status_id = $app->input->get('order_status_id'); $order_id = $app->input->get('order_id'); $order = new JeproshopOrderModelOrder($order_id); $context = JeproshopContext::getContext(); if (!JeproshopTools::isLoadedObject($order, 'order_id')) { echo '<p>' . JText::_('COM_JEPROSHOP_THE_ORDER_CANNOT_BE_FOUND_WITH_IN_YOUR_DATABASE_MESSAGE') . '</p>'; } if ($this->viewAccess()) { $orderStatus = new JeproshopOrderStatusModelOrderStatus($order_status_id); if (!JeproshopTools::isLoadedObject($orderStatus, 'order_status_id')) { echo JText::_('COM_JEPROSHOP_THE_ORDER_STATUS_CANNOT_BE_FOUND_WITH_IN_YOUR_DATABASE_MESSAGE'); } else { $order = new JeproshopOrderModelOrder(); $currentOrderStatus = $order->getCurrentOrderStatus(); if ($currentOrderStatus->order_status_id != $orderStatus) { // Create a order history $orderHistory = new JeproshopOrderHistoryModelOrderHistory(); $orderHistory->order_id = $order->order_id; $orderHistory->employee_id = (int) $context->employee->employee_id; $useExistingPayment = false; if (!$order->hasInvoice()) { $useExistingPayment = true; } $orderHistory->changeOrderStatusId((int) $orderStatus->order_status_id, $order, $useExistingPayment); $carrier = new JeproshopCarrierModelCarrier($order->carrier_id, $order->lang_id); $templateVars = array(); if ($orderHistory->order_status_id == JeproshopSettingModelSetting::getValue('order_status_shipping') && $order->shipping_number) { } if ($orderHistory->addWithEmail(true, $templateVars)) { // synchronizes quantities if needed... if (JeproshopSettingModelSetting::getValue('advanced_stock_management')) { foreach ($order->getProducts() as $product) { if (JeproshopStockAvailableModelStockAvailable::dependsOnStock($product->product_id)) { JeproshopStockAvailableModelStockAvailable::synchronize($product->product_id, (int) $product->sho_id); } } } $app->redirect('index.php?option=com_jeproshop&view=order&task=view&order_id=' . (int) $order->order_id . '&' . JeproshopTools::getOrderToken() . '=1'); } echo JText::_('COM_JEPROSHOP_AN_ERROR_OCCURRED_WHILE_CHANGING_ORDER_STATUS_OR_WE_WERE_UNABLE_TO_SEND_AN_EMAIL_TO_THE_CUSTOMER_MESSAGE'); } else { echo JText::_('COM_JEPROSHOP_THE_ORDER_HAS_ALREADY_BEEN_ASSIGNED_THIS_STATUS_MESSAGE'); } } } else { echo JText::_('COM_JEPROSHOP_YOU_DO_NOT_HAVE_PERMISSION_TO_EDIT_THIS_ORDER_MESSAGE'); } }
* * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of, * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // no direct access defined('_JEXEC') or die('Restricted access'); if (!file_exists(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'load.php')) { JError::raiseError(500, JText::_('')); } require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR . 'load.php'; $context = JeproshopContext::getContext(); /** initialize the shop **/ $context->shop = JeproshopShopModelShop::initialize(); /** load configuration */ JeproshopSettingModelSetting::loadSettings(); /** load languages */ JeproshopLanguageModelLanguage::loadLanguages(); /** set context cookie */ $life_time = time() + max(JeproshopSettingModelSetting::getValue('bo_life_time'), 1) * 3600; $context->cookie = new JeproshopCookie('jeproshop_site', '', $life_time); /** @var employee */ $context->employee = new JeproshopEmployeeModelEmployee(JFactory::getUser()->id); $context->cookie->employee_id = $context->employee->employee_id; /** Loading default country */ $context->country = new JeproshopCountryModelCountry(JeproshopSettingModelSetting::getValue('default_country'), JeproshopSettingModelSetting::getValue('default_lang')); /** if the cookie stored language is not an available language, use default language */
public function isAssociatedToShop($shop_id = null) { if ($shop_id === null) { $shop_id = JeproshopContext::getContext()->shop->shop_id; } $cache_id = 'jeproshop_model_shop_group_' . (int) $this->group_id . '_' . (int) $shop_id; if (!JeproshopCache::isStored($cache_id)) { $db = JFactory::getDBO(); $query = "SELECT shop_id FROM " . $db->quoteName('#__jeproshop_group_shop') . " WHERE "; $query .= $db->quoteName('group_id') . " = " . $this->group_id . " AND shop_id = " . (int) $shop_id; $db->setQuery($query); JeproshopCache::store($cache_id, (bool) $db->loadResult()); } return JeproshopCache::retrieve($cache_id); }
public function getManufacturerAddressesList($explicitSelect = TRUE) { jimport('joomla.html.pagination'); $db = JFactory::getDBO(); $app = JFactory::getApplication(); $option = $app->input->get('option'); $view = $app->input->get('view'); $context = JeproshopContext::getContext(); $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'), 'int'); $limitstart = $app->getUserStateFromRequest($option . $view . '.limit_start', 'limit_start', 0, 'int'); $lang_id = $app->getUserStateFromRequest($option . $view . '.lang_id', 'lang_id', $context->language->lang_id, 'int'); $shop_id = $app->getUserStateFromRequest($option . $view . '.shop_id', 'shop_id', $context->shop->shop_id, 'int'); $shop_group_id = $app->getUserStateFromRequest($option . $view . '.shop_group_id', 'shop_group_id', $context->shop->shop_group_id, 'int'); $category_id = $app->getUserStateFromRequest($option . $view . '.category_id', 'category_id', 0, 'int'); $order_by = $app->getUserStateFromRequest($option . $view . '.order_by', 'order_by', 'position', 'string'); $order_way = $app->getUserStateFromRequest($option . $view . '.order_way', 'order_way', 'ASC', 'string'); $published = $app->getUserStateFromRequest($option . $view . '.published', 'published', 0, 'string'); /* Manage default params values */ $use_limit = true; if ($limit === false) { $use_limit = false; } $select = " country_lang." . $db->quoteName('name') . " AS country, manufacturer." . $db->quoteName('name') . " AS manufacturer_name "; $join = " LEFT JOIN " . $db->quoteName('#__jeproshop_country_lang') . " AS country_lang ON (country_lang."; $join .= $db->quoteName('country_id') . " = address." . $db->quoteName('country_id') . " AND country_lang."; $join .= $db->quoteName('lang_id') . " = " . (int) $this->context->language->lang_id . ") LEFT JOIN "; $join .= $db->quoteName('#__jeproshop_manufacturer') . " AS manufacturer ON (manufacturer." . $db->quoteName('manufacturer_id'); $join .= " = manufacturer." . $db->quoteName('manufacturer_id') . ") "; $where = " AND address." . $db->quoteName('customer_id') . " = 0 AND address." . $db->quoteName('manufacturer_id') . " = 0 AND address."; $where .= $db->quoteName('warehouse_id') . " = 0 AND address." . $db->quoteName('deleted') . " = 0"; do { $query = "SELECT SQL_CALC_FOUND_ROWS " . ($tmpTableFilter ? " * FROM (SELECT " : ""); if ($explicitSelect) { foreach ($fields_list as $key => $value) { if (isset($select) && preg_match('/[\\s]`?' . preg_quote($key, '/') . '`?\\S*,/', $select)) { continue; } if (isset($value['filter_key'])) { $query .= str_replace('!', '.', $value['filter_key']) . " AS " . $key . ", "; } elseif ($key == 'product_id') { $query .= "product." . $db->quoteName($db->escape($key)) . ", "; } elseif ($key != 'image' && !preg_match('/' . preg_quote($key, '/') . '/i', $select)) { $query .= $db->quoteName($db->escape($key)) . ", "; } } $query = rtrim($query, ','); } else { $query .= ($lang_id ? "product_lang.*, " : "") . "product.*"; } $query .= (isset($select) ? rtrim($select, ", ") : "") . $select_shop . " FROM " . $db->quoteName('#__jeproshop_product'); $query .= " AS product " . $lang_join . (isset($join) ? $join . " " : "") . $join_shop . " WHERE 1 " . (isset($where) ? $where . " " : ""); $query .= ($this->deleted_product ? " AND product." . $db->quoteName('deleted') . " = 0 " : "") . (isset($filter) ? $filter : "") . $where_shop . (isset($group) ? $group . " " : ""); $query .= $having_clause . " ORDER BY " . (str_replace('`', '', $order_by) == 'product_id' ? "product_id" : "") . " product." . $db->quoteName($order_by) . " "; $query .= $db->escape($order_way) . ($tmpTableFilter ? ") tmpTable WHERE 1" . $tmpTableFilter : ""); $query .= $use_limit === true ? " LIMIT " . (int) $limitstart . ", " . (int) $limit : ""; $db->setQuery($query); $products = $db->loadObjectList(); if ($use_limit == true) { $limitstart = (int) $limitstart - (int) $limit; if ($limitstart < 0) { break; } } else { break; } } while (empty($products)); }
public static function getProducts($lang_id, $limit_start, $limit, $order_by = null, $order_way = null, $get_total = false, $published = true, $random = false, $random_number_products = 1, $check_access = true, JeproshopContext $context = null) { if (!$context) { $context = JeproshopContext::getContext(); } $db = JFactory::getDBO(); $app = JFactory::getApplication(); jimport('joomla.html.pagination'); //if ($check_access && !$context->controller->checkAccess($context->customer->customer_id, $category_id)){ return false; } if ($limit_start < 1) { $limit_start = 0; } if (empty($order_by)) { $order_by = 'position'; } else { /* Fix for all modules which are now using lowercase values for 'orderBy' parameter */ $order_by = strtolower($order_by); } if (empty($order_way)) { $order_way = "DESC"; } $order_by_prefix = false; if ($order_by == 'product_id' || $order_by == 'date_add' || $order_by == 'date_upd') { $order_by_prefix = "product"; } elseif ($order_by == 'name') { $order_by_prefix = "product_lang"; } elseif ($order_by == 'manufacturer') { $order_by_prefix = "manufacturer"; $order_by = "name"; } elseif ($order_by == 'position') { $order_by_prefix = "product"; } if ($order_by == 'price') { $order_by = 'order_price'; } if (!JeproshopTools::isOrderBy($order_by) || !JeproshopTools::isOrderWay($order_way)) { die(JError::raiseError()); } $supplier_id = (int) $app->input->get('supplier_id'); /* Return only the number of products */ $query = "SELECT COUNT(product." . $db->quoteName('product_id') . ") AS total FROM " . $db->quoteName('#__jeproshop_product') . " AS product "; $query .= JeproshopShopModelShop::addSqlAssociation('product') . " WHERE product_shop." . $db->quoteName('visibility') . " IN ('both', 'catalog')"; $query .= " AND product_shop." . $db->quoteName('published') . " = 1 " . ($supplier_id ? " AND product.supplier_id = " . (int) $supplier_id : ""); $db->setQuery($query); $total = (int) $db->loadResult(); $number_days_new_product = JeproshopSettingModelSetting::getValue('number_days_new_product'); $query = "SELECT product.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, MAX(product_attribute_shop.product_attribute_id) AS "; $query .= "product_attribute_id, product_attribute_shop.minimal_quantity AS product_attribute_minimal_quantity, product_lang." . $db->quoteName('description'); $query .= ", product_lang." . $db->quoteName('short_description') . ", product_lang." . $db->quoteName('available_now') . ", product_lang." . $db->quoteName('available_later'); $query .= ", product_lang." . $db->quoteName('link_rewrite') . ", product_lang." . $db->quoteName('meta_description') . ", product_lang." . $db->quoteName('meta_keywords'); $query .= ", product_lang." . $db->quoteName('meta_title') . ", product_lang." . $db->quoteName('name') . ", MAX(image_shop." . $db->quoteName('image_id') . " ) AS "; $query .= "image_id, image_lang." . $db->quoteName('legend') . ", manufacturer." . $db->quoteName('name') . " AS manufacturer_name, DATEDIFF(product_shop." . $db->quoteName('date_add'); $query .= ", DATE_SUB(NOW(), INTERVAL " . (JeproshopTools::isUnsignedInt($number_days_new_product) ? $number_days_new_product : 20) . "\tDAY)) > 0 AS new, product_shop.price AS"; $query .= " order_price FROM " . $db->quoteName('#__jeproshop_product') . " AS product " . JeproshopShopModelShop::addSqlAssociation('product') . " LEFT JOIN "; $query .= $db->quoteName('#__jeproshop_product_attribute') . " AS product_attribute ON (product." . $db->quoteName('product_id') . " = product_attribute." . $db->quoteName('product_id'); $query .= ") " . JeproshopShopModelShop::addSqlAssociation('product_attribute', false, 'product_attribute_shop.`default_on` = 1'); $query .= JeproshopProductModelProduct::sqlStock('product', 'product_attribute_shop', false, $context->shop) . " LEFT JOIN " . $db->quoteName('#__jeproshop_product_lang'); $query .= " AS product_lang ON (product." . $db->quoteName('product_id') . " = product_lang." . $db->quoteName('product_id') . " AND product_lang." . $db->quoteName('lang_id') . " = " . (int) $lang_id . JeproshopShopModelShop::addSqlRestrictionOnLang('product_lang'); $query .= ") LEFT JOIN " . $db->quoteName('#__jeproshop_image') . " AS image ON (image." . $db->quoteName('product_id') . " = product." . $db->quoteName('product_id') . ") " . JeproshopShopModelShop::addSqlAssociation('image', false, 'image_shop.cover=1') . " LEFT JOIN "; $query .= $db->quoteName('#__jeproshop_image_lang') . " AS image_lang ON (image_shop." . $db->quoteName('image_id') . " = image_lang." . $db->quoteName('image_id') . " AND image_lang." . $db->quoteName('lang_id') . " = " . (int) $lang_id . ") LEFT JOIN "; $query .= $db->quoteName('#__jeproshop_manufacturer') . " AS manufacturer ON manufacturer." . $db->quoteName('manufacturer_id') . " = product." . $db->quoteName('manufacturer_id') . "\tWHERE product_shop." . $db->quoteName('shop_id') . " = " . (int) $context->shop->shop_id; $query .= " AND product_shop." . $db->quoteName('published') . " = 1 AND product_shop." . $db->quoteName('visibility') . " IN ('both', 'catalog') "; $query .= ($supplier_id ? " AND product.supplier_id = " . (int) $supplier_id : "") . " GROUP BY product_shop.product_id"; if ($random === true) { $query .= " ORDER BY RAND() LIMIT " . (int) $random_number_products; } else { //$query .= " ORDER BY " . (!empty($order_by_prefix) ? $order_by_prefix. "." : "") . $db->quoteName($order_by); $query .= " " . $order_way . " LIMIT " . (int) $limit_start . ", " . (int) $limit; } $db->setQuery($query); $result = $db->loadObjectList(); if ($order_by == 'order_price') { JeproshopTools::orderbyPrice($result, $order_way); } if (!$result) { return array(); } self::$_pagination = new JPagination($total, $limit_start, $limit); /* Modify SQL result */ return JeproshopProductModelProduct::getProductsProperties($lang_id, $result); }
public static function addSqlRestrictionOnLang($alias = NULL, $shop_id = NULL) { if (isset(JeproshopContext::getContext()->shop) && is_null($shop_id)) { $shop_id = (int) JeproshopContext::getContext()->shop->shop_id; } if (!$shop_id) { $shop_id = JeproshopSettingModelSetting::getValue('default_shop'); } $db = JFactory::getDBO(); return " AND " . ($alias ? $alias . "." : "") . $db->quoteName('shop_id') . " = " . (int) $shop_id; }
public function getAttributeGroupList($explicitSelect = TRUE) { jimport('joomla.html.pagination'); $db = JFactory::getDBO(); $app = JFactory::getApplication(); $option = $app->input->get('option'); $view = $app->input->get('view'); $context = JeproshopContext::getContext(); $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'), 'int'); $limitstart = $app->getUserStateFromRequest($option . $view . '.limit_start', 'limit_start', 0, 'int'); $lang_id = $app->getUserStateFromRequest($option . $view . '.lang_id', 'lang_id', $context->language->lang_id, 'int'); $shop_id = $app->getUserStateFromRequest($option . $view . '.shop_id', 'shop_id', $context->shop->shop_id, 'int'); $shop_group_id = $app->getUserStateFromRequest($option . $view . '.shop_group_id', 'shop_group_id', $context->shop->shop_group_id, 'int'); $category_id = $app->getUserStateFromRequest($option . $view . '.category_id', 'category_id', 0, 'int'); $order_by = $app->getUserStateFromRequest($option . $view . '.order_by', 'order_by', 'position', 'string'); $order_way = $app->getUserStateFromRequest($option . $view . '.order_way', 'order_way', 'ASC', 'string'); $published = $app->getUserStateFromRequest($option . $view . '.published', 'published', 0, 'string'); /* Manage default params values */ $use_limit = true; if ($limit === false) { $use_limit = false; } /* Query in order to get results with all fields */ $lang_join = ''; if ($lang_id) { $lang_join = " LEFT JOIN " . $db->quoteName('#__jeproshop_attribute_group_lang') . " AS attribute_group_lang ON ("; $lang_join .= "attribute_group_lang." . $db->quoteName('attribute_group_id') . " = attribute_group."; $lang_join .= $db->quoteName('attribute_group_id'); $lang_join .= " AND attribute_group_lang." . $db->quoteName('lang_id') . " = " . (int) $lang_id . ") "; } do { $query = "SELECT SQL_CALC_FOUND_ROWS "; if ($explicitSelect) { $query .= "attribute_group." . $db->quoteName('attribute_group_id') . ", attribute_group_lang."; $query .= $db->quoteName('name') . ", attribute_group." . $db->quoteName('position'); } $query .= " FROM " . $db->quoteName('#__jeproshop_attribute_group') . " AS attribute_group " . $lang_join; $query .= " ORDER BY " . (str_replace('`', '', $order_by) == 'attribute_group_id' ? "attribute_group." : "") . " attribute_group."; $query .= $order_by . " " . $db->escape($order_way) . ($use_limit === true ? " LIMIT " . (int) $limitstart . ", " . (int) $limit : ""); $db->setQuery($query); $attribute_groups = $db->loadObjectList(); if ($use_limit === true) { $limitstart = (int) $limitstart - (int) $limit; if ($limitstart < 0) { break; } } else { break; } } while (empty($attribute_groups)); foreach ($attribute_groups as $attribute_group) { $query = "SELECT attribute.attribute_id as count_values FROM " . $db->quoteName('#__jeproshop_attribute') . " AS attribute "; $query .= JeproshopShopModelShop::addSqlAssociation('attribute') . " WHERE attribute.attribute_group_id = "; $query .= (int) $attribute_group->attribute_group_id . " GROUP BY attribute_shop.shop_id ORDER BY count_values DESC"; $db->setQuery($query); $attribute_group->count_values = (int) count($db->loadObjectList()); } $total = count($attribute_groups); $this->pagination = new JPagination($total, $limitstart, $limit); return $attribute_groups; }
public function getOrderReturnStatusList() { $db = JFactory::getDBO(); $app = JFactory::getApplication(); $option = $app->input->get('option'); $view = $app->input->get('view'); $context = JeproshopContext::getContext(); $limit = $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'), 'int'); $limitStart = $app->getUserStateFromRequest($option . $view . '.limit_start', 'limit_start', 0, 'int'); $lang_id = $app->getUserStateFromRequest($option . $view . '.lang_id', 'lang_id', $context->language->lang_id, 'int'); $order_by = $app->getUserStateFromRequest($option . $view . '.order_by', 'order_by', 'order_return_status_id', 'string'); $order_way = $app->getUserStateFromRequest($option . $view . '.order_way', 'order_way', 'ASC', 'string'); $use_limit = true; if ($limit === false) { $use_limit = false; } do { $query = "SELECT SQL_CALC_FOUND_ROWS return_status." . $db->quoteName('order_return_status_id') . ", return_status_lang." . $db->quoteName('name'); $query .= ", return_status." . $db->quoteName('color') . " FROM " . $db->quoteName('#__jeproshop_order_return_status') . " AS return_status LEFT JOIN "; $query .= $db->quoteName('#__jeproshop_order_return_status_lang') . " AS return_status_lang ON (return_status." . $db->quoteName('order_return_status_id'); $query .= " = return_status_lang." . $db->quoteName('order_return_status_id') . " AND return_status_lang." . $db->quoteName('lang_id') . " = " . (int) $lang_id; $query .= ") WHERE 1 ORDER BY " . (str_replace('`', '', $order_by) == 'order_return_status_id' ? "return_status." : "") . $order_by . " " . $order_way; $db->setQuery($query); $total = count($db->loadObjectList()); $query .= $use_limit ? " LIMIT " . (int) $limitStart . ", " . (int) $limit : ""; $db->setQuery($query); $returnStatus = $db->loadObjectList(); if ($returnStatus == false) { break; } if ($use_limit) { $limitStart = (int) $limitStart - (int) $limit; if ($limitStart < 0) { break; } } else { break; } } while (empty($returnStatus)); $this->pagination = new JPagination($total, $limitStart, $limit); return $returnStatus; }
public function renderDetails($tpl = null) { $app = JFactory::getApplication(); if (!isset($this->context)) { $this->context = JeproshopContext::getContext(); } $this->assignDate(); $this->assignCountries(); $this->assign('news_letter', 1); /*$back = $app->input->get('back'); $key = JeproshopTools::safeOutput($app->input->get('key')); if (!empty($key)) $back .= (strpos($back, '?') !== false ? '&' : '?').'key='.$key; if ($back == JeproshopTools::secureReferrer(Tools::getValue('back'))) $this->context->smarty->assign('back', html_entity_decode($back)); else $this->context->smarty->assign('back', Tools::safeOutput($back)); /* if ($app->input->get('display_guest_checkout')) { if (Configuration::get('PS_RESTRICT_DELIVERED_COUNTRIES')) $countries = Carrier::getDeliveredCountries($this->context->language->id, true, true); else $countries = Country::getCountries($this->context->language->id, true); if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { // get all countries as language (xy) or language-country (wz-XY) $array = array(); preg_match("#(?<=-)\w\w|\w\w(?!-)#", $_SERVER['HTTP_ACCEPT_LANGUAGE'], $array); if (!Validate::isLanguageIsoCode($array[0]) || !($sl_country = Country::getByIso($array[0]))) $sl_country = (int)Configuration::get('PS_COUNTRY_DEFAULT'); }else{ $sl_country = (int)Tools::getValue('id_country', Configuration::get('PS_COUNTRY_DEFAULT')); $this->context->smarty->assign(array( 'inOrderProcess' => true, 'PS_GUEST_CHECKOUT_ENABLED' => Configuration::get('PS_GUEST_CHECKOUT_ENABLED'), 'PS_REGISTRATION_PROCESS_TYPE' => Configuration::get('PS_REGISTRATION_PROCESS_TYPE'), 'sl_country' => (int)$sl_country, 'countries' => $countries )); } if (Tools::getValue('create_account')) $this->assign('email_create', 1); if (Tools::getValue('multi-shipping') == 1) $this->context->smarty->assign('multi_shipping', true); else $this->context->smarty->assign('multi_shipping', false); */ $this->assignAddressFormat(); /* // Call a hook to display more information on form $this->context->smarty->assign(array( 'HOOK_CREATE_ACCOUNT_FORM' => Hook::exec('displayCustomerAccountForm'), 'HOOK_CREATE_ACCOUNT_TOP' => Hook::exec('displayCustomerAccountFormTop') )); */ parent::display($tpl); }
* the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of, * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ // no direct access defined('_JEXEC') or die('Restricted access'); $document = JFactory::getDocument(); $app = JFactory::getApplication(); $css_dir = JeproshopContext::getContext()->shop->theme_directory; $document->addStyleSheet(JURI::base() . 'components/com_jeproshop/assets/themes/' . $css_dir . '/css/jeproshop.css'); JHtml::_('bootstrap.tooltip'); JHtml::_('behavior.multiselect'); JHtml::_('formbehavior.chosen', 'select'); ?> <form action="<?php echo JRoute::_('index.php?option=com_jeproshop&view=order'); ?> " method="post" name="adminForm" id="adminForm" > <?php if (!empty($this->sideBar)) { ?> <div id="j-sidebar-container" class="span2" ><?php echo $this->sideBar; ?>
public function generate() { $context = JeproshopContext::getContext(); $actions = $this->getActions(); $compare_date_from = $this->getCompareDateFrom(); $compare_date_to = $this->getCompareDateTo(); $script = ''; //if(1){ $script = '<div id="jform_date_picker" class="row row-padding-top hide" ><div class="col-lg-12"><div class="date_range_picker_days"><div class="row">'; if ($this->isRtl()) { $script .= '<div class="col-sm-6 col-lg-4" ><div class="date_picker_2" data-date="' . $context->employee->stats_date_to . '" data-date-format="' . $this->getDateFormat() . '"></div>'; $script .= '</div><div class="col-sm-6 col-lg-4" ><div class="date_picker_1" data-date="' . $context->employee->stats_date_from . '" data-date-format="' . $this->getDateFormat() . '" ></div></div>'; } else { $script .= '<div class="col-sm-6 col-lg-4" ><div class="date_picker_1" data-date="' . $context->employee->stats_date_from . '" data-date-format="' . $this->getDateFormat() . '" ></div></div>'; $script .= '<div class="col-sm-6 col-lg-4" ><div class="date_picker_2" data-date="' . $context->employee->stats_date_to . '" data-date-format="' . $this->getDateFormat() . '" ></div></div>'; } $script .= '<div class="col-xs-12 col-sm-6 col-lg-4 pull-right" ><div id="jfom_date_picker_form" class="form-horizontal" ><div id="jform_date_range" class="form-date-group" >'; $script .= '<div class="form-date-heading" ><span class="title" >' . JText::_('COM_JEPROSHOP_DATE_RANGE_LABEL') . '</span>'; if (isset($actions) && count($actions) > 0) { if (count($actions) > 1) { $script .= '<button class="btn btn-default btn-xs pull-right dropdown-toggle" data-toggle="dropdown" type="button">' . JText::_('COM_JEPROSHOP_CUSTOM_LABEL') . '<i class="icon-angle-down" ></i>'; $script .= '</button><ul class="dropdown-menu" >'; foreach ($actions as $action) { $script .= '<li><a'; if (isset($action->class)) { $script .= ' class="' . $action->class . '"'; } $script .= ' >' . (isset($action->icon) ? '<i class="' . $action->icon . '"></i> ' : '') . $action->label . '</a></li>'; } $script .= '</ul>'; } else { $script .= '<a' . (isset($actions[0]->href) ? ' href="' . $actions[0]->href . '"' : '') . ' class="btn btn-default btn-xs pull-right'; $script .= (isset($actions[0]->class) ? $actions[0]->class : '') . '">'; $script .= isset($actions[0]->icon) ? '<i class="' . $actions[0]->icon . '"></i> ' . $actions[0]->label . '</a> ' : ''; } } $script .= '</div><div class="form-date-body"><label>' . JText::_('COM_JEPROSHOP_FROM_LABEL') . '</label><input class="date-input form-control" id="jform_date_start"'; $script .= ' placeholder="Start" type="text" name="jform[date_from]" value="' . $context->employee->stats_date_from . '" data-date-format="' . $this->getDateFormat(); $script .= '" tabindex="1" /><label>' . JText::_('COM_JEPROSHOP_TO_LABEL') . '</label><input class="date-input form-control" id="date-end" placeholder="End" type="text"'; $script .= ' name="jform[date_to]" value="' . $context->employee->stats_date_to . '" data-date-format="' . $this->getDateFormat() . '" tabindex="2" /></div></div>'; $script .= '<div id="jform_date_compare" class="form-date-group" ><div class="form-date-heading" ><span class="checkbox-title" ><label><input type="checkbox" '; $script .= 'id="jform_date_picker_compare" name="jform[date_picker_compare]" ' . (isset($compare_date_from) && isset($compare_date_to) ? ' checked="checked" ' : '') . ' tabindex="3">'; $script .= JText::_('COM_JEPROSHOP_COMPARE_TO_LABEL') . '</label></span><select id="jform_compare_options" class="form-control fixed-width-lg pull-right" name="jform[compare_date_option]" '; $script .= (is_null($compare_date_from) || is_null($compare_date_to) ? ' disabled="disabled" ' : '') . ' ><option value="1" ' . ($this->getCompareOption() == 1 ? 'selected="selected"' : ''); $script .= 'label="' . JText::_('COM_JEPROSHOP_PREVIOUS_PERIOD_LABEL') . '" >' . JText::_('COM_JEPROSHOP_PREVIOUS_PERIOD_LABEL') . '</option><option value="2" '; $script .= ($this->getCompareOption() == 2 ? ' selected="selected" ' : '') . ' label="' . JText::_('COM_JEPROSHOP_PREVIOUS_YEAR_LABEL') . '">' . JText::_('COM_JEPROSHOP_PREVIOUS_YEAR_LABEL') . '</option>'; $script .= '<option value="3" ' . ($this->getCompareOption() == 3 ? ' selected="selected"' : '') . ' label="' . JText::_('COM_JEPROSHOP_CUSTOM_LABEL') . '">' . JText::_('COM_JEPROSHOP_CUSTOM_LABEL') . '</option>'; $script .= '</select></div> <div class="form-date-body" id="jform_date_body_compare"' . (is_null($compare_date_from) || is_null($compare_date_to) ? ' style="display: none;" ' : '') . '>'; $script .= '<label>' . JText::_('COM_JEPROSHOP_FROM_LABEL') . '</label><input id="jform_date_start_compare" class="date-input form-control" type="text" placeholder="Start" name="compare_date_from" value="'; $script .= $compare_date_from . '" data-date-format="' . $this->getDateFormat() . '" tabindex="4" /><label>' . JText::_('COM_JEPROSHOP_TO_LABEL') . '</label><input id="jform_date_end_compare" class="date-input '; $script .= 'form-control" type="text" placeholder="End" name="jform[compare_date_to]" value="' . $compare_date_to . '" data-date-format="' . $this->getDateFormat() . '" tabindex="5" /></div></div>'; $script .= '<div class="form-date-actions" ><button class="btn btn-link" type="button" id="jform_date_picker_cancel" tabindex="7" ><i class="icon-remove"></i> ' . JText::_('COM_JEPROSHOP_CANCEL_LABEL'); $script .= '</button><button class="btn btn-default pull-right" type="submit" name="submitDateRange" tabindex="6"><i class="icon-ok text-success"></i> ' . JText::_('COM_JEPROSHOP_APPLY_LABEL') . '</button></div></div></div></div></div></div></div>'; /*}else{ $script = ''; }*/ echo $script; return $script; }